Class CountDownProcessInstanceEventPublisher
- java.lang.Object
-
- io.automatiko.engine.services.event.impl.CountDownProcessInstanceEventPublisher
-
- All Implemented Interfaces:
io.automatiko.engine.api.event.EventPublisher
public class CountDownProcessInstanceEventPublisher extends Object implements io.automatiko.engine.api.event.EventPublisher
Event publisher used for tracking execution to be able to efficiently wait for completion Main use case for it is testing of business logic
-
-
Constructor Summary
Constructors Constructor Description CountDownProcessInstanceEventPublisher()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidpublish(io.automatiko.engine.api.event.DataEvent<?> event)voidpublish(Collection<io.automatiko.engine.api.event.DataEvent<?>> events)voidreset(int count)Sets the count down latch to given number of process instance events.voidwaitTillCompletion(long timeout)Blocks the execution and wait for all expected process instance events to arrivevoidwaitTillCompletion(long timeout, TimeUnit unit)Blocks the execution and wait for all expected process instance events to arrive
-
-
-
Method Detail
-
publish
public void publish(io.automatiko.engine.api.event.DataEvent<?> event)
- Specified by:
publishin interfaceio.automatiko.engine.api.event.EventPublisher
-
publish
public void publish(Collection<io.automatiko.engine.api.event.DataEvent<?>> events)
- Specified by:
publishin interfaceio.automatiko.engine.api.event.EventPublisher
-
reset
public void reset(int count)
Sets the count down latch to given number of process instance events.- Parameters:
count- number of expected events
-
waitTillCompletion
public void waitTillCompletion(long timeout) throws InterruptedExceptionBlocks the execution and wait for all expected process instance events to arrive- Parameters:
timeout- maximum amount of time (in seconds) it should wait- Throws:
InterruptedException- in case it was interrupted while waiting
-
waitTillCompletion
public void waitTillCompletion(long timeout, TimeUnit unit) throws InterruptedExceptionBlocks the execution and wait for all expected process instance events to arrive- Parameters:
timeout- maximum amount of time (in given time unit) it should waitunit- time unit of the given timeout- Throws:
InterruptedException- in case it was interrupted while waiting
-
-