Oracle Middleware and IBM MQ Series - Use case: JMS Adapter and MQ main

Oracle Middleware and IBM MQ Series – Use case: JMS Adapter and MQ

Series

This is the third post in a series on using Oracle Middleware with IBM MQ Series. In this series, the following articles are available:

  1. IBM MQ Series Installation and Configuration
  2. Configuration of JMS and MQ Adapters in WebLogic
  3. Use case: JMS Adapter and MQ
  4. Use case: MQ Adapter
  5. Use case: MQ Transport

 

JMS Adapter and MQ

This blog covers the exchange of JMS messages over MQ, using the JMS adapter in both BPEL and Service Bus.

 

1. Overview

 

This blog is structured in the following way:

1. use case description
2. prepare the file system
3. Service Bus produces msg with JMS Adapter
4. BPEL consumes msg with JMS Adapter
5. BPEL produces msg with JMS Adapter
6. Service Bus consumes msg with JMS Adapter
7. Testing the use case

The projects can be downloaded here.
 

2. Use case description

The use case covers the usage of the JMS adapter by both SB and BPEL, for both receiving and sending messages. The following 2 situations are covered:

1. SB puts a msg on a JMS queue, BPEL consumes a msg from the JMS queue

  • a file is put in directory …/usecase/jmsadapter/osb/in
  • the SB service picks up the file with the file adapter
  • the SB service puts the file on queue JMS_MSG_REQUEST_Q with the JMS adapter
  • the BPEL process picks up the msg from queue JMS_MSG_REQUEST_Q with the JMS adapter
  • the BPEL process puts the message in directory …/usecase/jmsadapter/bpel/out

 

mq_300_jmsadapter_request

 

2. BPEL puts a msg on a JMS queue, SB consumes a msg from the JMS queue

  • a file is put in directory …/usecase/jmsadapter/bpel/in
  • the BPEL process picks up the file with the file adapter
  • the BPEL process puts the file on queue JMS_MSG_REPLY_Q with the JMS adapter
  • the SB service picks up the msg from queue JMS_MSG_REPLY_Q with the JMS adapter
  • the SB service puts the message in directory …/usecase/jmsadapter/osb/out

 

mq_300_jmsadapter_reply

 

In order to complete this use case, the File Adapter is used. The File Adapter is used in 4 different situations, but not described as that is not the focus of this article.
If you want to know more about the complete projects that are used, you can download the sources here.

 

3. Prepare the file system

Some test directories for the File Adapter need to be created:

[developer@localhost ~]$ pwd<br>/home/developer<br>[developer@localhost ~]$ mkdir usecase<br>[developer@localhost ~]$ mkdir usecase/jmsadapter<br>[developer@localhost ~]$ mkdir usecase/jmsadapter/osb<br>[developer@localhost ~]$ mkdir usecase/jmsadapter/osb/in<br>[developer@localhost ~]$ mkdir usecase/jmsadapter/osb/out<br>[developer@localhost ~]$ mkdir usecase/jmsadapter/bpel<br>[developer@localhost ~]$ mkdir usecase/jmsadapter/bpel/in<br>[developer@localhost ~]$ mkdir usecase/jmsadapter/bpel/out

 

4. Service Bus produces msg with JMS Adapter

Starting point is a service bus project with a File Adapter that picks up a message from the directory /home/developer/usecase/jmsadapter/osb/in.

 

mq_301_FileToJms_SB-FileAdapter

 

Now, insert an JMS Adapter

mq_302_FileToJms_SB-insert-jms-adapter

 

Give JMS Adapter the name ‘JmsOut’

mq_303_FileToJms_SB-jms-adapter-01

 

Select JMS Provider ‘Third Party’

mq_304_FileToJms_SB-jms-adapter-02

 

For the JMS Connection JNDI Name, browse on your server to find ‘eis/jms/AMIS’

mq_305_FileToJms_SB-jms-adapter-03

 

In the Adapter Interface, check button ‘Define from operation and schema (specified later)’

mq_306_FileToJms_SB-jms-adapter-04

 

Set the Operation Type to ‘Produce Message’

mq_307_FileToJms_SB-jms-adapter-05

 

In the ‘Produce Operation Parameters’ page, enter the Destination Name ‘JMS_MSG_REQUEST_Q’

mq_308_FileToJms_SB-jms-adapter-06

 

For the Message Schema, select ‘Native format translation is not required (Schema is Opaque)’

mq_309_FileToJms_SB-jms-adapter-07

 

Click on Finish in the last wizard screen:

mq_310_FileToJms_SB-jms-adapter-08

 

The Service Bus screen now shows the adapter:

mq_311_FileToJms_SB-jms-adapter-completed

 

Now, connect the Pipeline ‘FileToJms’ to the JMS Adapter ‘JmsOut’:

 

mq_312_FileToJms_SB-jms-adapter-connected

To get it to work, there is still one thing to do in the FileToJms pipeline. By default, in the Routing the Operation is set to ‘Use inbound operation for outbound’. That needs to be changed to ‘Produce_Message’, i.e. the operation of the JMS Adapter.

mq_312_FileToJms_SB-jms-adapter-set-operation

 

Now, the project can be deployed.

 

5. BPEL consumes msg with JMS Adapter

 

