Adapter Tutorial - Oracle · Reference: 2005/04/26 Adapter Tutorial Tutorial 10 : MQSeries Queue to...

14
Reference: 2005/04/26 Adapter Tutorial Tutorial 10 : MQSeries Queue to Topic integration using Oracle BPEL PM and Oracle AS Adapter for JMS The Oracle Adapter for JMS provides standards based connectivity to various enterprise messaging software and provides comprehensive support for the JMS specification. This example showcases MQSeries Queue to Topic integration. Tutorial 10 : MQSeries Queue to Topic integration using Oracle BPEL PM and Oracle AS Adapter for JMS ....................................................................... 1 Overview ............................................................................................................................................................. 1 Configuring the MQSeries Queue Consumer Service – PartnerLink ................................................................. 1 Configuring the MQSeries Topic Producer Service............................................................................................ 5 Configuring an end to end BPEL process ........................................................................................................... 7 Deployment and testing of the BPEL process ................................................................................................... 10 Appendix ........................................................................................................................................................... 12 MQSeries Topic Setup ...................................................................................................................................... 12 Overview The Oracle AS Adapter for JMS is part of the Oracle BPEL Process Manager install and is a JCA 1.5 Resource Adapter. The Adapter Framework (AF) is used for the bidirectional integration of the JCA 1.5 resource adapters with BPEL Process Manager. Adapter FW is based on open standards and employs the Web Service Invocation Framework (WSIF) technology for exposing the underlying JCA Interactions as Web Services. This example showcases the following: (1) a MQSeries Queue Consumer dequeing the message from a MQSeries queue and triggering the BPEL process. The message payload is of type “Text” and is defined by a XSD (2) A MQSeries Topic Producer enqueuing the message to a MQSeries Topic based on the invoke BPEL message. Configuring the MQSeries Queue Consumer Service – PartnerLink The Oracle Adapters have an easy-to-use Adapter Wizard that is supported on both JDeveloper and Eclipse platforms. This example showcases the steps for the JDeveloper IDE and is pretty much the same for the Eclipse IDE as well. 1. Launch JDeveloper. This is bundled with the BPEL Process Manager product.

Transcript of Adapter Tutorial - Oracle · Reference: 2005/04/26 Adapter Tutorial Tutorial 10 : MQSeries Queue to...

Reference: 2005/04/26

Adapter Tutorial

Tutorial 10 : MQSeries Queue to Topic integration using Oracle BPEL PM and Oracle AS Adapter for JMS The Oracle Adapter for JMS provides standards based connectivity to various enterprise messaging software and provides comprehensive support for the JMS specification. This example showcases MQSeries Queue to Topic integration.

Tutorial 10 : MQSeries Queue to Topic integration using Oracle BPEL PM and Oracle AS Adapter for JMS .......................................................................1

Overview .............................................................................................................................................................1 Configuring the MQSeries Queue Consumer Service – PartnerLink .................................................................1 Configuring the MQSeries Topic Producer Service............................................................................................5 Configuring an end to end BPEL process ...........................................................................................................7 Deployment and testing of the BPEL process...................................................................................................10 Appendix ...........................................................................................................................................................12 MQSeries Topic Setup ......................................................................................................................................12

Overview The Oracle AS Adapter for JMS is part of the Oracle BPEL Process Manager install and is a JCA 1.5 Resource Adapter. The Adapter Framework (AF) is used for the bidirectional integration of the JCA 1.5 resource adapters with BPEL Process Manager. Adapter FW is based on open standards and employs the Web Service Invocation Framework (WSIF) technology for exposing the underlying JCA Interactions as Web Services. This example showcases the following:

(1) a MQSeries Queue Consumer dequeing the message from a MQSeries queue and triggering the BPEL process. The message payload is of type “Text” and is defined by a XSD

(2) A MQSeries Topic Producer enqueuing the message to a MQSeries Topic based on the invoke BPEL message.

Configuring the MQSeries Queue Consumer Service – PartnerLink The Oracle Adapters have an easy-to-use Adapter Wizard that is supported on both JDeveloper and Eclipse platforms. This example showcases the steps for the JDeveloper IDE and is pretty much the same for the Eclipse IDE as well.

