Introduction
The version 1.0.0 of the component embeds the BPMN 2.0 engine "Activiti". So, Activiti extensions can be used at the runtime level.
Using the mode "service"
Creating a service-unit for a process definition
Creating the service contract
The SE BPMN2 provides a service with several operation for a process definition. A WSDL is associated to this service. This WSDL can be written freely. The user can use its own namespace, its own names, ... It is only constraint by the following rules:
- the operations of the binding section are annotated to link them to the supported operations of the process definition (create an instance of the process definition, complete the current task of the process instance, ...)
- the parameters of the operation are annotated to retrieve the right values to transmit to the BPMN engine,
- the output and fault of the operations are annotated to build the service output from the result of the operation on the BPMN engine side.
| For a unit test purpose, an extension of JUnit is available to validate your WSDL not only in a pur WSDL point of view, but also in a SE BPMN2 point of view. See chapter "[Unit testing]". |
Identifying operations
The mapping between operations of the WSDL and operations supported by the BPMN 2.0 embedded in the SE BPMN2 is declared using a dedicated binding. The binding "BPMN2" is done adding the element {http://petals.ow2.org/se/bpmn2.0/1.0}operation to the element operation of the binding. Its attribute action defines the operation that will be executed on the process engine according to the following values:
| Value of action | Operation executed on the process engine |
|---|---|
| startEvent | Create a new instance of the process. See [Associating an operation to the creation of an process definition instance] for more information on this operation. |
| userTask | Complete a user task. See [Associating an operation to the completion of a process instance task] for more information on this operation. |
The action is completed with the required attribute actionId that identifies the start event used to create the process instance or the user task to complete.
Identifying input parameters of operations
In the same way, input parameters of operations are mapped through annotations placed inside of the binding operation. Two natures of input parameters exists:
- the expected input parameters
- and, variables.
Each BPMN 2.0 engine API operation can require mandatory or optional input parameter, the expected input parameters, and can accept to set several variables in the same time.
Expected input parameters are declared using dedicated annotation according to the operation:
| Value of the attribute action of the annotation bpmn:operation | Operation executed on the process engine |
|---|---|
| startEvent | Expected input parameters are:
|
| userTask | Expected input parameters are:
|
Variables are identified by the annotation adding the element {http://petals.ow2.org/se/bpmn2.0/1.0}variable:
- its attribute name defines the variable name used in the process definition.
- its content defines the value to set to the variable using an XPath expression.
<bpmn:variable name="numberOfDays">
/*[local-name()='demande']/*[local-name()='nbJourDde']
</bpmn:variable>
See operation details to know if variables can be set.
No extra check is done by the SE BPMN2 about the compliance of the variable with the process definition.
TODO. Les types ?; les arborescences
Identifying output parameters of operations
Output parameters of the BPMN 2.0 engine API operation can not be mapped to the output reply of the service operation using a simple XPath expression as for input parameters. An XSL style-sheet is required to generated the full output reply. It is identified using the annotation adding the element {http://petals.ow2.org/se/bpmn2.0/1.0}output that contains the XSL style-sheet name. The XSL style-sheet is read from the classloader or through a file relative to the root directory of the service unit. The XSL style-sheets are mainly located in the service-units, they can also be packaged as a shared library.
According to the operation executed by the BPMN 2.0 engine, its output parameters are transmitted to the XSL style-sheet through XSL parameters. You will use these XSL parameters to generate your service reply from your service request payload. See operation details to know the available XSL parameters.
| For a unit test purpose, an extension of JUnit is available to test your XSL. See chapter "[Unit testing]". |
Identifying faults of operations
When an error occurs on the BPMN engine side, this error can be returned as business fault or technical error. The business faults are declared into the WSDL of the service.
The mapping of an error of the BPMN engine to a business fault is defined using the annotation {http://petals.ow2.org/se/bpmn2.0/1.0}fault set as child element of the WSDL fault. The attribute name will contain a key word identifying the error on the BPMN engine. And the content value is the name of the XSLT style-sheet to use to generate the business fault.
The XSL style-sheet is read from the classloader or through a file relative to the root directory of the service unit. The XSL style-sheets are mainly located in the service-units, they can also be packaged as a shared library.
A error of the BPMN engine that can be mapped to a business fault has parameters that will be transmitted to the XSL to generate the right business fault content.
See operation details to known the errors thrown, and their parameters, that can be mapped to a business fault.
| For a unit test purpose, an extension of JUnit is available to test your XSL. See chapter "[Unit testing]". |
Associating an operation to the creation of an process definition instance
The operation creating instances of process definition is identified by the value startEvent set on the attribute action of the annotation {http://petals.ow2.org/se/bpmn2.0/1.0}operation. As your service unit can include several process definition, you need to clarify the process definition to use to create the process instance using the attribute processDefinitionId. As a process definition can include several start events, the right start event to use to create the new process instance is clarified with the attribute actionId.
This operation accepts variables and requires the following input parameters:
- user identifier, declared using the annotation {http://petals.ow2.org/se/bpmn2.0/1.0}userId containing an XPath expression that is applied on incoming XML payload to get the value of the user identifier to use on the BPMN engine side.
The XSL parameters available to generate the service output reply are:
| XSL parameter name | Type | Description |
|---|---|---|
| {
http://petals.ow2.org/se/bpmn/output-params/1.0/special
}processInstanceId |
String | Identifier of the process instance created |
| {
http://petals.ow2.org/se/bpmn/output-params/1.0/special
}userId |
String | The user identifier used to create the process instance |
| {
http://petals.ow2.org/se/bpmn/output-params/1.0/process-instance
}variable-name |
String | Process instance variables. <variable-name> is the name of a process instance variable. |
On this operation, no error thrown by the BPMN engine can be mapped to business fault.
It is possible to map several operations of the WSDL to the creation of process instances, but this has perhaps no sens.
<wsdl:binding name="Order" xmlns:bpmn="http://petals.ow2.org/se/bpmn2.0/1.0"> <wsdl:operation name="newOrder" type="..."> <bpmn:operation processDefinitionId="order" action="startEvent" actionId="newOrder"/> <bpmn:userId>/*[local-name()='newOrderRequest']/*[local-name()='userName']</bpmn:userId> <bpmn:variable name="address"> /*[local-name()='newOrderRequest']/*[local-name()='address'] </bpmn:variable> <bpmn:output>newOrderOutput.xsl</bpmn:output> <wsdl:input/> <wsdl:output/> </wsdl:operation> </wsdl:binding>
<newOrderRequest> <userName>Jean Zé</userName> <customerName>Mr Dupont Martin</customerName> <address>23, rue de la Paie, 75000 Paris</address> </newOrderRequest>
<newOrderResponse> <orderNumber>12345</orderNumber> </newOrderResponse>
Associating an operation to the completion of a process instance task
The operation completing a task of a process instance is identified by the value userTask set on the attribute action of the annotation {http://petals.ow2.org/se/bpmn2.0/1.0}operation. To guarantee that the expect user task is the right one, the identifier of the expected user task is clarified with the attribute actionId.
This operation accepts variables and requires the following input parameters:
- process instance identifier, declared using the annotation {http://petals.ow2.org/se/bpmn2.0/1.0}processId containing an XPath expression that is applied on incoming XML payload to get the value of the process instance identifier to use on the BPMN engine side.
- user identifier, declared using the annotation {http://petals.ow2.org/se/bpmn2.0/1.0}userId containing an XPath expression that is applied on incoming XML payload to get the value of the user identifier to use on the BPMN engine side.
Note: The completion status of the task is a variable and so it takes any form.
The XSL parameters available to generate the service output reply are:
| XSL parameter name | Type | Description |
|---|---|---|
| {
http://petals.ow2.org/se/bpmn/output-params/1.0/special
}processInstanceId |
String | Identifier of the process instance created |
| {
http://petals.ow2.org/se/bpmn/output-params/1.0/special
}userId |
String | The user identifier used to create the process instance |
| {
http://petals.ow2.org/se/bpmn/output-params/1.0/process-instance
}variable-name |
String | Process instance variables. <variable-name> is the name of a process instance variable. |
| {
http://petals.ow2.org/se/bpmn/output-params/1.0/task
}variable-name |
String | Task local variables. <variable-name> is the name of a task local variable. |
The following errors thrown by the BPMN engine can be mapped to business fault:
| Error | Description | XSL parameters |
|---|---|---|
| TaskCompletedException | The associated user task is already completed |
|
| ProcessInstanceNotFoundException | No active process instance found for the given process instance identifier | process instance identifier: {
http://petals.ow2.org/se/bpmn/faults/1.0
}processInstanceId |
| UnexpectedUserException | The task to complete is assigned to another user identifier |
|
A such operation is defined for each task of the process definition to complete. C'est le cas d'un service par tache à terminer. Essayer de mieux expliquer..
<wsdl:binding name="Order" xmlns:bpmn="http://petals.ow2.org/se/bpmn2.0/1.0" > <wsdl:operation name="validOrder"> <bpmn:operation processDefinitionId="order" action="userTask" actionId="validOrder"/> <bpmn:processId>/*[local-name()='validOrderRequest']/*[local-name()='orderId']</bpmn:processId> <bpmn:userId>/*[local-name()='validOrderRequest']/*[local-name()='userName']</bpmn:userId> <bpmn:variable name="validationApproved"> /*[local-name()='validOrderRequest']/*[local-name()='isValidated'] </bpmn:variable> <bpmn:variable name="creditCardNumber"> /*[local-name()='validOrderRequest']/*[local-name()='creditCardNumber'] </bpmn:variable> <bpmn:output>validOrderOutput.xsl</bpmn:output> <wsdl:input/> <wsdl:output/> <wsdl:fault name="orderUnknown"> <bpmn:fault name="ProcessInstanceNotFoundException">orderUnknown.xsl</bpmn:fault> <soap:fault name="orderUnknown" use="literal" /> </wsdl:fault> <wsdl:fault name="orderAlreadyValidated"> <bpmn:fault name="TaskCompletedException">orderAlreadyValidated.xsl</bpmn:fault> <soap:fault name="orderAlreadyValidated" use="literal" /> </wsdl:fault> </wsdl:operation> </wsdl:binding>
<validOrderRequest>
<orderId>12345</orderId>
<isValidated>true</isValidated>
<creditCardNumber>1234567890123</customerName>
<userName>Robert Té</userName>
</validOrderRequest>
<validOrderResponse />
Associating an operation to retrieve process instances
The operation retrieving process instances is identified by the value retrieveProcInst set on the attribute action:
<wsdl:binding name="Order" xmlns:bpmn="http://petals.ow2.org/se/bpmn2.0/1.0"> <wsdl:operation name="searchOrder" type="..."> <bpmn:operation action="retrieveProcInst" /> <bpmn:input-parameter name="isActive" value="/searchOrderRequest/isInProgress" /> <bpmn:input-parameter name="responsibleUser" value="/searchOrderRequest/responsibleUser" /> <bpmn:input-parameter name="responsibleGroup" value="/searchOrderRequest/responsibleGroup" /> <bpmn:output>searchOrderOutput.xsl</bpmn:output> <wsdl:input/> <wsdl:output/> </wsdl:operation> </wsdl:binding>
This operation requires the following input parameters:
| Input parameter name | Type | Description | Required |
|---|---|---|---|
| isActive | Boolean | Only active task are returned. | No |
| responsibleUser | String | Only select tasks for which the given user is a candidate are returned. | No |
| responsibleGroup | String | Only select tasks for which users in the given group are candidates are returned. | No |
It does not use variables.
The process instances returned by the component are all associated to the current process definition (the process definition packaged in the service unit).
The XSL parameters available to generate the service output reply are:
| XSL parameter name | Type | Description |
|---|---|---|
| processInstances | Quel type 'list' est exploitable coté XSL | The list of process instance identifier matching criteria. |
It is possible to map several operations of the WSDL to search process instance, for example with different search criteria.
Deploying a service unit
When deploying the service unit on the SE BPMN2, the embedded process definition is automatically deployed into the BPMN 2.0 engine, and the associated services are registered.
| When a Petals ESB node restarts, all service units previously deployed are redeployed. So if a process definition is already registered in the BPMN 2.0 engine, its registration is skipped without any message. |
| To be able to fix a process definition, you must create a new version of the process definition |
Undeploying a service unit
When undeploying a service unit from the SE BPMN2, the embedded process definition is deregistered from the BPMN 2.0 engine, and the assocaited services are unregistered.
Que faire si il y a encore de process instances en cours ?
Using the mode "integration"
The mode "integration" provides different services to interact directly with the BPMN 2.0 engine embedded in the SE BPMN 2.0. It goes back over the BPMN 2.0 engine API. Available services are:
| Interface name | Service name | Description |
|---|---|---|
| Runtime | RuntimeService | To manage process instances |
| Task | TaskService | To manage task of process instances |
A completer avec Bertrand
For this version of the SE BPMN 2.0, see the WSDL of the service and the Activiti Java API documentation to get more information.
| The namespace of interface name and service name is http://petals.ow2.org/components/activiti/generic/1.0 |
The service "RuntimeService"
The service "RuntimeService" provides following operations
| Operation name | Description | Matching Activity Java API |
|---|---|---|
| startProcessInstanceById | Starts a new process instance in the latest version of the process definition with the given id and variables. | RuntimeService.startProcessInstanceById(String, Map<String,Object>) |
| startProcessInstanceByKey | Starts a new process instance in the latest version of the process definition with the given key and variables. | RuntimeService.startProcessInstanceByKey(String, Map<String,Object>) |
A completer avec Bertrand
The service "TaskService"
The service "TaskService" provides following operations
| Operation name | Description | Matching Activity Java API |
|---|---|---|
| complete | Called when the task is successfully executed, and the required task parameters are given by the end-user. | TaskService.complete(String, Map<String,Object>) |
| getTasks | Query tasks according to the given criteria | {{TaskService.createTaskQuery() }} |
A completer avec Bertrand
Configuring the component
The component can be configured through the parameters of its JBI descriptor file. These parameters are divided in following groups:
- JBI parameters that have not to be changed otherwise the component will not work,
- CDK parameters that are parameters driving the processing of the CDK layer,
- and *BPMN 2.0 engine parameters" that are relative to the BPMN 2.0 engine.
TODO: Mettre une copie en exemple d'un descripteur JBI du SE
<?xml version="1.0" encoding="UTF-8"?> <jbi version="1.0" xmlns='http://java.sun.com/xml/ns/jbi' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xmlns:petalsCDK="http://petals.ow2.org/components/extensions/version-5" xmlns:xslt="http://petals.ow2.org/components/bpmn/version-1"> <component type="service-engine"> <identification> <name>petals-se-bpmn2</name> <description>An BPMN 2.0 Service Engine</description> </identification> <component-class-name description="BPMN 2.0 Component class">org.ow2.petals.se.bpmn2.Bpmn2Se</component-class-name> <component-class-path><path-element/></component-class-path> <bootstrap-class-name>org.ow2.petals.component.framework.DefaultBootstrap</bootstrap-class-name> <bootstrap-class-path><path-element/></bootstrap-class-path> <petalsCDK:acceptor-pool-size>3</petalsCDK:acceptor-pool-size> <petalsCDK:processor-pool-size>10</petalsCDK:processor-pool-size> <petalsCDK:processor-max-pool-size>50</petalsCDK:processor-max-pool-size> <petalsCDK:properties-file></petalsCDK:properties-file> <petalsCDK:jbi-listener-class-name>org.ow2.petals.se.bpmn2.BPMN2JBIListener</petalsCDK:jbi-listener-class-name> </component> </jbi>
CDK parameters
The component configuration includes the configuration of the CDK. The following parameters correspond to the CDK configuration.
| Parameter | Description | Default | Required | Scope |
|---|---|---|---|---|
| acceptor-pool-size | The size of the thread pool used to accept Message Exchanges from the NMR. Once a message is accepted, its processing is delegated to the processor pool thread. | 3
|
Yes
|
Runtime
|
| acceptor-retry-number | Number of tries to submit a message exchange to a processor for processing before to declare that it cannot be processed. | 40
|
No
|
Installation
|
| acceptor-retry-wait | Base duration, in milliseconds, to wait between two processing submission tries. At each try, the new duration is the previous one added by this base duration multiplied by the try number plus a random value between 0 and 10. | 250
|
No
|
Installation
|
| acceptor-stop-max-wait | The max duration (in milliseconds) of the stop of an acceptor before to force it to stop. | 500
|
No
|
Runtime
|
| message-processor-max-pool-size | Max size of the object pool containing message exchange processors. | processor-max-pool-size
|
No
|
Runtime
|
| processor-pool-size | The size of the thread pool used to process Message Exchanges. Once a message is accepted, its processing is delegated to one of the thread of this pool. | 10
|
Yes
|
Runtime
|
| processor-max-pool-size | The maximum size of the thread pool used to process Message Exchanges. The difference between this size and the processor-pool-size represents the dynamic threads that can be created and destroyed during overhead processing time. |
50
|
No
|
Runtime
|
| processor-keep-alive-time | When the number of processors is greater than the core, this is the maximum time that excess idle processors will wait for new tasks before terminating, in seconds. |
300
|
No
|
Runtime
|
| processor-stop-max-wait | The max duration (in milliseconds) of message exchange processing on stop phase. |
15000
|
No
|
Runtime
|
| time-beetween-async-cleaner-runs | The time (in milliseconds) between two runs of the asynchronous message exchange cleaner. |
2000
|
No
|
Installation
|
| properties-file | Name of the file containing properties used as reference by other parameters. Parameters reference the property name in the following pattern ${myPropertyName}. At runtime, the expression is replaced by the value of the property. The value of this parameter is :
|
-
|
No
|
Installation
|
| monitoring-sampling-period | Period, in seconds, of a sample used by response time probes of the monitoring feature. |
300
|
No
|
Installation
|
Definition of CDK parameter scope :
- Installation: The parameter can be set during the installation of the component, by using the installation MBean (see JBI specifications for details about the installation sequence). If the parameter is optional and has not been defined during the development of the component, it is not available at installation time.
- Runtime: The paramater can be set during the installation of the component and during runtime. The runtime configuration can be changed using the CDK custom MBean named RuntimeConfiguration. If the parameter is optional and has not been defined during the development of the component, it is not available at installation and runtime times.
Interceptor
Interceptors can be defined to inject some post or pre processing in the component during service processing.
Using interceptor is very sensitive and must be manipulate only by power users. An non properly coded interceptor engaged in a component can lead to uncontrolled behaviors, out of the standard process.
Example of an interceptor configuration:
<?xml version="1.0" encoding="UTF-8"?> <!--...--> <petalsCDK:component-interceptors> <petalsCDK:interceptor active="true" class="org.ow2.petals.myInterceptor" name="myInterceptorName"> <petalsCDK:param name="myParamName">myParamValue</petalsCDK:param> <petalsCDK:param name="myParamName2">myParamValue2</petalsCDK:param> </petalsCDK:interceptor> </petalsCDK:component-interceptors> <!--...-->
Interceptors configuration for Component (CDK)
| Parameter | Description | Default | Required |
|---|---|---|---|
| interceptor - class | Name of the interceptor class to implement. This class must extend the abstract class org.ow2.petals.component.common.interceptor.Interceptor. This class must be loadable from the component classloader, or in a dependent Shared Library classloader. | - | Yes |
| interceptor - name | Logical name of the interceptor instance. It can be referenced to add extended parameters by a SU Interceptor configuration. | - | Yes |
| interceptor - active | If true, the Interceptor instance is activated for every SU deployed on the component. If false, the Interceptor can be activated: -by the InterceptorManager Mbean at runtime, to activate the interceptor for every deployed SU. -by a SU configuration |
- | Yes |
| param[] - name | The name of the parameter to use for the interceptor. | - | No |
| param[] | The value of the parameter to use for the interceptor. | - | No |
Component specific parameters
These parameters drive features proposed by the component and configure the BPMN 2.0 engine "Activiti 5.14" embedded in the SE:
- activation of the mode 'integration',
- database parameters. Your are responsible to provide this database according to your needs. And especially, you must assume that the database is highly available to have a SE BPMN2 highly available.
| Parameter | Description | Default | Required | Scope |
|---|---|---|---|---|
| integration-mode-enable | Enable the mode 'Integration' | true
|
No
|
Installation
|
| jdbc-url | URL of the database. The default database is an in-memory database | jdbc:h2:mem:activiti;DB_CLOSE_DELAY=1000
|
Yes
|
Installation
|
| jdbc-driver | JDBC driver. Except for the default JDBC driver, it must be provided as shared-library. | org.h2.Driver
|
Yes
|
Installation
|
| jdbc-username | Username used for the database connection. | sa
|
Yes
|
Installation
|
| jdbc-password | Passwrd used for the database connection. | ""
|
Yes
|
Installation
|
| jdbc-max-active-connections | The number of idle connections that the database connection pool at maximum at any time can contain. | 10
|
No
|
Runtime
|
| jdbc-max-idle-connections | The number of active connections that the database connection pool at maximum at any time can contain. | -
|
No
|
Runtime
|
| jdbc-max-checkout-time | The amount of time in milliseconds a connection can be 'checked out' from the connection pool before it is forcefully returned. | 20000 (20 seconds)
|
No
|
Runtime
|
| jdbc-max-wait-time | This is a low level setting that gives the pool a chance to print a log status and re-attempt the acquisition of a connection in the case that it’s taking unusually long (to avoid failing silently forever if the pool is misconfigured). | 20000 (20 seconds)
|
No
|
Runtime
|
Business monitoring
MONIT traces are logged to each step of the BPMN process interacting with Petals ESB:
- when creating process instances,
- when completing user tasks,
- when executing service task implemented through Petals services,
- when terminating process instances.
The principle of the flow instance identifier of MONIT traces is to permit to retrieve all MONIT traces of a given process flow.
When creating a process instance, two flows are running:
- the flow from which the process instance creation request is coming,
- the flow associated to the process instance that will be created.
When completing a user task, two flow are running also:
- the flow from which the user task completion request is coming,
- the flow associate to the process instance for which the user task must be completed.
The service tasks are flow steps of the flow associated to the process instance.
So, we must be able to correlate the flow associated to the process instance with flows associated to interaction requests (process instance creation, user task completion):
|
- on process instance creation, we have the following MONIT traces ordered:
- a MONIT trace associated to the start of the interaction request creating the process instance, with following attributes:
- traceCode set to provideFlowStepBegin,
- flowInstanceId set to an UUID value,
- flowStepId set to an UUID value,
- flowStepInterfaceName set to the interface name of the service creating the process instance,
- flowStepServiceName set to the service name of the service creating the process instance,
- flowStepOperationName set to the operation name of the service creating the process instance,
- flowStepEndpointName set to the endpoint name of the service creating the process instance,
- flowPreviousStepId set to the step identifier of the previous step in the interaction flow.
- a MONIT trace associated to a new flow associated to the process instance, with following attributes:
- traceCode set to consumeFlowStepBegin
- flowInstanceId set to a new UUID value,
- flowStepId set to a new UUID value,
- processDefinitionName set to the process definition of the created process instance,
- processInstanceId set to the identifier of the created process instance
- correlatedFlowInstanceId set to the flow instance identifier of the associated interaction request,
- correlatedFlowStepId set to the flow step identifier of the associated interaction request.
- a MONIT trace associated to the end of the interaction request creating the process instance, with following attributes:
- traceCode set to provideFlowStepEnd or provideFlowStepFailure,
- flowInstanceId set to the flow step identifier of the associated interaction request.
- flowStepId set to the flow step identifier of the associated interaction request.
- a MONIT trace associated to the start of the interaction request creating the process instance, with following attributes:
- on user task completion:
- a MONIT trace associated to the start of the interaction request completing the user task, with following attributes:
- traceCode set to provideFlowStepBegin,
- flowInstanceId set to an UUID value,
- flowStepId set to an UUID value,
- flowStepInterfaceName set to the interface name of the service completing the user task,
- flowStepServiceName set to the service name of the service completing the user task,
- flowStepOperationName set to the operation name of the service completing the user task,
- flowStepEndpointName set to the endpoint name of the service completing the user task,
- flowPreviousStepId set to the step identifier of the previous step in the interaction flow.
- a MONIT trace associated to a new step associated to the user task, with following attributes:
- traceCode set to provideFlowStepBegin,
- flowInstanceId set to the flow instance identifier of the process instance
- flowStepId set to a new UUID value,
- flowStepInterfaceName set to the interface name of the service completing the user task,
- flowStepServiceName set to the service name of the service completing the user task,
- flowStepOperationName set to the operation name of the service completing the user task,
- flowStepEndpointName set to the endpoint name of the service completing the user task,
- flowPreviousStepId set to the flow previous step identifier of the process instance,
- correlatedFlowInstanceId set to the flow instance identifier of the associated interaction request,
- correlatedFlowStepId set to the flow step identifier of the associated interaction request.
- a MONIT trace associated to the end of the interaction request completing the user task, with following attributes:
- traceCode set to provideFlowStepEnd or provideFlowStepFailure,
- flowInstanceId set to the flow step identifier of the associated interaction request.
- flowStepId set to the flow step identifier of the associated interaction request.
- a MONIT trace associated to the start of the interaction request completing the user task, with following attributes:
- on process instance termination:
- a MONIT trace associated to the end of the process instance, with following attributes:
- traceCode set to consumeFlowStepEnd or consumeFlowStepFailure,
- flowInstanceId set to the flow instance identifier of the process instance,
- flowStepId set to the flow step identifier of the process instance creation step.
- a MONIT trace associated to the end of the process instance, with following attributes:
Logging
The traces of the BPMN 2.0 engine "Activiti" are activated through the logging configuration file of Petals ESB. The root logger for Activiti is org.activiti:
... org.activiti.level=INFO org.activiti.engine.impl.level=FINE ...
Monitoring the component
| In this documentation, the term "Allocated threads" must be understood as "Active threads", see PETALSDISTRIB-37. This naming error will be fixed in the next version. |
Using metrics
Several probes providing metrics are included in the component, and are available through the JMX MBean 'org.ow2.petals:type=custom,name=monitoring_<component-id>', where <component-id> is the unique JBI identifier of the component.
Common metrics
The following metrics are provided through the Petals CDK, and are common to all components:
| Metrics, as MBean attribute | Description | Detail of the value | Configurable |
|---|---|---|---|
| MessageExchangeAcceptorThreadPoolMaxSize | The maximum number of threads of the message exchange acceptor thread pool | integer value, since the last startup of the component | yes, through acceptor-pool-size |
| MessageExchangeAcceptorThreadPoolCurrentSize | The current number of threads of the message exchange acceptor thread pool. Should be always equals to MessageExchangeAcceptorThreadPoolMaxSize. | instant integer value | no |
| MessageExchangeProcessorObjectPoolBorrowedObjectsCurrent | The current number of borrowed object of the message exchange processor object pool | instant integer value | no |
| MessageExchangeProcessorObjectPoolBorrowedObjectsMax | The maximum number of object of the message exchange processor object pool that was borrowed | integer value, since the last startup of the component | no |
| MessageExchangeProcessorObjectPoolIdleObjectsCurrent | The current number of idel object of the message exchange processor object pool | instant integer value | no |
| MessageExchangeProcessorObjectPoolIdleObjectsMax | The maximum number of object of the message exchange processor object pool that was idle | integer value, since the last startup of the component | no |
| MessageExchangeProcessorObjectPoolMaxSize | The maximum size, in objects, of the message exchange processor object pool | instant integer value | yes, through processor-max-pool-size |
| MessageExchangeProcessorObjectPoolMinIdleSize | The minimum size, in objects (in state idle), of the message exchange processor object pool | instant integer value | yes, through processor-pool-size |
| MessageExchangeProcessorObjectPoolExhaustion | The number of message exchange processor object pool exhaustions | integer counter value, since the last startup of the component | no |
| MessageExchangeProcessorThreadPoolAllocatedThreadsCurrent | The current number of allocated threads of the message exchange processor thread pool | instant integer value | no |
| MessageExchangeProcessorThreadPoolAllocatedThreadsMax | The maximum number of threads of the message exchange processor thread pool that was allocated | integer value, since the last startup of the component | no |
| MessageExchangeProcessorThreadPoolIdleThreadsCurrent | The current number of idle threads of the message exchange processor thread pool | instant integer value | no |
| MessageExchangeProcessorThreadPoolIdleThreadsMax | The maximum number of threads of the message exchange processor thread pool that was idle | integer value, since the last startup of the component | no |
| MessageExchangeProcessorThreadPoolMaxSize | The maximum size, in threads, of the message exchange processor thread pool | instant integer value | yes, through http-thread-pool-size-max |
| MessageExchangeProcessorThreadPoolMinSize | The minimum size, in threads, of the message exchange processor thread pool | instant integer value | yes, through http-thread-pool-size-min |
| MessageExchangeProcessorThreadPoolQueuedRequestsCurrent | The current number of enqueued requests waiting to be processed by the message exchange processor thread pool | instant integer value | no |
| MessageExchangeProcessorThreadPoolQueuedRequestsMax | The maximum number of enqueued requests waiting to be processed by the message exchange processor thread pool that was allocated since the last startup of the component | instant integer value | no |
| ServiceProviderInvokations | The number of service provider invokations grouped by:
|
integer counter value since the last startup of the component | no |
| ServiceProviderInvokationsResponseTimeAbs | The aggregated response times of the service provider invokations since the last startup of the component grouped by:
|
n-tuple value containing, in millisecond:
|
no |
| ServiceProviderInvokationsResponseTimeRel | The aggregated response times of the service provider invokations on the last sample, grouped by:
|
n-tuple value containing, in millisecond:
|
no |
Dedicated metrics
No dedicated metric is available.
Receiving alerts
Several alerts are notified by the component through notification of the JMX MBean 'org.ow2.petals:type=custom,name=monitoring_<component-id>', where <component-id> is the unique JBI identifier of the component.
| To integrate these alerts with Nagios, see Receiving Petals ESB defects in Nagios. |
Common alerts
| Defect | JMX Notification |
|---|---|
| A message exchange acceptor thread is dead |
|
| No more thread is available in the message exchange acceptor thread pool |
|
| No more message exchange processor is available in the message exchange processor pool |
|
| No more thread is available to run a message exchange processor |
|
Dedicated alerts
No dedicated alert is available.
Unit testing
An extension of JUnit is available:
- to validate your WSDL,
- to test unitary your XSLs.
Validating your WSDL
TODO
Unit-testing your XSD
A framework is available to unit-test the service unit deployed on the SE BPMN2. It provides facilities for:
- check the compliance of the WSDL with the attendees of the component,
- verify easily the XSL used to generate output replies.
Checking the compliance of the WSDL
The unit test framework contains an assertion 'assertIsCompliant' to verify easily the compliance of your WSDL with the attendees of the mode 'service':
import static org.junit.Assert.assertNotNull; import static org.ow2.petals.se.bpmn2.unittest.Assert.assertIsCompliant; import java.io.InputStream; import org.junit.Test; public class WSDLComplianceTest { @Test public void testWSDLCompliance() { final InputStream isWsdl = Thread.currentThread().getContextClassLoader() .getResourceAsStream("myService.wsdl"); assertNotNull("WSDL not found as resource !", isWsdl); assertIsCompliant("WSDL not compliant with SE BPMN2 attendes !", isWsdl); } }
Testing your XSL
TODO
Annex: Sample WSDL
Abstract part:
<?xml version="1.0" encoding="UTF-8"?> <wsdl:definitions xmlns:tns="http://petals.ow2.org/se/bpmn2/sample/order" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" targetNamespace="http://petals.ow2.org/se/bpmn2/sample/order"> <!-- Type definitions for input and output parameters for service --> <wsdl:types> <xs:schema targetNamespace="http://petals.ow2.org/se/bpmn2/sample/order"> <xs:complexType name="ItemType"> <xs:sequence> <xs:element name="reference" type="xs:string" minOccurs="1" maxOccurs="1" /> <xs:element name="quantity" type="xs:int" minOccurs="1" maxOccurs="1" /> </xs:sequence> </xs:complexType> <xs:element name="newOrderRequest"> <xs:complexType> <xs:sequence> <xs:element name="customerName" type="xs:string" minOccurs="1" maxOccurs="1" /> <xs:element name="address" type="xs:string" minOccurs="1" maxOccurs="1" /> <xs:element name="items"> <xs:complexType> <xs:sequence> <xs:element name="item" type="tns:ItemType" maxOccurs="unbounded" /> </xs:sequence> </xs:complexType> </xs:element> </xs:sequence> </xs:complexType> </xs:element> <xs:element name="newOrderResponse"> <xs:complexType> <xs:sequence> <xs:element name="orderId" type="xs:string" minOccurs="1" maxOccurs="1" /> </xs:sequence> </xs:complexType> </xs:element> <xs:element name="validOrderRequest"> <xs:complexType> <xs:sequence> <xs:element name="orderId" type="xs:string" minOccurs="1" maxOccurs="1" /> <xs:element name="validationStepId" type="xs:string" minOccurs="1" maxOccurs="1" /> <xs:element name="isValidated" type="xs:boolean" minOccurs="1" maxOccurs="1" /> <xs:element name="creditCardNumber" type="xs:string" minOccurs="1" maxOccurs="1" /> </xs:sequence> </xs:complexType> </xs:element> <xs:element name="validOrderResponse" type="xs:string" /> <xs:element name="searchOrderRequest"> <xs:complexType> <xs:sequence> <xs:element name="orderId" type="xs:string" minOccurs="0" maxOccurs="1" /> <xs:element name="isInProgress" type="xs:boolean" minOccurs="0" maxOccurs="1" /> <xs:element name="responsibleUser" type="xs:string" minOccurs="0" maxOccurs="1" /> <xs:element name="responsibleGroup" type="xs:string" minOccurs="0" maxOccurs="1" /> </xs:sequence> </xs:complexType> </xs:element> <xs:element name="searchOrderResponse" type="xs:string" /> </xs:schema> <xs:element name="orderUnknownFault"> <xs:complexType> <xs:sequence> <xs:element name="orderId" type="xs:string" minOccurs="0" maxOccurs="1" /> </xs:sequence> </xs:complexType> </xs:element> <xs:element name="orderAlreadyValidated"> <xs:complexType> <xs:sequence> <xs:element name="orderId" type="xs:string" minOccurs="0" maxOccurs="1" /> </xs:sequence> </xs:complexType> </xs:element> </wsdl:types> <!-- Message definitions for input and output --> <wsdl:message name="newOrderRequest"> <wsdl:part name="newOrderRequest" element="tns:newOrderRequest" /> </wsdl:message> <wsdl:message name="newOrderResponse"> <wsdl:part name="newOrderResponse" element="tns:newOrderResponse" /> </wsdl:message> <wsdl:message name="validOrderRequest"> <wsdl:part name="validOrderRequest" element="tns:validOrderRequest" /> </wsdl:message> <wsdl:message name="validOrderResponse"> <wsdl:part name="validOrderResponse" element="tns:validOrderResponse" /> </wsdl:message> <wsdl:message name="searchOrderRequest"> <wsdl:part name="searchOrderRequest" element="tns:validOrderRequest" /> </wsdl:message> <wsdl:message name="searchOrderResponse"> <wsdl:part name="searchOrderResponse" element="tns:searchOrderResponse" /> </wsdl:message> <wsdl:message name="orderUnknown"> <wsdl:part name="orderUnknown" element="tns:orderUnknownFault" /> </wsdl:message> <wsdl:message name="orderAlreadyValidated"> <wsdl:part name="orderAlreadyValidated" element="tns:orderAlreadyValidated" /> </wsdl:message> <!-- Port (interface) definitions --> <wsdl:portType name="Order"> <wsdl:operation name="newOrder"> <wsdl:input message="tns:newOrderRequest" /> <wsdl:output message="tns:newOrderResponse" /> </wsdl:operation> <wsdl:operation name="validOrder"> <wsdl:input message="tns:validOrderRequest" /> <wsdl:output message="tns:validOrderResponse" /> <wsdl:fault message="tns:orderUnknown" name="orderUnknown"/> <wsdl:fault message="tns:orderAlreadyValidated" name="orderAlreadyValidated"/> </wsdl:operation> <wsdl:operation name="searchOrder"> <wsdl:input message="tns:searchOrderRequest" /> <wsdl:output message="tns:searchOrderResponse" /> </wsdl:operation> </wsdl:portType> </wsdl:definitions>
Implementation part
<?xml version="1.0" encoding="UTF-8"?> <wsdl:definitions xmlns:tns="http://petals.ow2.org/se/bpmn2/sample/order" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:bpmn="http://petals.ow2.org/se/bpmn2/1.0" targetNamespace="http://petals.ow2.org/se/bpmn2/sample/order"> <wsdl:import location="OrderAbstract.wsdl" namespace="http://petals.ow2.org/se/bpmn2/sample/order" /> <!-- Port bindings to SE BPMN2 --> <wsdl:binding name="OrderBinding" type="tns:Order"> <wsdl:operation name="newOrder"> <bpmn:operation processDefinitionId="order" action="startEvent" actionId="newOrder"/> <bpmn:userId>/*[local-name()='newOrderRequest']/*[local-name()='userName']</bpmn:userId> <bpmn:variable name="customerName"> /*[local-name()='newOrderRequest']/*[local-name()='customerName'] </bpmn:variable> <bpmn:variable name="address"> /*[local-name()='newOrderRequest']/*[local-name()='address'] </bpmn:variable> <bpmn:output>newOrderOutput.xsl</bpmn:output> <wsdl:input /> <wsdl:output /> </wsdl:operation> <wsdl:operation name="validOrder"> <bpmn:operation processDefinitionId="order" action="userTask" actionId="validOrder"/> <bpmn:processId>/*[local-name()='validOrderRequest']/*[local-name()='orderId']</bpmn:processId> <bpmn:userId>/*[local-name()='validOrderRequest']/*[local-name()='userName']</bpmn:userId> <bpmn:variable name="validationApproved"> /*[local-name()='validOrderRequest']/*[local-name()='isValidated'] </bpmn:variable> <bpmn:variable name="creditCardNumber"> /*[local-name()='validOrderRequest']/*[local-name()='creditCardNumber'] </bpmn:variable> <bpmn:output>validOrderOutput.xsl</bpmn:output> <wsdl:input /> <wsdl:output /> <wsdl:fault name="orderUnknown"> <bpmn:fault name="ProcessInstanceNotFoundException">orderUnknown.xsl</bpmn:fault> <soap:fault name="orderUnknown" use="literal" /> </wsdl:fault> <wsdl:fault name="orderAlreadyValidated"> <bpmn:fault name="TaskCompletedException">orderAlreadyValidated.xsl</bpmn:fault> <soap:fault name="orderAlreadyValidated" use="literal" /> </wsdl:fault> </wsdl:operation> <wsdl:operation name="searchOrder"> <bpmn:operation action="retrieveProcInst" /> <bpmn:input-parameter name="processInstanceId" value="/searchOrderRequest/orderId" /> <bpmn:input-parameter name="isActive" value="/searchOrderRequest/isInProgress" /> <bpmn:input-parameter name="responsibleUser" value="/searchOrderRequest/responsibleUser" /> <bpmn:input-parameter name="responsibleGroup" value="/searchOrderRequest/responsibleGroup" /> <bpmn:output>searchOrderOutput.xsl</bpmn:output> <wsdl:input /> <wsdl:output /> </wsdl:operation> </wsdl:binding> </wsdl:definitions>