It is then your responsibility to implement the functionality that captures the triggered EDN events and process them in a way that fits your requirements.
I will cover an example where:
- An OnAssigned event is raised
- Captured by a Mediator in a separate SOA Composite
- BPEL in SOA Composite sends out an email notification.
Lets get started
1. We have a very basic SOA/BPM composite which has 1 BPMN and 1 Human Task component as follows:
2. We want to modify the Human Task component so that it raises EDN Events for specific actions. The below screenshot shows that the Human Task will fire OnAssign and OnCompleted EDN events.
Once you have completed that, there are no further modifications required for the current project. It has been configured so that an EDN event will be raised. The BPM project can be deployed to the SOA Server.
Now we must implement functionality to capture the specific EDN Events.
3. We will capture the EDN events in a new SOA composite. Create a new SOA Project SOAReceiveHumanTaskEvents:
4. In the SOA Composite, drag on a Mediator component. Select Subscribe to Events as the Mediator Template:
5. We must define the definition of the EDN event is captured, click on the Green plus icon:
7. Click OK and select the specific Event you want your Mediator to subscribe to. Considering we want to subscribe to Assign events, choose OnTaskAssigned from the list:
8. Click OK. In the Mediator Template, you can add further Event subscriptions so that your Mediator can subscribe to multiple events. You can then define the routing that takes place by the Mediator when a specific Event is captured. The below screenshot shows that the Mediator also subscribes to OnTaskCompleted events:
9. Once you click OK, your composite will look like this:
10. Now we need to implement a component to which the Mediator will route to once a specific EDN event is captured. We will add a simple BPEL component into the composite. There is a TaskNotification.xsd schema that can also be utilised from MDS for the input/output for the BPEL but for this example, it is not a requirement:
11. Inside the BPEL, drag in an Email component and populate the fields as such:
12. Once your BPEL is complete, close it and return to the Composite view. Now we need to add a wire from the Mediator to the BPEL component. Drag a wire from the Mediator to the BPEL - a dialog is displayed asking for the Operation to be triggered for a specific EDN event caught:
13. Once the Event Mediator has been wired, deploy the Composite to your SOA server so that we can test it.
14. Create a test instance for the BPM Project:
15. Launch the Flow Trace and we can see that an OnTaskAssigned Event was triggered, our SOAReceiveHumanTaskEvents service caught the event and the Mediator routed it to the TaskAssignedBPEL component:
16. To complete the example, the TaskAssignedBPEL sends out an Email Notification:
1. In this example, a separate SOA project was created to capture and process the EDN events. We could have implemented the Mediator to capture events within the BPM project. However, the separation approach increases abstraction, reduces complexity and improves maintainability.
2. Sending an Email at the end of the EDN capture event is just an example, but it shows the capabilities available. We can implement auditing mechanisms for each type of action on a Task or further extend the Notification capabilities available such as Sending an SMS, etc.