Package io.debezium.connector.mysql
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
FieldsModifier and TypeFieldDescriptionprivate final Consumer<com.github.shyiko.mysql.binlog.event.Event>private final longprivate final Consumer<com.github.shyiko.mysql.binlog.event.Event>private final ConcurrentLinkedQueue<com.github.shyiko.mysql.binlog.event.Event> -
Constructor Summary
ConstructorsConstructorDescriptionEventQueue(long defaultTimeoutInMillis, Consumer<com.github.shyiko.mysql.binlog.event.Event> consumedEvents, Consumer<com.github.shyiko.mysql.binlog.event.Event> ignoredEvents) -
Method Summary
Modifier and TypeMethodDescriptionvoidconsume(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.voidconsume(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.voidconsume(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.voidconsume(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.voidconsume(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.voidBlocks until the listener has consume the specified number of matching events, blocking at most the default number of milliseconds.voidconsumeAll(long timeout, TimeUnit unit) Blocks for the specified amount of time, consuming (and discarding) all events.private voiddefaultEventHandler(com.github.shyiko.mysql.binlog.event.Event event) voidonEvent(com.github.shyiko.mysql.binlog.event.Event event) voidreset()Clear the queue.
-
Field Details
-
queue
-
consumedEvents
-
ignoredEvents
-
defaultTimeoutInMillis
private final long defaultTimeoutInMillis
-
-
Constructor Details
-
EventQueue
-
-
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:
onEventin interfacecom.github.shyiko.mysql.binlog.BinaryLogClient.EventListener
-
consumeAll
Blocks for the specified amount of time, consuming (and discarding) all events.- Parameters:
timeout- the maximum amount of time that this method should blockunit- the time unit fortimeout- 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 eventscondition- 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 eventstimeoutInMillis- the maximum amount of time in milliseconds that this method should blockcondition- 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 eventstype- 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 eventstype- the type of eventtimeoutMillis- 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 eventseventDataClass- 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 eventseventDataClass- the EventData subclasstimeoutMillis- 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.
-