Class ReadBinLogIT.EventQueue

java.lang.Object
io.debezium.connector.mysql.ReadBinLogIT.EventQueue
All Implemented Interfaces:
com.github.shyiko.mysql.binlog.BinaryLogClient.EventListener
Enclosing class:
ReadBinLogIT

protected static class ReadBinLogIT.EventQueue extends Object implements com.github.shyiko.mysql.binlog.BinaryLogClient.EventListener
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private final Consumer<com.github.shyiko.mysql.binlog.event.Event>
     
    private final long
     
    private final Consumer<com.github.shyiko.mysql.binlog.event.Event>
     
    private final ConcurrentLinkedQueue<com.github.shyiko.mysql.binlog.event.Event>
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    EventQueue(long defaultTimeoutInMillis, Consumer<com.github.shyiko.mysql.binlog.event.Event> consumedEvents, Consumer<com.github.shyiko.mysql.binlog.event.Event> ignoredEvents)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    consume(int eventCount, long timeoutInMillis, Predicate<com.github.shyiko.mysql.binlog.event.Event> condition)
    Blocks until the listener has consume the specified number of matching events, blocking at most the specified number of milliseconds.
    void
    consume(int eventCount, com.github.shyiko.mysql.binlog.event.EventType type)
    Blocks until the listener has seen the specified number of events with the given type, or until the default timeout has passed.
    void
    consume(int eventCount, com.github.shyiko.mysql.binlog.event.EventType type, long timeoutMillis)
    Blocks until the listener has seen the specified number of events with the given type, or until the specified time has passed.
    void
    consume(int eventCount, Class<? extends com.github.shyiko.mysql.binlog.event.EventData> eventDataClass)
    Blocks until the listener has seen the specified number of events with the given type, or until the default timeout has passed.
    void
    consume(int eventCount, Class<? extends com.github.shyiko.mysql.binlog.event.EventData> eventDataClass, long timeoutMillis)
    Blocks until the listener has seen the specified number of events with event data matching the specified class, or until the specified time has passed.
    void
    consume(int eventCount, Predicate<com.github.shyiko.mysql.binlog.event.Event> condition)
    Blocks until the listener has consume the specified number of matching events, blocking at most the default number of milliseconds.
    void
    consumeAll(long timeout, TimeUnit unit)
    Blocks for the specified amount of time, consuming (and discarding) all events.
    private void
    defaultEventHandler(com.github.shyiko.mysql.binlog.event.Event event)
     
    void
    onEvent(com.github.shyiko.mysql.binlog.event.Event event)
     
    void
    Clear the queue.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • queue

      private final ConcurrentLinkedQueue<com.github.shyiko.mysql.binlog.event.Event> queue
    • consumedEvents

      private final Consumer<com.github.shyiko.mysql.binlog.event.Event> consumedEvents
    • ignoredEvents

      private final Consumer<com.github.shyiko.mysql.binlog.event.Event> ignoredEvents
    • defaultTimeoutInMillis

      private final long defaultTimeoutInMillis
  • Constructor Details

    • EventQueue

      public EventQueue(long defaultTimeoutInMillis, Consumer<com.github.shyiko.mysql.binlog.event.Event> consumedEvents, Consumer<com.github.shyiko.mysql.binlog.event.Event> ignoredEvents)
  • Method Details

    • defaultEventHandler

      private void defaultEventHandler(com.github.shyiko.mysql.binlog.event.Event event)
    • onEvent

      public void onEvent(com.github.shyiko.mysql.binlog.event.Event event)
      Specified by:
      onEvent in interface com.github.shyiko.mysql.binlog.BinaryLogClient.EventListener
    • consumeAll

      public void consumeAll(long timeout, TimeUnit unit) throws TimeoutException
      Blocks for the specified amount of time, consuming (and discarding) all events.
      Parameters:
      timeout - the maximum amount of time that this method should block
      unit - the time unit for timeout
      Throws:
      TimeoutException - if the waiting timed out before the expected number of events were received
    • consume

      public void consume(int eventCount, Predicate<com.github.shyiko.mysql.binlog.event.Event> condition) throws TimeoutException
      Blocks until the listener has consume the specified number of matching events, blocking at most the default number of milliseconds. If this method has not reached the number of matching events and comes across events that do not satisfy the predicate, those events are consumed and ignored.
      Parameters:
      eventCount - the number of events
      condition - the event-based predicate that signals a match; may not be null
      Throws:
      TimeoutException - if the waiting timed out before the expected number of events were received
    • consume

      public void consume(int eventCount, long timeoutInMillis, Predicate<com.github.shyiko.mysql.binlog.event.Event> condition) throws TimeoutException
      Blocks until the listener has consume the specified number of matching events, blocking at most the specified number of milliseconds. If this method has not reached the number of matching events and comes across events that do not satisfy the predicate, those events are consumed and ignored.
      Parameters:
      eventCount - the number of events
      timeoutInMillis - the maximum amount of time in milliseconds that this method should block
      condition - the event-based predicate that signals a match; may not be null
      Throws:
      TimeoutException - if the waiting timed out before the expected number of events were received
    • consume

      public void consume(int eventCount, com.github.shyiko.mysql.binlog.event.EventType type) throws TimeoutException
      Blocks until the listener has seen the specified number of events with the given type, or until the default timeout has passed.
      Parameters:
      eventCount - the number of events
      type - the type of event
      Throws:
      TimeoutException - if the waiting timed out before the expected number of events were received
    • consume

      public void consume(int eventCount, com.github.shyiko.mysql.binlog.event.EventType type, long timeoutMillis) throws TimeoutException
      Blocks until the listener has seen the specified number of events with the given type, or until the specified time has passed.
      Parameters:
      eventCount - the number of events
      type - the type of event
      timeoutMillis - the maximum amount of time in milliseconds that this method should block
      Throws:
      TimeoutException - if the waiting timed out before the expected number of events were received
    • consume

      public void consume(int eventCount, Class<? extends com.github.shyiko.mysql.binlog.event.EventData> eventDataClass) throws TimeoutException
      Blocks until the listener has seen the specified number of events with the given type, or until the default timeout has passed.
      Parameters:
      eventCount - the number of events
      eventDataClass - the EventData subclass
      Throws:
      TimeoutException - if the waiting timed out before the expected number of events were received
    • consume

      public void consume(int eventCount, Class<? extends com.github.shyiko.mysql.binlog.event.EventData> eventDataClass, long timeoutMillis) throws TimeoutException
      Blocks until the listener has seen the specified number of events with event data matching the specified class, or until the specified time has passed.
      Parameters:
      eventCount - the number of events
      eventDataClass - the EventData subclass
      timeoutMillis - the maximum amount of time in milliseconds that this method should block
      Throws:
      TimeoutException - if the waiting timed out before the expected number of events were received
    • reset

      public void reset()
      Clear the queue.