Since BPS is based on Axis2, All axis2 transports are available for BPEL published services as well. I will describe the steps required to consume a message from a JMS queue to complete a BPEL process.
We will use ActiveMQ for this sample.
Following is the step wise guide to do it.
Step 1.
Download and extract Apache ActiveMQ 5.6.
Step 2.
Download Extract WSO2 BPS 3.2.0
Step 3.
<transportReceiver name="jms" class="org.apache.axis2.transport.jms.JMSListener">
<parameter name="myTopicConnectionFactory">
<parameter name="java.naming.factory.initial">org.apache.activemq.jndi.ActiveMQInitialContextFactory</parameter>
<parameter name="java.naming.provider.url">tcp://localhost:61616</parameter>
<parameter name="transport.jms.ConnectionFactoryJNDIName">TopicConnectionFactory</parameter>
</parameter>
<parameter name="myQueueConnectionFactory">
<parameter name="java.naming.factory.initial">org.apache.activemq.jndi.ActiveMQInitialContextFactory</parameter>
<parameter name="java.naming.provider.url">tcp://localhost:61616</parameter>
<parameter name="transport.jms.ConnectionFactoryJNDIName">QueueConnectionFactory</parameter>
</parameter>
<parameter name="default">
<parameter name="java.naming.factory.initial">org.apache.activemq.jndi.ActiveMQInitialContextFactory</parameter>
<parameter name="java.naming.provider.url">tcp://localhost:61616</parameter>
<parameter name="transport.jms.ConnectionFactoryJNDIName">QueueConnectionFactory</parameter>
</parameter>
</transportReceiver>
Copy following jar files from activemq lib directory to/repository/components/lib directory.
activemq-core-5.6.0.jar
geronimo-j2ee-management_1.1_spec-1.0.1.jar
geronimo-jms_1.1_spec-1.1.1.jar
Step 5.
Start active mq from console
Step 6.
Start BPS from console.
wso2bps-3.2.0/bin $ sh wso2server.sh
We will use ActiveMQ for this sample.
Following is the step wise guide to do it.
Step 1.
Download and extract Apache ActiveMQ 5.6.
Step 2.
Download Extract WSO2 BPS 3.2.0
Step 3.
un comment the TransportReceiver and TransportSender sections of axis2.xml corresponding to ActiveMQ. You can find axis2.xml located at /repository/conf/axis2 directory.
<transportReceiver name="jms" class="org.apache.axis2.transport.jms.JMSListener">
<parameter name="myTopicConnectionFactory">
<parameter name="java.naming.factory.initial">org.apache.activemq.jndi.ActiveMQInitialContextFactory</parameter>
<parameter name="java.naming.provider.url">tcp://localhost:61616</parameter>
<parameter name="transport.jms.ConnectionFactoryJNDIName">TopicConnectionFactory</parameter>
</parameter>
<parameter name="myQueueConnectionFactory">
<parameter name="java.naming.factory.initial">org.apache.activemq.jndi.ActiveMQInitialContextFactory</parameter>
<parameter name="java.naming.provider.url">tcp://localhost:61616</parameter>
<parameter name="transport.jms.ConnectionFactoryJNDIName">QueueConnectionFactory</parameter>
</parameter>
<parameter name="default">
<parameter name="java.naming.factory.initial">org.apache.activemq.jndi.ActiveMQInitialContextFactory</parameter>
<parameter name="java.naming.provider.url">tcp://localhost:61616</parameter>
<parameter name="transport.jms.ConnectionFactoryJNDIName">QueueConnectionFactory</parameter>
</parameter>
</transportReceiver>
<transportReceiver name="jms" class="org.apache.axis2.transport.jms.JMSListener">
Step 4.
Copy following jar files from activemq lib directory to
activemq-core-5.6.0.jar
geronimo-j2ee-management_1.1_spec-1.0.1.jar
geronimo-jms_1.1_spec-1.1.1.jar
Step 5.
Start active mq from console
apache-activemq-5.6.0/bin $ ./activemq console
Use management console of ActiveMQ to view the queues and topics. ActiveMQ management console is available at http://0.0.0.0:8161/admin
Step 6.
Start BPS from console.
wso2bps-3.2.0/bin $ sh wso2server.sh
From the management console , deploy the HelloWorld2.zip file that is available in the repository/samples/bpel directory of BPS.
From the services list view, select the HelloWorld service.
As you can see, the jms endpoint is also available for the newly deployed process.
Step 7.
Now go to ActiveMQ management console and go to queues section. You will find that there is a queue named HelloService.
Use the send to section to add a message to the HelloService. You can generate the sample message for the HelloService wsdl using soap ui.
Use the send button to send the message.
Step 8.
Go to bps management console instance view and see there is a completed process instance. What happened is that when we started the bpel process, HelloService listens on the jms queue. When a message becomes available , it is consumed by the service which results in bpel processes running to completion.
No comments:
Post a Comment