WSO2 BPS - Concepts -

Concepts

Table of Content


Process Versioning

Versioning

If a package with existing package name is uploaded, all the processes in the package will be versioned. In this case, all the old processes in the package will be retired while a new version will be be deployed. Since there is only package level versioning, the new package should include all the processes defined in the old package, eventhough you may only need to update a single process in that package.


Process Instance Events

Events

WSO2 BPS generates events to let you track what is exactly happening in the engine and produces detailed information about process executions. These events are persisted in BPS's database and can be queried using theManagement API. The default behaviour for the engine is to always generate all events for every executed action. However from a performance standpoint it is better to deactivate some of the events you're not interested in (or even all of them). Inserting all these events generates a non-negligible overhead.


Event Types

The following table details each event possibly generated by ODE:

Event Name Process/Scope Description Type
ActivityEnabledEvent Scope An activity is enabled (just before it's started) activityLifecycle
ActivityDisabledEvent Scope An activity is disabled (due to dead path elimination) activityLifecycle
ActivityExecStartEvent Scope An activity starts its execution activityLifecycle
ActivityExecEndEvent Scope An activity execution terminates activityLifecycle
ActivityFailureEvent Scope An activity failed activityLifecycle
CompensationHandlerRegistered Scope A compensation handler gets registered on a scope scopeHandling
CorrelationMatchEvent Process A matching correlation has been found upon reception of a message correlation
CorrelationNoMatchEvent Process No matching correlation has been found upon reception of a message correlation
CorrelationSetWriteEvent Scope A correlation set value has been initialized dataHandling
NewProcessInstanceEvent Process A new process instance is created instanceLifecycle
PartnerLinkModificationEvent Scope A partner link has been modified (a new value has been assigned to it) dataHandling
ProcessCompletionEvent Process A process instance completes instanceLifecycle
ProcessInstanceStartedEvent Process A process instance starts instanceLifecycle
ProcessInstanceStateChangeEvent Process The state of a process instance has changed instanceLifecycle
ProcessMessageExchangeEvent Process A process instance has received a message instanceLifecycle
ProcessTerminationEvent Process A process instance terminates instanceLifecycle
ScopeCompletionEvent Scope A scope completes scopeHandling
ScopeFaultEvent Scope A fault has been produced in a scope scopeHandling
ScopeStartEvent Scope A scope started scopeHandling
VariableModificationEvent Scope The value of a variable has been modified dataHandling
VariableReadEvent Scope The value of a variable has been read dataHandling


The second column specifies whether an event is associated with the process itself or with one of its scopes. The event type is used for filtering events.


Filtering Events

Filtering at the process level

Using the deployment descriptor, it is possible to tweak events generation to filtrate which ones get created. First, events can be filtered at the process level using one of the following stanza:

<dd:process-eventsgenerate="all"/><!-- Default configuration --><dd:process-eventsgenerate="none"/><dd:process-events><dd:enable-event>dataHandling</dd:enable-event><dd:enable-event>activityLifecycle</dd:enable-event></dd:process-events>

The first form just duplicates the default behaviour, when nothing is specified in the deployment descriptor, all events are generated. The third form lets you define which type of event is generated, possible types are:


Filtering at the scope level

It is also possible to define filtering for each scope of your process. This overrides the settings defined on the process. In order to define event filtering on a scope, the scope activity MUST have a name in your process definition. Scopes are referenced by name in the deployment descriptor:

<dd:deployxmlns:dd="http://www.apache.org/ode/schemas/dd/2007/03">
    ...
    <dd:process-eventsgenerate="none"><dd:scope-eventsname="aScope"><dd:enable-event>dataHandling</bpel:enable-event><dd:enable-event>scopeHandling</bpel:enable-event></dd:scope-events><dd:scope-eventsname="anotherScope"><dd:enable-event>activityLifecycle</bpel:enable-event></dd:scope-events></dd:process-events>
    ...
</dd:deploy>

Note : Note that it is useless to enable an event associated with the process itself when filtering events on scopes. The filter defined on a scope is automatically inherited by its inner scopes. So if no filter is defined on a scope, it will use the settings of its closest parent scope having event filters (up to the process). Note that what gets inherited is the full list of selected events, not each event definition individually.


Event Listeners

WSO2 BPS lets you register your own event listeners to analyse all produced events and do whatever you want to do with them. To create a listener, you just need to implement the org.apache.ode.bpel.iapi.BpelEventListener interface.

Then add your implementation in the server's classpath (BPS_HOME/repository/components/lib) and add a property in bps.xml giving your fully qualified implementation class name:

<tns:WSO2BPSxmlns:tns="http://wso2.org/bps/config">
  ...
    <tns:EventListeners><tns:listenerclass="org.wso2.bps.samples.eventlistener.CustomEventListener"/></tns:EventListeners>
  ...
</tns:WSO2BPS>

You can try the sample event listener that is shipped with WSO2 BPS by adding above configuration to the bps.xml and restart the server. You can find the source of the sample implementation of event listener here.