As you can see from the "Order Process" below, Oracle BPM provides us with a variety of start events such as the "None Start" event, the "Message Start" event, the "Timer Start" event and the "Signal Start" event.
Order Process |
The "None Start" event is the default start event in a manual process and it is used in conjunction with a user task defined with the initiator pattern to manually start a process.
The "Message Start" event, which is the default start event in a default process, asynchronous process and synchronous process triggers a process based on message sent by either a BPMN or BPEL process or a service.
The "Timer Start" event will instantiate a process based on a specific time condition, for example, trigger a process on a specific date at a specific time or trigger a process at e recurring interval.
The "Signal Start" event, just like the "Message Start" event, will trigger a process based on a message. The difference is that the "Message Start" event will respond to a specific message sent to a specific process (it's a one-to-one relation) while the "Signal Start" response will respond to a signal that has been broadcasted to multiple process. So with a "Signal Start" event you can trigger multiple processes at the same time using the same message.
Let's see all this in practice.
Create the basic BPM application and BPM project (named both application and project "StartEventsDemo") and select "Composite with BPMN Process" in step 3.
In the "BPMN 2.0 Process Wizard" specify a process name, for example OrderProcess and select "Manual Service" as the service type and click "Finish" (for the purpose of this demo you don't need to create any input or output arguments).
Let's first create the "Message Start" event. Drop the "Message Start" event onto the default "Role" swimlane just below the "None Start" event. This will pop up the "Properties" window of the "Message Start" event component. Optionally update the default name given (I updated it to "Initiate Order Process using Message Start Event") and in the "Implementation" tab select "Define Interface" in the "Type" and click "OK".
The "Message Start" event is created onto your process canvas, however, it's showing an error. This is because it doesn't have an outgoing default sequence flow. Create an outgoing default sequence flow connecting the "Message Start" event to the "None End" event.
You should also notice a warning on the user task. This is because it doesn't have an implementation defined. Before we go on with the next event, let's implement the user task. Go to the user task properties and from the implementation tab click on the "Add" button to create a new human task.
In the "Create Human Task" window just leave the defaults and click "OK" (just for demo purposes. In reality you will have to define a proper definition).
Next let's define a "Timer Start" event to trigger our Order process based on a specific time condition. Drop a "Timer Start" event just below the "Message Start" event. This will dispaly the "Properties" window of the "Timer Start" event component. Optionally update the default name given (I updated it to "Initiate Order Process using Timer Start Event") and in the "Implementation" tab select the appropriate timer definition.
There are three timer definition types. You can use the "Time Cycle" type to configure the "Timer Start" event to use an interval (fire multiple times). You can use "Time Date" to configure the "Timer Start" event to fire on a specific date and time or you can use "Time Schedule" to configure the "Timer Start" event to run periodically (daily, weekly or monthly).
For the purpose of this demo I have selected the "Time Cycle" timer definition type and picked an appropriate date and time to trigger my Order process.
The "Timer Start" event is missing an outgoing default sequence flow, so create one connecting the "Timer Start" event to the "None End" event.
We are left with the last start event, the "Signal Start" event which can be used to trigger a process based on a message broadcasted to multiple processes. Before we go on with creating the "Signal Start" event, we need to mock a service that will broadcast such events.
The easiest way to do that is via a mediator component. So drop a mediator onto the composite canvas and in the "Create Mediator" window give your mediator a name and select the "Synchronous Interface" template.
Edit the mediator component and create a new routing rule and in the "Target Type" select "Publish Event".
In the "Published Events" window click on the green plus icon to create a new event and in the "Event Chooser" window click on the green plus icon to create a new event definition file. This will bring up the "Create Event Definition" window where you can specify your event definition file and attach one or more events to your event definition file. For demo purposes I just created an event called "OrderEvent" with it's type set to a simple string.
If you inspect your project files you should notice that a new "edl" file has been created under the events folder.
Now we are ready to create the "Signal Start" event. So drop a "Signal Start" event just below the "Timer Start" event. In the "Properties" window give your "Signal Start" event a meaningful name and in the "Implementation" tab select the browse icon to select the order event that will be broadcasted by the mediator component.
Wire the "Signal Start" event to the "None End" event and deploy your process. We are now ready to test our Order process. SO our Order process has various ways to get triggered. Let's start first with the "None Start" event and the manual initiation.
Go to the BPM worspace and from the applications click on the OrderProcess link to initiate the process (if you can't see your process under the "Applications" it means that you didn't map your current logged in user to the process default role). Don't worry if you get a warning that the process initiation task has no payload. If you go to the flow instances and inspect your instance you should notice that it used the "None Start" event to trigger the process.
Now let's try to initiate a process via the Enterprise Manager (make sure you use the "OrderProcess.service" service). If you have a look at your process instance you should see that this time it used to the "Message Start" event to initiate the process.
Inspecting my flow instances I noticed that there was an process instance that I didn't explicitly trigger. If you inspect the instance details you should notice that this instance was triggered by the "Timer Start" event.
To test the "Signal Start" event we will have to broadcast a signal. To do that you need to invoke the "
BroadcastEvent_ep" order process service from EM. This will publish an order event on EDN. Since our order process has been configured with a "Signal Start" event that subscribes to order events it will get triggered.Download sample application: Start Events