Component Implementation
- Introduction
- How to use the business process editor to create a business process component (including path conditions, activities, snippets, etc.)
- How to Suggest transaction boundaries within a business process
- How to create a Business Module
- How to setup a Business Process Invoke activity
- How to generate a business process implementation
- How to add an activity to a Business Process
- How to Configure BPEL activities using the properties view
- How to create a While Loop
- How to add activities inside a While Loop
- How to add a variable (Business Process)
- How to initialize a variable using the Assign Activity
- How to implement an event handler
- How to implement a fault handler
Introduction
Related links | |
implementation human task types escalation people assignment |
How to use the business process editor to create a business process component (including path conditions, activities, snippets, etc.)
-
Business processes in a service-oriented world (IBM WebSphere Developer Technical Journal : A guided tour of WebSphere Integration Developer -- Part 5)
Business Process example
Receive activity
A receive activity is an entry point to a process; it is the point where the process starts or continues.
You need one receive activity per operation you define in the process's interface.
In the process editor, you can specify which operation corresponds to which receive activity. That means that when a call is made to one of the process's operations, the corresponding receive activity accepts the call, and the process continues running from there.
A process requires at least one receive activity to start. A receive activity can also occur in the middle of a business process. In this case, if the process encounters a receive activity while it is running, the process stops and waits for the corresponding operation to be called.
Below, you will find out other capabilities of the business process editor.
Using the Business Process Editor
Here are some of the functions you can do with the business process editor.
How to Suggest transaction boundaries within a business process
-
Process editor server page reference
-
Process editor details page reference
-
Business processes
Business processes execution modes
A business process runs under one of two execution modes:
-
Microflowsrun under a single transaction in a short period of time.
-
Long-running business processesrun in a series of chained transactions over days, months, or even years. Long-running processes can be optimized with respect to transaction boundaries.
Business process developers can declare transaction behavior for invoke, human
task, and snippet activities:
-
Commit beforeguarantees that the activity runs in a new transaction.
-
Commit afterguarantees that the current transaction is committed after executing the activity.
-
Requires ownguarantees that the activity runs in a new transaction and the current transaction is committed after executing the activity.
-
Participatesbehavior states that the activity runs within an existing transaction, if one is available.
Setting up a process as long-running
Transaction boundaries are only applicable to long-running processes containing more than one transaction.
To setup a process as long-running, just check the Process is long-running checkbox.
Setting up Human Task transaction behaviour
Set the transaction behaviour choices on the Properties/Server page.
Setting up Invoke transaction behaviour
Set the transaction behaviour choices on the Properties/Server page.
Setting up Snippet transaction behaviour
Set the transaction behaviour choices on the Properties/Server page.
How to create a Business Module
Right-click in the Business Integration view and select New > Module
Enter a Module Name. Check Use default For Module Location. Click Finish.
A new module is created.
How to setup a Business Process Invoke activity
Completed Invoke activity
1-Add an Invoke activity
Right-click the Reply activity and select Insert Before > Invoke.
2-Display interface list
- Click on the Invoke activity.
- Click on the Properties tab/Details.
- Click Browse... to display the available interfaces
3-Select the Reference Partners Interface
Select the required interface to be invoked and click OK.
4-Setup Variables
- Check Use Data Type Variables.
- Click ... to display a list of variables
5-Select Variable names
- Select Input1 tor input1
- Click OK.
- Repeat for Output1.
6-Done!
How to generate a business process implementation
Generated Business Process implementation
WID generates a basic business process implementation that you can modify as required.
For a one way operation, only the Receive activity will be generated. For a two way operation, both Receive and Reply activities will be generated.
As you can see, the related partners (Interfaces and Reference), interfaces and Variables are defined based on the Assembly diagram, the wiring done, and the interfaces defined for each component.
To generate a business process implementation, do the following steps:
Assembly Diagram
Shipping interface (ShippingProcess component)
Step 1
Generate Business Process implementation
In the Assembly Diagram, right-click the component you want to implement and select Generate Implementation/Process.
Step 2
Select the folder where the Process implementation will be generated and click OK.
How to add an activity to a Business Process
Business Process activities
There are two ways of adding an activity to a business process:
-
Add
-
Insert Before
The following is a list of business process activities:
Add an activity
Right-click in the canvas and select Add > activity...
A new activity will be added and positioned as the last activity.
Insert an activity
Right-click an existing activity and select Insert Before > activity...
A new activity will be added and positioned before the selected (right-clicked) activity.
How to Configure BPEL activities using the properties view
Related links
Configure BPEL activities using the properties view
The properties for each activity are all displayed in the properties area of the process editor. The tabs that appear there depend on the activity or element that you have selected.
- On the canvas, click the activity that you want to modify (i.e. Receive).
- In the properties area, click the tab with the properties you want to modify and make the appropriate changes (i.e Description).
You can also click on the other tabs (i.e Details, Join Bahavior, Correlation, etc) to review/change their propertied. Below are the details of each tab for the Receive activity.
Note:
Different activities have different properties.
Details tab
Join Behaviour tab
Correlation tab
Server tab
Human Task tab
Event Monitor tab
How to create a While Loop
Add a While Loop activity
Use this activity to repeat one or more activities as long as specific conditions are in place.
This is a structured activity in that it contains other activities that are repeated while success criteria that you specify are met. If the condition that leads to the activity evaluates to false, then none of the activities within will be executed. You can specify the success criteria as a condition, or use the condition builder to compose an appropriate course of action.
A While Loop allows you to do something repeatedly until some condition/s occur.
Thus, a While Loop must contain a condition to exit the loop and must contain an activity or a series of activities to make the loop useful.
In the business process editor, right-click on the ShippingTask activity and select Insert Before > While Loop.
A new activity called WhileLoop is added. Rename this activity as required.
Create a New Condition
A While Loop condition enables you to continue doing the loop or to exit from the loop.
In the business process editor:
-
Select the While Loop activity (WhileLoop_UntilShipped)
-
Select Properties/Details
-
Click on Create a New Condition button
Change the default Condition
The default condition generated by WID returns false which will effectively get you out of the loop: None of the activities you define inside the loop will get done.
In general, you must set the condition initially to true so that the activities that you define inside the While Loop will be done at least once. You should then set the condition to false in one or more of your activities to exit the loop as appropriate.
In the Visual Snippet editor:
-
Delete the false snippet
-
Drag the shippingComplete variable to the canvas.
-
Connect the shippingComplete to return snippet.
The modified Condition
Before entering the While Loop, ensure that the shippingComplete variable is of type Boolean and set to true.
To exit the loop, set the variable to false. Do this in one or more of the activities you will be defining inside the loop.
How to add activities inside a While Loop
Add Activities by using Add/Insert Before
You can add activities inside a While Loop by right-clicking inside the While Loop activity and selecting either Add > Activities or Insert Before > activities
Add Activities by dragging existing activities
You can add activities inside a While Loop by dragging existing activities into the While Loop. For example, you can drag ShippingTask and/or NotifyShipped activities into the While Loop.
How to add a variable (Business Process)
Add a Variable
In the Business Process editor, click the Variables V icon .
Rename variable
Rename the new variable (Variable) as required (i.e shippingComplete).
Click the Browse button to find and set the Data Type for the new variable.
Select Data Type
Select the required Data Type and click OK.
Variable added
A new variable, shippingComplete with a Data Type of boolean, has been added.
How to initialize a variable using the Assign Activity
Add an Assign activity
In the business process editor, right-click on the ShippingTask activity and select Insert Before > Assign.
A new activity called Assign is added. Rename this activity as required (i.e Assign_Initialize).
Initialize a variable
Initialize a variable (i.e shippingComplete is a boolean) to false:
-
Select the Assign activity.
-
Select Properties > Details.
-
Select Fixed Value in the From drop-down listbox and assign a value of false.
-
Select Variable > shippingComplete in the To drop-down listbox.
-
Save the project
How to implement an event handler
Related links
Add an Event handler
An event handler can be added to a scope activity only.
In the business process editor, right-click a scope and select Add Event Handler.
OnEvent element details
An event handler is created (i.e OnEvent).
In the Details section, click Browse to find Partner.
Select a Partner
Select the Partner (i.e Shipping) and click OK.
Set Partner details
In the Details section, the Partner and Interface details are automatically populated.
For Operation, click on the drop-down listbox and select an Operation (i.e shipOrder).
Assign work to the event handler
Right-click on the event handler (OnEvent) and select the activity you want to use (i.e java Snippet).
This event will be triggered when the shipOrder operation is called.
How to implement a fault handler
Related links
Fault Handling (Business Process Choreographer Samples)
Add Fault handler
A fault handler can be added to a scope or invoke activity.
In the business process editor, right-click either a scope or invoke activity and select Add Fault Handler.
Catch element details
A fault (i.e ShippingFault) is created.
Set the following Catch element details as follows:
- Select User-defined
- Type ShippingFault for the Fault Name
- Type shippingFault for the Variable Name (Note: shippingFault has been defined as a global variable)
- Select Data Type
- Click Browse button to find Data Type
Select Data Type
Select ShippingFault as the data type and click OK.
Catch element details complete
The Catch element details is complete.
Add Snippet activity
Under the ShippingFault element (Catch), add a snippet acvity and fill in the details as shown.
No comments:
Post a Comment