Package org.flowable.engine.runtime
Interface ProcessInstanceStartEventSubscriptionBuilder
public interface ProcessInstanceStartEventSubscriptionBuilder
A builder API to create an event subscription to start an event-based process instance whenever an event with a very specific
combination of correlation values occurs.
You can model an event-based start for a process model to create a new process instance whenever that event happens, but not, if
it should only start a process on a particular combination of correlation values.
In order for this to work, you need a process definition with an event registry start, configured with the manual, correlation based
subscription behavior.
- Author:
- Micha Kiener
-
Method Summary
Modifier and TypeMethodDescriptionaddCorrelationParameterValue
(String parameterName, Object parameterValue) Adds a specific correlation parameter value for the subscription, which means this value needs to exactly match the event payload in order to trigger the process start (along with all registered correlation parameter values of course).addCorrelationParameterValues
(Map<String, Object> parameters) Registers a list of correlation parameter values for the subscription.Mark the subscription to not use the latest process definition automatically, should there be a new version deployed after the subscription was created.processDefinitionKey
(String processDefinitionKey) Set the process definition to be started using a manually added subscription by its key.org.flowable.eventsubscription.api.EventSubscription
Creates the event subscription with the registered combination of correlation parameter values and saves it.Set the tenant id for the subscription.
-
Method Details
-
processDefinitionKey
Set the process definition to be started using a manually added subscription by its key. By default, always the latest version is used to start a new process instance, unless you usedoNotUpdateToLatestVersionAutomatically()
to mark the builder to stick to exactly the current version of the process definition and don't update it, if a new version would be deployed later on. This method is mandatory and will throw an exception when trying to register a subscription where the process definition key was not set or is null.- Parameters:
processDefinitionKey
- the key of the process definition to be started a new instance of when the subscription has a match at runtime- Returns:
- the builder to be used for method chaining
-
doNotUpdateToLatestVersionAutomatically
ProcessInstanceStartEventSubscriptionBuilder doNotUpdateToLatestVersionAutomatically()Mark the subscription to not use the latest process definition automatically, should there be a new version deployed after the subscription was created. This means, adding the subscription will always stick to the current version of the process definition, and it will NOT be updated automatically should there be a new version deployed later on. By default, when this method is not invoked on the builder, the subscription will be updated automatically to the latest version when a new version of the process definition is deployed. The subscription can still be updated to the latest version by manually migrating it to whatever version you want.- Returns:
- the builder to be used for method chaining
-
addCorrelationParameterValue
ProcessInstanceStartEventSubscriptionBuilder addCorrelationParameterValue(String parameterName, Object parameterValue) Adds a specific correlation parameter value for the subscription, which means this value needs to exactly match the event payload in order to trigger the process start (along with all registered correlation parameter values of course).- Parameters:
parameterName
- the name of the correlation parameterparameterValue
- the value of the correlation parameter- Returns:
- the builder to be used for method chaining
-
addCorrelationParameterValues
ProcessInstanceStartEventSubscriptionBuilder addCorrelationParameterValues(Map<String, Object> parameters) Registers a list of correlation parameter values for the subscription. The result is the same as registering them one after the other.- Parameters:
parameters
- the map of correlation parameter values to be registered for the subscription- Returns:
- the builder to be used for method chaining
-
tenantId
Set the tenant id for the subscription.- Parameters:
tenantId
- the id of the tenant- Returns:
- the builder to be used for method chaining
-
subscribe
org.flowable.eventsubscription.api.EventSubscription subscribe()Creates the event subscription with the registered combination of correlation parameter values and saves it.
-