A typical Scenario for customers is to have Sterling B2B Integrator as a B2B Gateway, and then have WebSphere Message Broker or WebSphere MQ as an internal integration solution. Thus a typical scenario will be to have Sterling B2B Integrator listen on a MQ Queue to receive data that should be sent to a partner or to put received data on a MQ Queue for internal processing.
There is a lot of different alternative software for Message Queuing, like IBM WebSphere MQ, MSMQ, RabbitMQ, ActiveMQ, ZeroMQ, HornetQ, StormMQ and what have you… There are Licensed software, Open Source software and both on premise and Cloud offerings. So there is a large variety of Message Queuing solutions to choose from. But not all of them is supported in IBM Sterling B2B Integrator however.
Since I am an IBM’er, I will use IBM WebSphere MQ in this example. But later on I will maybe also use some Open Source alternative.
This example will concentrate on listening to a Queue and fetching data from the Queue to do some processing on the file.
Then I will do it the opposite way in a later Blog Post. To put a file on a MQ Queue, read this Post.
Setting up IBM WebSphere MQ
I have IBM WebSphere MQ 8.0 installed on a server, and will create a Queue Manager, a Queue and a Channel to use together with Sterling B2B Integrator.
My Queue Manager is named SB2BIQM, The Queue where Sterling B2B Integrator will listen is named ToSB2BI and the Channel is named SB2BI. In WebSphere MQ Explorer it will look like below.
And that’s it for the WebSphere MQ setup to make this work.
Setting up Sterling B2B Integrator
I will now go through some steps to set this up on the Sterling B2B Integrator side.
Since this is the first time I am setting up this on my current Sterling B2B Integrator installation, I have to install the J2EE(TM) Connector Architecture Specification Interface Classes connector-api.jar. This file is necessary to get the MQ Suite Services to work. I downloaded that file from here. The connector-api.jar file is installed by using install3rdParty.sh script like below.
Business process to process the MESSAGE
The next step is to create some Business Process that should be triggered when a message is picked from the MQ Queue. Just for simplicity, I created a very simple Business Process that uses a SMTP Send Adapter to send the message as an e-mail to a mail address.
The code for the BP looks like this. The SMTP Send Adapter is preconfigured to my SMTP Server (which is sidb.demos.ibm.int)
<process name="default"> <sequence> <operation name="SMTP Send Adapter"> <participant name="SMTP_SEND_ADAPTER"/> <output message="SMTP_SEND_ADAPTERInputMessage"> <assign to="." from="*"></assign> <assign to="xport-smtp-mailto">firstname.lastname@example.org</assign> </output> <input message="inmsg"> <assign to="." from="*"></assign> </input> </operation> </sequence> </process>
WebSphere MQ Suite Async Receive Service
The WebSphere MQ Suite Async Receive Service is a standard Service in Sterling B2B Integrator. The Service is ideal for this type of Scenario since it it continuously listening on a Queue and pics up messages more or less real-time from the queue.
I configured a WebSphere MQ Suite Async Receive Service like the Screenshots below to listen to my MQ Queue created earlier.
I gave the new Service a name.
Configured the Connection to the WebSphere MQ Server.
Configured to pick one message at the time and handle the message as one document.
Set the Business Process created earlier as Bootstrap Workflow, and I also set the Standard EmailOnError BP just as good practice.
To test this, now when all is put together, I added a Test Message onto the ToSB2BI Queue in WebSphere MQ Explorer.
This was a really simple way of showing how to pick messages from an IBM WebSphere MQ Queue, and process it in IBM Sterling B2B Integrator. Typically this message would be some kind of Inhouse file format that should be mapped and sent to a partner. Then the only thing to do is to change the Business Process Bootstrapped to the WebSphere MQ Suite Async Receive Service from my simple SMTP BP to a BP with some more logic.