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
Fields Modifier and Type Field Description private Consumer<com.github.shyiko.mysql.binlog.event.Event>consumedEventsprivate longdefaultTimeoutInMillisprivate Consumer<com.github.shyiko.mysql.binlog.event.Event>ignoredEventsprivate ConcurrentLinkedQueue<com.github.shyiko.mysql.binlog.event.Event>queue
-
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
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidconsume(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.voidconsume(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.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 Detail
-
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
-
-
Method Detail
-
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
public void consumeAll(long timeout, TimeUnit unit) throws TimeoutExceptionBlocks 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 TimeoutExceptionBlocks 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 TimeoutExceptionBlocks 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 TimeoutExceptionBlocks 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 TimeoutExceptionBlocks 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 TimeoutExceptionBlocks 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 TimeoutExceptionBlocks 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.
-
-