Business Process Execution Language (BPEL) is a XML-based language used to define enterprise business processes within Web services. BPEL extends the Web services interaction model and enables it to support business transactions.
BPEL can be developed to perform multiple activities such as invoking a web service, publishing a message to topic, subscribe for messages from topic, posting message into queue and consuming messages from queue. Below are the steps to publish messages to Topic and consume messages from Topic.
WebSphere Application Server Configurations:
Create Topic Space
- Click on “Buses” under “Service Integration” section in left panel. Then click on “BPM.ProcessServer.Bus”
- Click on “Destinations” under “Destination resources” section
- Click on “New” and select “Topic Space”
- Specify the identifier for Topic Space
- Navigate to next pages and click on Finish and Save configuration
- Select “Topic” in left panel which is under “Resources->JMS”. Click on “New” button.
- Enter details such as Name, JNDI, Topic name, Bus name, Topic Space, JMS Delivery mode.
- Click on “Ok” and save configuration
Create Topic Connection Factory (Required for Publish):
- Click on “Topic connection factories” under “Resources->JMS” in left panel. Click on “New” button.
- Select “Default messaging provider” option
- Specify details such as Name, JNDI, Bus Name and other relevant details
- Click on Ok and Save Configuration
Create Activation Specifications (Required for Subscription)
- Click on “New” button
- Select the option “Default messaging provider”
- Enter details such as Name, JNDI, Destination Type, Topic’s JNDI, Bus details, Subscription Durability and other necessary information.
- Click on OK and Save Configuration
JMS Publish in BPM Assembly Diagram:
- Create a JMS import
- Specify the interface details for the JMS import
- Mention details such as JMS Messaging domain, connection factory, send destination and receive destination. These details can be selected from the server instance.
- Choose respective items by clicking on Select button and choose the relevant JNDI
- Select Connection Factory from server instance.
2. Select Send Destination from server instance.
3. Select Receive Destination from server instance.
- Select JAAS Alias for J2C Authentication Data Entry. Click on Finish in both the popup windows. This steps will complete the creation of JMS import and this will enable the “EmployeeRequest” BPEL to publish messages into the Topic.
- Publish to Topic:
In process implementation, use invoke activity to publish messages to Topic. Note the Log Entry, employee ID has been printed here. Implementation of process can be done as per business requirement.
JMS Subscribe in BPM Assembly Diagram:
- Create a JMS Export in Assembly Diagram.
- Specify JMS Messaging Domain, Activation Specification, Receive Destination, Send Destination, J2C Authentication Data Entry and click on OK
- Subscribe From Topic:
In process implementation, note the Log Entry activity, employee ID of the message received from Topic has been printed. This process will keep receiving the messages from Topic as soon as messages are published to Topic by the other process. Implementation of process can be done as per business requirement.
Testing Publish-Subscribe using Test Client:
- Using test client of the process that publishes messages to topic, employee ID has been given as 3603566 and message has been published to Topic.
- Message has been published to topic and also consumed by subscriber process. Please note the System Out which were made in Log Entry of Publish and Subscribe BPELs.