1. Launch JDeveloper. This is bundled with the BPEL Process Manager product.

2. Drag & drop an empty BPEL project 3. Drag & drop a Partner Link activity. 4. Select the Adapter Wizard (no 3) option. 5. Select the JMS Adapter option 6. Follow the Adapter wizard screens as shown in the below figures: 7. Name the Adapter Service

8. Specify the JNDI name for the run-time connection.

9. Select the “ConsumeMessage” option in the next screen

10. Enter the MQSeries parameters as shown below. The Destination Name refers to the MQSeries Queue Name. The targetClient=0 is used indicates that the JMS Header will be part of the message. You have to specify the targetClient value of “1” if you want the JMS Headers to be truncated from the message. The JMS Adapter supports Text and Byte messages. This example uses the Text Message format.

11. The Adapter payload (Text or Byte) can be pointed to a delimited, fixed-positional, Cobol copy book data or an XSD schema. This example uses an XSD schema.

12. This completes the configuration of the MQSeries Consumer Service

13. Complete the Partner Link as shown below:

Configuring the MQSeries Topic Producer Service

14. Drag & drop a Partner Link activity & name the Adapter Service.

15. Specify the JNDI name of the run-time connection

16. Select the “Produce_Message” option.

17. Enter the parameters for the MQSeries Topic Producer. The Destination Name refers to the Topic for enqueuing the messages. The Message Type is “Text”. The Delivery Mode, Priority and TimeToLive are set to defaults. Please refer to the JMS Adapter User Guide for further information on these parameters.

18. Specify the schema for the incoming Text Message.

19. This completes the creation of the MQSeries producer service

20. Complete the configuration of MQSeries Producer Service as shown in the below figure.

Configuring an end to end BPEL process

21. Configure a receive activity to point to the MQSeries Consumer Service

22. Select “create Instance” option and create a global variable (“InputVariable” in this example) to receive the incoming message from the MQSeries Consumer.

23. Drag & drop an invoke activity and point to the MQSeries Topic Producer Partner Link

24. Drag & drop an assign activity to set the MQSeries Header and Payload message for the MQSeries Producer.

25. The end to end BPEL process looks like the following:

Deployment and testing of the BPEL process

26. Set the OC4J-ra.xml of the Oracle AS Adapter for JMS to point to the MQSeries Queue run-time connection parameters as shown in the following figure.

<connector-factory location="eis/mqseries/Queue" connector-name="Jms Adapter">

<config-property name="connectionFactoryLocation" value="com.ibm.mq.jms.MQQueueConnectionFactory"/> <config-property name="factoryProperties" value="QueueManager=MS_BPEL_Queue_Mgr;

TransportType=1;HostName=127.0.0.1;Port=1414; Channel=MS_BPEL_Channel"/>

<config-property name="acknowledgeMode" value="AUTO_ACKNOWLEDGE"/> <config-property name="isTopic" value="false"/> <config-property name="isTransacted" value="true"/> <config-property name="username" value="MUSR_MQADMIN"/> <config-property name="password" value="welcome"/> </connector-factory>

27. Set the OC4J-ra.xml of the Oracle AS Adapter for JMS to point to the MQSeries Topic run-time

connection parameters as shown in the following figure. <connector-factory location="eis/mqseries/Topic" connector-name="Jms Adapter"> <config-property name="connectionFactoryLocation" value="com.ibm.mq.jms.MQTopicConnectionFactory"/> <config-property name="factoryProperties" value="QueueManager=MS_BPEL_Queue_Mgr;

BrokerQueueManager=MS_BPEL_Queue_Mgr; TransportType=1;HostName=127.0.0.1;Port=1414; Channel=MS_BPEL_Channel"/>

<config-property name="acknowledgeMode" value="AUTO_ACKNOWLEDGE"/> <config-property name="isTopic" value="true"/> <config-property name="isTransacted" value="true"/> <config-property name="username" value="MUSR_MQADMIN"/> <config-property name="password" value="welcome"/> </connector-factory>

28. Deploy the BPEL process and Restart the BPEL server. 29. Test the BPEL process by doing a put operation in the MQSeries Queue 30. Use the Websphere MQ Explorer (MQSeries management & monitoring tool) to put messages into the

Source_Queue and to check messages created in the Destination_queue.

