Skip to main content

Dynamic activity resequencing with WebSphere Business Services Fabric

Benjamin Kaeckenmeister photo
Benjamin Kaeckenmeister is an IT specialist at IBM Boeblingen Lab in Germany. He holds a degree in computer science from the University of Stuttgart. He belongs to the lab services team and provides technical consultancy on WebSphere Business Integration solutions. His expertise includes WebSphere Process Server, WebSphere Integration Developer, and WebSphere Business Services Fabric.

Summary:  This article describes how to use the run time dynamicity in IBM® WebSphere® Business Services Fabric to determine the execution order of activities within a business process. Instead of having a complex business process with a given order of activities, the article presents a solution that offers dynamic, real-time service selection rather than a fixed workflow structure. All necessary modeling and implementation steps — in Business Space and WebSphere Integration Developer — are explained.

Date:  13 May 2009
Level:  Intermediate PDF:  A4 and Letter (415KB | 18 pages)Get Adobe® Reader®
Activity:  835 views

Introduction

WebSphere Business Services Fabric Version V6.2 (hereafter referred to as Business Services Fabric) allows you to select services during run time dynamically, based on business policies. In this article, you exploit this capability to rearrange different activities within a business process dynamically. Instead of having several or one complex business process to cover all possible orders of activities that should be executed consecutively, one simple business process fulfills all requirements. Using a new-hire onboarding scenario, you learn how to model your application from a business perspective and to refine it from a technical point of view. See Downloads for Project Interchange files and sample code.

This article describes the following steps:

  1. Modeling Business Services Fabric artifacts from a business perspective
  2. Implementing the business process and the onboarding activities
  3. Modeling Business Services Fabric artifacts from a technical perspective
  4. Running the scenario

This article assumes that you have a basic knowledge of Business Services Fabric and WebSphere Integration Developer (hereafter referred to as Integration Developer).

Scenario

In our example scenario, an enterprise uses different business processes to handle the assessment and onboarding of new hires. Depending on the employee type — the job candidate might be employed for an internship or a regular job — different steps must be carried out until a candidate is eventually employed. Currently, the enterprise runs different business processes for each employee type and has difficulties adapting its business processes to changing requirements. The following tables outline all onboarding activities for each employee type.


Table 1. Onboarding activities for a regular employee
Step Onboarding activity
1 Enquire Personal Data
2 Internet Search
3 Personal Interview
4 Review Candidate


Table 2. Onboarding activities for a student employee
Step Onboarding activity
1 Enquire Personal Data
3 Telephone Interview

Our scenario demonstrates how to streamline the different onboarding business processes into one simplified business process. The simplified process executes the necessary onboarding activities for each job family and can be adapted during run time without having to remodel and redeploy the business process.

Modeling Fabric artifacts using Business Space

This section describes how to model all necessary elements from a business perspective with the new Business Space widgets in Business Services Fabric. The widgets are shipped with two Business Space templates: Fabric Authoring and Fabric Administration.

Define the business vocabulary

First, open a business space derived from the Fabric Authoring template. On the Getting Started page, click Start working with vocabularies to open the widgets that allow you to create and modify all vocabulary elements. Create a new vocabulary called Onboarding Vocabulary. Add a new channel (Onboarding Channel) and a new role (HR member) to the vocabulary.

Add several business concepts. Business concepts are analogous to business items in WebSphere Business Modeler or business objects in Integration Developer. To be able to use business concepts with business policies for a given business service, they must be associated with a business service. Define the business concept "Onboarding Activity Request" of type Complex Object. This will serve as input for a business service later. This business concept must have relationships of type “has” to all business concepts that are to be used during business policy authoring. Define the business concepts as described in Table 3.


Table 3. Business concepts
Business Concept Type Values
Step Integer
Employee Type Set of Fixed Values Regular, Student
Onboarding Activity Request Complex Object

The relationships of the business concept Onboarding Activity Request are depicted Figure 1.


Figure 1. Relationships for business concept Onboarding Activity Request
Relationships for business concept Onboarding Activity Request

Figure 2 is an overview of all elements created in the vocabulary.


Figure 2. Elements created for the onboarding vocabulary
Elements created for the onboarding vocabulary

