Series
This is the fifth post in a series on using Oracle Middleware with IBM MQ Series. In this series, the following articles are available:
- IBM MQ Series Installation and Configuration
- Configuration of JMS and MQ Adapters in WebLogic
- Use case: JMS Adapter and MQ
- Use case: MQ Adapter
- Use case: MQ Transport
MQ transport
This blog covers the exchange of text messages over MQ, using the MQ transport of Service Bus.
1. Overview
This blog covers the MQ Transport use case. It is structured in the following way:
- Overview
- Use case description
- Prepare the file system
- Service Bus produces msg with MQ Transport
- Service Bus consumes msg with MQ Transport
- Testing the use case
The projects can also be downloaded here.
2. Use case description
This use case shows how the Service Bus can be used to put/consume messages on an MQ queue, using MQ transport.
Note that when the Oracle JCA Adapters work with ‘Native format translation is not required (Schema is Opaque)’, they deliver their message in base64 encoded format. This is nicely explained by Lucas in https://technology.amis.nl/2014/08/06/opaque-does-not-mean-just-pass-anything-in-it-has-to-be-base64-jca-adapters/.
Therefore, when a JCA adapter puts a message on a MQ queue, and then a MQ transport picks up that message, a base64 decoding has to be done before the message content can be processed.
The use case covers the following situation:
1. SB puts a msg on an MQ queue, SB consumes a msg from the MQ queue
- a file is put in directory …/usecase/mqtransport/osb/in
- the SB service picks up the file with the file adapter
- the SB service puts the file on queue TEXT_MSG_REQUEST_Q with the MQ transport
- the SB Service picks up the msg from queue TEXT_MSG_REQUEST_Q with the MQ transport
- the SB Service puts the message in directory …/usecase/mqtransport/osb/out
In order to complete this use case, the File Adapter is used. The File Adapter is used in 2 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 projects here.
3. Prepare the file system
The following directories have to be made:
[developer@localhost ~]$ cd usecase/<br>[developer@localhost usecase]$ pwd<br>/home/developer/usecase<br>[developer@localhost usecase]$ ls<br>jmsadapter mqadapter<br>[developer@localhost usecase]$ mkdir mqtransport<br>[developer@localhost usecase]$ mkdir mqtransport/osb<br>[developer@localhost usecase]$ mkdir mqtransport/osb/in<br>[developer@localhost usecase]$ mkdir mqtransport/osb/out<br>[developer@localhost usecase]$
4. Service Bus produces msg with MQ Transport
Starting point is a service bus project with a File Adapter that picks up a message from the directory /home/developer/usecase/mqtransport/osb/in.
The File Adapter configuration is not described.
When using the MQ Transport, first an MQ Connection must be added:
Create an MQ Conection, named MqAmis:
Configured like below:
Now, insert an MQ Transport:
with in the wizard the following entries:
1. Create Service with Service Name : MqTrOut and Transport type: mq
2. Set Service Type to ‘anyXML’
3. Set the endpoint URI to mq://TEXT_MSG_REQUEST_Q?conn=FileToMqTr_SB/MqAmis
That bring us to the situation:
After connecting Pipeline and Business Service:
Now, the project can be deployed.
5. Service Bus consumes msg with MQ Transport
Starting point is a service bus project with a File Adapter that writes a message to the directory /home/developer/usecase/mqtransport/osb/out.
No pipeline – yet.
The File Adapter configuration is not described.
Now, configure an MQ Connection MqAmis just like in the previous project (above).
Next, insert an MQ Transport, with in the wizard the following entries:
- Create Service with Service Name : MqTrIn and Transport type: mq, and ‘Generate Pipeline’ checked and with pipeline name: MqTrToFile
- Set Service Type to ‘anyXML’
- Set the endpoint URI to mq://TEXT_MSG_REQUEST_Q?conn=MqTrToFile_SB/MqAmis
That bring us to the situation:
Connecting Pipeline and Business Service:
Now, the project can be deployed.
6. Testing the use case
The projects can also be downloaded here.
The projects can be tested by copying some test messages into the directories:
- ~/usecase/mqtransport/osb/in
… and then wait for them to appear in resp:
- ~/usecase/mqtransport/osb/out
Mind the default 1 min polling the of the File Adapter.
What version of JDev do you use for this project?
Thanks a lot!
Hi Diego,
Version JDev: 12.2.1.0.0
Best regards,
Luc