31. The successful flow is shown in the below figure.

Appendix

MQSeries Topic Setup 1. Download and install MQSeries. The evaluation installable can be found at http://www14.software.ibm.com/webapp/download/product.jsp?s=p&id=TDUN-49EVER&dt=TRIAL&v=5.3 Please use the default directory for installation of the product. 2. Configure the JMSAdmin.config file .This file can be found at the following location.

"<Drive>:\Program Files\IBM\Source\WebSphere MQ t_en_us\MSI\Program Files\IBM\WebSphere MQ\Java\bin" Edit the following entries : INITIAL_CONTEXT_FACTORY=com.sun.jndi.fscontext.RefFSContextFactory PROVIDER_URL=file://localhost/D:/JNDIBindings The provider URL is the place where the JNDI context is created for MQSeries Topics.You have to explicitly create the directory D:/JNDIBindings. The drive can be any drive (A-Z). The directory name can be anything. SECURITY_AUTHENTICATION=none 3. You need to apply the latest fix packs for WebSphere MQ V5.3 (such as Fix Pack 8, CSD08) include MA0C to use the Publish/Subscribe functionality of MQSeries. This patch can be downloaded at the following location and gets installed under Program Files/IBM directory.

http://www-1.ibm.com/support/docview.wss?rs=203&uid=swg24000643&loc=en_US&cs=utf-8&lang=en

1. Please make sure that the jar files under the following directory are included in the CLASSPATH <Drive>:\Program Files\IBM\Source\WebSphere MQ t_en_us\MSI\Program Files\IBM\WebSphere MQ\Java\lib

5. You need to run the following script to create the queues required for MQSeries Topic setup. <Drive>:\Program Files\IBM\Source\WebSphere MQ t_en_us\MSI\Program Files\IBM\WebSphere MQ\Java\bin> runmqsc QMGR < MQJMS_PSQ.mqsc

1. Run JMSAdmin and the following set of commands to create a TopicConnectionFactory (SampleTCF) and Topic (testTopic). The JNDI name for the testTopic is /test/demo/testTopic.

<Drive>:\Program Files\IBM\Source\WebSphere MQ t_en_us\MSI\Program Files\IBM\WebSphere MQ\Java\bin>JMSAdmin InitCtx>def tcf(SampleTCF) qmgr(QMGR) InitCtx> def ctx(test) InitCtx> chg ctx(test) InitCtx/test> def ctx(demo) InitCtx/test> chg ctx(demo) InitCtx/test/demo> def t(DemoTopic) topic(testTopic) InitCtx/test/demo> display ctx Contents of InitCtx/test/demo .bindings java.io.File a DemoTopic com.ibm.mq.jms.MQTopic 2 Object(s) 0 Context(s)

. Make sure the queue manager's publish/subscribe broker is running. To check, run the dspmqbrk command. <Drive>:\Program Files\IBM\Source\WebSphere MQ t_en_us\MSI\Program Files\IBM\WebSphere MQ\Java\bin> dspmqbrk -m <QMGR>

The following exception is obtained if the publish/subscribe broker queue manager is not running: MQSeries Publish/Subscribe broker for queue manager <QMGR> not active

8. To start it, run the command strmqbrk as shown below: <Drive>:\Program Files\IBM\Source\WebSphere MQ t_en_us\MSI\Program Files\IBM\WebSphere MQ\Java\bin> strmqbrk -m <QMGR>

The following output is obtained after successful start of the broker queue manager: MQSeries Publish/Subscribe broker started for queue manager <QMGR>.

You need to run the following command for stopping the broker queue manager. <Drive>:\Program Files\IBM\Source\WebSphere MQ t_en_us\MSI\Program Files\IBM\WebSphere MQ\Java\bin> endmqbrk -m <QMGR>

The following output is obtained after successful start of the broker queue manager: MQSeries Publish/Subscribe broker started for queue manager <QMGR>.

You need to run the following command for stopping the broker queue manager. <Drive>:\Program Files\IBM\Source\WebSphere MQ t_en_us\MSI\Program Files\IBM\WebSphere MQ\Java\bin> endmqbrk -m <QMGR>

9. Create a channel using the MQSeries Explorer of type "Server Connection".