Model business services

In the next step, model the business service used in this scenario. On the Getting Started page in the Fabric Authoring business space click Start working with business services. Create a new business service called Onboarding Activity. To use the previously defined vocabulary elements for business policies, specify the business concept Onboarding Activity Request as input for the business service.


Figure 3. Input mapping for business service Onboarding Activity
Input mapping for business service Onboarding Activity

The business service itself is a logical construct. To select among different onboarding activities during run time, create a business service variation for each available onboarding activity (Enquire Personal Data, Internet Search, Personal Interview, Telephone Interview, and Review Candidate). Each business service variation will be implemented as a Service Component Architecture (SCA) component (described later). Figure 4 depicts the business service variations.


Figure 4. Business service variations
Business service variations

Author business policies

Business policies define the decision logic for selecting a business service variation during run time. Add a business policy called "Regular – Step 1" and edit the policy details. Create the When conditions Employee Type is equal to Regular AND Step is equal to 1 (use the logical condition AND for the second condition). In the Then field, specify to select the Enquire Personal Data business service variation.


Figure 5. Selection of a business service variation for the Then clause in a business policy
Selection of a business service variation for the Then clause in a business policy

The "Regular – Step 1" business policy determines which onboarding activity to execute: if the business concept Employee Type is set to Regular and the business concept Step is equal to 1, then the business service variation "Enquire Personal Data" is selected.


Figure 6. Business policy details
Business policy details

Table 4 summarizes all business policies that must be created using the steps above.


Table 4. Business policies
Name When Then
Regular – Step 1 Employee Type is equal  to Regular
AND
Step is equal to 1
Select Enquire Personal Data in Onboarding Activity
Regular – Step 2 Employee Type is equal  to Regular
AND
Step is equal to 2
Select Internet Search in Onboarding Activity
Regular – Step 3 Employee Type is equal  to Regular
AND
Step is equal to 3
Select Personal Interview in Onboarding Activity
Regular – Step 4 Employee Type is equal  to Regular
AND
Step is equal to 4
Select Review Candidate in Onboarding Activity
Student – Step 1 Employee Type is equal  to Student
AND
Step is equal to 1
Select Enquire Personal Data in Onboarding Activity
Student – Step 2 Employee Type is equal  to Student
AND
Step is equal to 2
Select Telephone Interview in Onboarding Activity

Figure 7 depicts the business service details created so far.


Figure 7. Details for the Onboarding Activity business service
Details for the Onboarding Activity business service

Specify high-level application flow

The final step in Business Space is to model the high-level application flow. On the Getting Started page in the Fabric Authoring business space, click Start working with applications. Create a new application called Onboarding Application. Then, edit the application flow and add the channel OnBoarding Channel. This is the channel you created earlier.


Figure 8. Add a new channel
Add a new channel

Next, add the business service Onboarding Activity.


Figure 9. Add a business service
Add a business service

Finally, assign the role HR Member to the business service Onboarding Activity.


Figure 10. Assign a role
Assign a role

The final application flow is shown in Figure 11.


Figure 11. Final application flow
Final application flow

Finally, submit, approve, and publish the change set in the governance page in Business Space.


All business-related modeling for Business Services Fabric is now complete. So far, you created all necessary vocabulary elements, the business service Onboarding Activity, the business policies to define the business logic, and the Onboarding Application with its application flow, which provides a high-level view of the business application.

Implementing the onboarding business process and activities

The implementation is separated into two modules. One module contains the onboarding business process and the Dynamic Assembler SCA component, the second one contains the implementation of the onboarding activities.

Implementation of the onboarding business process

Figure 12 depicts the SCA diagram of the module that contains the onboarding business process.


Figure 12. SCA diagram for the onboarding module
SCA diagram for the onboarding module

The SCA component OnboardingActivityDA is invoked each time the business process invokes an onboarding activity. Depending on the policies defined earlier, the implementation of the selected business service variation is executed.

The business process is very simple; there is no need to have fixed complex branches inside the Business Process Execution Language (BPEL) implementation to determine which onboarding activity should be executed and in what sequence. Inside a loop-until structure, the different onboarding activities are executed dynamically as specified by the business policies. No static sequence of onboarding activities is implemented and one business process covers all different employee types. The loop is executed until the final stop activity is invoked or an onboarding activity returns that the candidate is not approved.


