Interface ZeebeTestEngine
public interface ZeebeTestEngine
The engine used to execute processes. This engine is a stripped down version of the actual Zeebe
Engine. It's intended for testing purposes only.
-
Method Summary
Modifier and TypeMethodDescriptionio.camunda.zeebe.client.ZeebeClientio.camunda.zeebe.client.ZeebeClientcreateClient(com.fasterxml.jackson.databind.ObjectMapper customObjectMapper) voidincreaseTime(Duration timeToAdd) Increases the time of the test engine.voidstart()Starts the test enginevoidstop()Stops the test enginevoidwaitForBusyState(Duration timeout) Waits for the engine to reach a busy state.voidwaitForIdleState(Duration timeout) The engine is in an idle state when there is nothing left to do for it.
-
Method Details
-
start
void start()Starts the test engine -
stop
void stop()Stops the test engine -
getRecordStreamSource
RecordStreamSource getRecordStreamSource()- Returns:
- the
RecordStreamSourceof this test engine
-
createClient
io.camunda.zeebe.client.ZeebeClient createClient()- Returns:
- a newly created
ZeebeClient
-
createClient
io.camunda.zeebe.client.ZeebeClient createClient(com.fasterxml.jackson.databind.ObjectMapper customObjectMapper) - Returns:
- a newly created
ZeebeClientwith custom mapper
-
getGatewayAddress
String getGatewayAddress()- Returns:
- the address at which the gateway is reachable
-
increaseTime
Increases the time of the test engine. Increasing the time can be useful for triggering timers with a date in the future.- Parameters:
timeToAdd- the amount of time to increase the engine with
-
waitForIdleState
The engine is in an idle state when there is nothing left to do for it. In this state, the engine is waiting for an external command sent by a client, or for an event to trigger. For example, when a timer expires the engine may need to continue orchestrating some process instance(s).On a technical level, idle state is defined by
- The point in time when all current records in the commit log have been processed by the engine
- This is insufficient, however, because the engine might still be in the process of writing follow-up records
- Therefore, when the first idle state is detected, a grace period (30ms) starts. If no new records come in during that grace period, then at the end of the grace period callbacks are notified
- Parameters:
timeout- the maximum amount of time to wait before idle state has been reached- Throws:
InterruptedException- if the current thread was interrupted while waitingTimeoutException- if the engine has not reached an idle state before the timeout
-
waitForBusyState
Waits for the engine to reach a busy state. We consider the engine to be in a busy state when new records are being processed since we started waiting.- Parameters:
timeout- the maximum amount of time to wait before busy state has been reached- Throws:
InterruptedException- if the current thread was interrupted while waitingTimeoutException- if the engine has not reached a busy state before the timeout
-