Starting point is an empty BPEL process with a File Adapter that writes a file to the directory /home/developer/usecase/jmsadapter/bpel/out:

mq_350_JmsToFile_BPEL_composite

and

mq_351_JmsToFile_BPEL_bpel

 

Now the JMS Adapter will be added:

mq_352_JmsToFile_BPEL_insert-jms-adapter

 

Give JMS Adapter the name ‘JmsIn’

mq_353_JmsToFile_BPEL_jms-adapter-01

 

Select JMS Provider ‘Third Party’

mq_354_JmsToFile_BPEL_jms-adapter-02

 

For the JMS Connection JNDI Name, browse on your server to find ‘eis/jms/AMIS’

mq_355_JmsToFile_BPEL_jms-adapter-03

 

In the Adapter Interface, check button ‘Define from operation and schema (specified later)’

mq_356_JmsToFile_BPEL_jms-adapter-04

 

Set the Operation Type to ‘Consume Message’

mq_357_JmsToFile_BPEL_jms-adapter-05

 

In the ‘Consume Operation Parameters’ page, enter the Destination Name ‘JMS_MSG_REQUEST_Q’

mq_358_JmsToFile_BPEL_jms-adapter-06

 

For the Message Schema, select ‘Native format translation is not required (Schema is Opaque)’

mq_359_JmsToFile_BPEL_jms-adapter-07

 

Click on Finish in the last wizard screen:

mq_360_JmsToFile_BPEL_jms-adapter-08

 

The composite screen now shows the JMS Adapter:

mq_361_JmsToFile_BPEL_composite

 

Now, the JMS Adapter must be connected to the BPEL process. Set Delivery ot ‘Sync’ and set Transaction to ‘notSupported’:

mq_362_JmsToFile_BPEL_composite-connecting

 

Complete the BPEL process in the following steps:

  • adding a Receive from JmsIn that initiates the process (‘Create Instance’)
  • add an invoke of FileOut
  • add an Assign that maps the opaque payload received from JmsIn to the opaque payload of the invoked FileOut

 

mq_363_JmsToFile_BPEL_BPEL

 

The project can now be deployed to the SOA Server.

 

6. BPEL produces msg with JMS Adapter

 

Here, a BPEL process reads a file with the File Adapter from directory /home/developer/usecase/jmsadapter/bpel/in. Then, it uses the JMS Adapter to put the read file on the queue JMS_MSG_REPLY_Q. Shown in the figure below:

mq_370_FileToJms_BPEL_composite

 

The File Adapter configuration is not described.

The JMS Adapter configuration is quite similar to the description in the section ‘BPEL consumes msg with JMS Adapter’, The list below indicates what has to be entered on the Wizard pages and where it is (not) different from the earlier given usage of JMS Adapter

  • Reference name: JmsOut (different from previous section)
  • JMS Provider: ‘Third Party’ (same as previous section)
  • JMS Connection JNDI Name: eis/jms/AMIS (same as previous section)
  • Adapter Interface: ‘Define from operation and schema (specified later)’ (same as previous section)
  • Operation Type: ‘Produce Message’ (different from previous section)
  • Produce Operation Parameters / Destination Name: JMS_MSG_REPLY_Q (different from previous section)
  • Message Schema: ‘Native format translation is not required (Schema is Opaque)’ (same as previous section)

The composite looks like:

mq_370_FileToJms_BPEL_composite

 

The BPEL process looks like:

mq_371_FilePToJms_BPEL_BPEL

 

The project can now be deployed to the SOA Server.

7. Service Bus consumes msg with JMS Adapter

 

Here, a SB Service reads a message from MQ queue JMS_MSG_REPLY_Q with the JMS Adapter. Then, it uses the File Adapter and puts the message in directory /home/developer/usecase/jmsadapter/osb/out. Shown in the figure below:

mq_380_JmsToFile_SB_composite

 

The File Adapter configuration is not described.

The JMS Adapter configuration is quite similar to the description in the section ‘BPEL consumes msg with JMS Adapter’, The list below indicates what has to be entered on the Wizard pages:

  • Reference name: JmsIn
  • JMS Provider: ‘Third Party’
  • JMS Connection JNDI Name: eis/jms/AMIS
  • Adapter Interface: ‘Define from operation and schema (specified later)’
  • Operation Type: ‘Produce Message’
  • Produce Operation Parameters / Destination Name: JMS_MSG_REPLY_Q
  • Message Schema: ‘Native format translation is not required (Schema is Opaque)’

The composite looks like:

mq_380_JmsToFile_SB_composite

 

The SB pipeline looks like:

mq_381_JmsToFile_service-pipeline

 

Remember to set the right outbound operation in the pipeline.

 

Now, the project can be deployed.

 

8. Testing the use case

 

The projects can also be downloaded here.

The projects can be tested by copying some test message into the directories:

  • ~/usecase/jmsadapter/osb/in
  • ~/usecase/jmsadapter/bpel/in

… and then wait for them to appear in resp:

  • ~/usecase/jmsadapter/bpel/out
  • ~/usecase/jmsadapter/osb/out

Mind the default 1 min polling the of the File Adapter.

One Response

  1. Anurag Gupta January 29, 2016