Figure 13. Onboarding BPEL process
Onboarding BPEL process

Implementation of the context extractor

The next step is to implement a context extractor. This component extracts values from the request to the Dynamic Assembler and makes them available for the selection algorithm in Business Services Fabric. In this component, which implements the interface com.ibm.websphere.fabric.da.plugin.ContextExtractor, the fields from the request message (Step and employeeType) are mapped to the business concepts Step and Employee Type. Listing 1 shows the content of the extractContext method. The URIs for the business concepts can be retrieved by clicking on the dimensions of the context specification which will be created later.


Listing 1. Code segment to extract required context from the request


public Context extractContext(PendingRequest pendingRequest)
                                                  throws UnexpectedContentException {

	// URI for business concept "step" – replace it if necessary
	final String URIstep = 
                       "fc://business/intconcept#ud0a27631-c0cf-4396-8b4c-848fd33ff1a2";

	// URI for business concept "employee type" – replace it if necessary
	final String URIemployeeType = 
                       "fc://business/enumconcept#uf2b70289-542d-496e-8b2a-cc5d69c25e26";

		Context ctx = pendingRequest.getContext();

		if (pendingRequest != null
				&& pendingRequest.getFirstBodyElement() != null) {
			int step = pendingRequest.getFirstBodyElement().getInt("step");
			String employeeType = pendingRequest.getFirstBodyElement()
					.getString("employeeType");

			ctx.setSelectionProperty(URIstep, new TypedValue("" + step));
			if (employeeType != null
					&& ("Regular".equals(employeeType) || "Student"
							.equals(employeeType))) {
				ctx.setSelectionProperty(URIemployeeType, new TypedValue(
						employeeType));
			}
		}

		return ctx;
	}


Implementation of the onboarding activities

In addition to the business process, the onboarding activities are implemented in a different module. Each onboarding activity is either implemented as a human task or a Java component as shown in Figure 14.


Figure 14. SCA diagram for the module OnboardingActivities
SCA diagram for the module OnboardingActivities

Modeling Fabric artifacts using Integration Developer

After the business perspective is modeled in Business Space, the Business Services Fabric model must be augmented with implementation details for deployment and execution. Open the Business Service perspective in Integration Developer and create a new Fabric project. Replicate with the Business Service repository and select the project Onboarding Application (this project contains the artifacts that you have created in Business Space). You should see the artifacts depicted in Figure 15.


Figure 15. Imported artifacts created in Business Space
Imported artifacts created in Business Space

Create a new composite service and select Onboarding as the SCA project. This is the project that contains the Dynamic Assembler SCA component.


Figure 16. Create a new composite service
Create a new composite service

On the Business Application tab of the composite service, select Maps to a Business Application Module and assign the business service Onboarding Activity and the channel Onboarding Channel. This maps the elements defined by the business to the corresponding IT implementation, in this case the OnboardingActivityDA SCA component to the business service Onboarding Activity and the OnboardingProcessExport to the channel Onboarding Channel.


Figure 17. Map composite service to business application
Map composite service to business application

Next, add an endpoint for each onboarding activity and specify the properties as shown in Table 5.


Table 5. Endpoints
Name SCA Address Process Variation Assertion (required)
Enquire Personal Data sca://OnboardingActivities/EnquirePersonalDataExport Enquire Personal Data
Internet Search sca://OnboardingActivities/InternetSearchExport Internet Search
Personal Interview sca://OnboardingActivities/PersonalInterviewExport Personal Interview
Review Candidate sca://OnboardingActivities/ReviewCandidateExport Review Candidate
Stop sca://OnboardingActivities/StopExport
Telephone Interview sca://OnboardingActivities/TelephoneInterviewExport Telephone Interview

For the Stop endpoint define a cost of 1000 per transaction. Create a context specification (Onboarding Activity Context) and add the vocabulary dimensions Employee Type and Step (both required). Assign the context specification to the Dynamic Assembler component OnboardingActivityDA. Finally, submit your changes to the Business Service repository.

