Class DbEventScopeInstanceState
java.lang.Object
io.camunda.zeebe.engine.state.instance.DbEventScopeInstanceState
- All Implemented Interfaces:
EventScopeInstanceState
,MutableEventScopeInstanceState
public final class DbEventScopeInstanceState
extends Object
implements MutableEventScopeInstanceState
-
Constructor Summary
ConstructorDescriptionDbEventScopeInstanceState
(ZeebeDb<ZbColumnFamilies> zeebeDb, TransactionContext transactionContext) -
Method Summary
Modifier and TypeMethodDescriptionboolean
canTriggerEvent
(long eventScopeKey, org.agrona.DirectBuffer elementId) Checks if the event scope can be triggered for the given event.void
createInstance
(long eventScopeKey, Collection<org.agrona.DirectBuffer> interruptingElementIds, Collection<org.agrona.DirectBuffer> boundaryElementIds) Creates a new event scope instance in the state.void
deleteInstance
(long eventScopeKey) Delete an event scope from the state.void
deleteTrigger
(long eventScopeKey, long eventKey) Deletes an event trigger by key and scope key.getInstance
(long eventScopeKey) Returns a event scope instance by key or null if none exists with this key.peekEventTrigger
(long eventScopeKey) Returns the next event trigger for the event scope or null if none exists.pollEventTrigger
(long eventScopeKey) Returns the next event trigger for the event scope or null if none exists.void
triggerEvent
(long eventScopeKey, long eventKey, org.agrona.DirectBuffer elementId, org.agrona.DirectBuffer variables, long processInstanceKey) Creates a new event trigger for the given event scope.void
triggerStartEvent
(long processDefinitionKey, long eventKey, org.agrona.DirectBuffer elementId, org.agrona.DirectBuffer variables, long processInstanceKey) Creates an event trigger for a process start event.
-
Constructor Details
-
DbEventScopeInstanceState
public DbEventScopeInstanceState(ZeebeDb<ZbColumnFamilies> zeebeDb, TransactionContext transactionContext)
-
-
Method Details
-
createInstance
public void createInstance(long eventScopeKey, Collection<org.agrona.DirectBuffer> interruptingElementIds, Collection<org.agrona.DirectBuffer> boundaryElementIds) Description copied from interface:MutableEventScopeInstanceState
Creates a new event scope instance in the state. The event scope is interrupted if one of the interrupting elements is triggered. An interrupted event scope can not be triggered by other interrupting or non-interrupting events, except boundary events. After a interrupting boundary event is triggered, no other event, including boundary events, can be triggered for the event scope.- Specified by:
createInstance
in interfaceMutableEventScopeInstanceState
- Parameters:
eventScopeKey
- the event scope keyinterruptingElementIds
- element IDs that interrupt the event scopeboundaryElementIds
- element IDs of boundary events
-
deleteInstance
public void deleteInstance(long eventScopeKey) Description copied from interface:MutableEventScopeInstanceState
Delete an event scope from the state. Does not fail in case the scope does not exist.- Specified by:
deleteInstance
in interfaceMutableEventScopeInstanceState
- Parameters:
eventScopeKey
- the key of the event scope to delete
-
pollEventTrigger
Description copied from interface:MutableEventScopeInstanceState
Returns the next event trigger for the event scope or null if none exists. This will remove the polled event trigger from the state if it exists.- Specified by:
pollEventTrigger
in interfaceMutableEventScopeInstanceState
- Parameters:
eventScopeKey
- the key of the event scope- Returns:
- the next event trigger or null if none exist
-
triggerEvent
public void triggerEvent(long eventScopeKey, long eventKey, org.agrona.DirectBuffer elementId, org.agrona.DirectBuffer variables, long processInstanceKey) Description copied from interface:MutableEventScopeInstanceState
Creates a new event trigger for the given event scope. Ignores the trigger if the event scope doesn't exist or if the event can be triggered in the scope (e.g. the scope is interrupted). UseEventScopeInstanceState.canTriggerEvent(long, DirectBuffer)
to check if the event can be triggered before calling this method.- Specified by:
triggerEvent
in interfaceMutableEventScopeInstanceState
- Parameters:
eventScopeKey
- the key of the event scope the event is triggered ineventKey
- the key of the event record (used for ordering)elementId
- the id of the element which should be triggered, e.g. boundary eventvariables
- the variables of the occurred event, i.e. message variablesprocessInstanceKey
- the key of the process instance this event is a part of
-
triggerStartEvent
public void triggerStartEvent(long processDefinitionKey, long eventKey, org.agrona.DirectBuffer elementId, org.agrona.DirectBuffer variables, long processInstanceKey) Description copied from interface:MutableEventScopeInstanceState
Creates an event trigger for a process start event. Uses the process definition key as the scope key of the trigger.- Specified by:
triggerStartEvent
in interfaceMutableEventScopeInstanceState
- Parameters:
processDefinitionKey
- the key of the process definition a new instance should be created ofeventKey
- the key of the event record (used for ordering)elementId
- the id of the start event which should be triggeredvariables
- the variables of the occurred event, i.e. message variablesprocessInstanceKey
- the key of the process instance this event is a part of
-
deleteTrigger
public void deleteTrigger(long eventScopeKey, long eventKey) Description copied from interface:MutableEventScopeInstanceState
Deletes an event trigger by key and scope key. Does not fail if the trigger does not exist.- Specified by:
deleteTrigger
in interfaceMutableEventScopeInstanceState
- Parameters:
eventScopeKey
- the key of the event scopeeventKey
- the key of the event trigger
-
getInstance
Description copied from interface:EventScopeInstanceState
Returns a event scope instance by key or null if none exists with this key.- Specified by:
getInstance
in interfaceEventScopeInstanceState
- Parameters:
eventScopeKey
- the key of the event scope- Returns:
- the event scope instance or null
-
peekEventTrigger
Description copied from interface:EventScopeInstanceState
Returns the next event trigger for the event scope or null if none exists. This will not remove the event trigger from the state.- Specified by:
peekEventTrigger
in interfaceEventScopeInstanceState
- Parameters:
eventScopeKey
- the key of the event scope- Returns:
- the next event trigger or null if none exist
-
canTriggerEvent
public boolean canTriggerEvent(long eventScopeKey, org.agrona.DirectBuffer elementId) Description copied from interface:EventScopeInstanceState
Checks if the event scope can be triggered for the given event.- Specified by:
canTriggerEvent
in interfaceEventScopeInstanceState
- Parameters:
eventScopeKey
- the key of the event scope the event is triggered inelementId
- the element id of the event that is triggered- Returns:
true
if the event can be triggered, otherwisefalse
-