Now, the Business Services Fabric modeling — business and technical — is completed and you can run the scenario.

Running the scenario

This last section describes the execution of the scenario. Start a business process instance and enter an employee type (Regular or Student). The onboarding business process then executes the different onboarding activities as defined in the business policies. If an onboarding activity is implemented as a human task, complete the human task and make sure to set whether the candidate is approved or not. You can also enter an annotation for each activity. Annotations are collected for the final onboarding business process result. The candidate’s personal information can be edited as well and is passed forward to the next onboarding activity. The onboarding business process eventually returns whether a candidate is approved or not, and a list of annotations from the different onboarding activities.

If you would like to change the order in which the onboarding activities are executed, modify the business policies in Business Space and publish your change set. You don’t have to redeploy your business process to make the changes available. You can also embed new onboarding activities into the scenario without modifying the onboarding business process. To do this, create a new business service variation and corresponding business policies in Business Space, enrich the model with technical artifacts in Integration Developer (add an endpoint and assertions), and implement the new onboarding activity.

Summary

With this scenario you learned how to resequence activities within a business process dynamically with the help of Business Services Fabric. You benefited from the dynamic selection of business services during run time, which allowed you to simplify your business processes and thus add a new level of dynamicity. You learned how to model Business Services Fabric artifacts in Business Space from a business perspective and then enrich this model with implementation details in Integration Developer. You are now able to include Business Services Fabric into your business process solutions and to create flexible and highly dynamic business processes.



Downloads

DescriptionNameSizeDownload method
Project Interchange filesPI-20090115-1904.zip43KB HTTP
Fabric Business GlossaryFabricBusinessGlossary20090115-owl.zip4KB HTTP
Onboarding Activity codeOnboardingActivity20090115-owl.zip9KB HTTP
Onboarding Application codeOnboardingApplication20090115-owl.zip9KB HTTP

Information about download methods


Resources

About the author

Benjamin Kaeckenmeister photo

Benjamin Kaeckenmeister is an IT specialist at IBM Boeblingen Lab in Germany. He holds a degree in computer science from the University of Stuttgart. He belongs to the lab services team and provides technical consultancy on WebSphere Business Integration solutions. His expertise includes WebSphere Process Server, WebSphere Integration Developer, and WebSphere Business Services Fabric.

Comments (Undergoing maintenance)



Trademarks  |  My developerWorks terms and conditions

Help: Update or add to My dW interests

What's this?

This little timesaver lets you update your My developerWorks profile with just one click! The general subject of this content (AIX and UNIX, Information Management, Lotus, Rational, Tivoli, WebSphere, Java, Linux, Open source, SOA and Web services, Web development, or XML) will be added to the interests section of your profile, if it's not there already. You only need to be logged in to My developerWorks.

And what's the point of adding your interests to your profile? That's how you find other users with the same interests as yours, and see what they're reading and contributing to the community. Your interests also help us recommend relevant developerWorks content to you.

View your My developerWorks profile

Return from help

Help: Remove from My dW interests

What's this?

Removing this interest does not alter your profile, but rather removes this piece of content from a list of all content for which you've indicated interest. In a future enhancement to My developerWorks, you'll be able to see a record of that content.

View your My developerWorks profile

Return from help

static.content.url=http://www.ibm.com/developerworks/js/artrating/
SITE_ID=1
Zone=WebSphere
ArticleID=388283
ArticleTitle=Dynamic activity resequencing with WebSphere Business Services Fabric
publish-date=05132009
author1-email=kaeckenmeister@de.ibm.com
author1-email-cc=

My developerWorks community

Tags

Help
Use the search field to find all types of content in My developerWorks with that tag.

Use the slider bar to see more or fewer tags.

Popular tags shows the top tags for this particular content zone (for example, Java technology, Linux, WebSphere).

My tags shows your tags for this particular content zone (for example, Java technology, Linux, WebSphere).

Use the search field to find all types of content in My developerWorks with that tag. Popular tags shows the top tags for this particular content zone (for example, Java technology, Linux, WebSphere). My tags shows your tags for this particular content zone (for example, Java technology, Linux, WebSphere).

Special offers