In a previous Post, I was fetching messages from an WebSphere MQ Queue. This time I will to the opposite. Have a file from Sterling B2B Integrator put on to an MQ Queue.
Configure WebSphere MQ
I start by creating a Queue on my WebSphere MQ Server. I call this Queue FromSB2BI. This is the Queue where Sterling B2B Integrator will put the message.
This really is all there is to do in MQ. Then the rest of the work has to be done in Sterling B2B integrator.
Configure IBM Sterling B2B Integrator
I will create a Business Process that uses the WebSphere MQ Suite Services that is existing in Sterling B2B Integrator. It will Open a Session, get the Session ID, Open a Queue, Put a message to the Queue, Commit and Close the Session. The Session ID I get when Opening the Session, is used in all the other Services.
The Business Process looks like below.
The code for this Business Process is below to see the details of the configuration.
<process name = "ES_PUT_TO_MQ"> <sequence name="Sequence Start"> <operation name="WebSphereMQ Suite Open Session"> <participant name="WSMQ_OpenSession"/> <output message="WSMQOpenSessionInputMessage"> <assign to="." from="*"></assign> <assign to="wsmq_channel">SB2BI</assign> <assign to="wsmq_hostname">mq.demos.ibm.int</assign> <assign to="wsmq_password">password</assign> <assign to="wsmq_port">1414</assign> <assign to="wsmq_qmanager">SB2BIQM</assign> <assign to="wsmq_userid">SI_User</assign> </output> <input message="inmsg"> <assign to="." from="*"></assign> </input> </operation> <assign name="Assign" to="WSMQ_TLG_wsmq_sessionid" from="/ProcessData/wsmq_sessionid/text()"></assign> <operation name="WebSphereMQ Suite Open Queue"> <participant name="WSMQ_OpenQueue"/> <output message="WSMQOpenQueueInputMessage"> <assign to="." from="*"></assign> <assign to="wsmq_MQOO_failifquiescing">Yes</assign> <assign to="wsmq_MQOO_type">PUT</assign> <assign to="wsmq_qname">FromSB2BI</assign> <assign to="wsmq_rmtQMgr">SB2BIQM</assign> <assign to="wsmq_sessionid" from="/ProcessData/WSMQ_TLG_wsmq_sessionid/text()"></assign> </output> <input message="inmsg"> <assign to="." from="*"></assign> </input> </operation> <operation name="WebSphereMQ Suite Put Message"> <participant name="WSMQ_PutMessage"/> <output message="WSMQPutMessageInputMessage"> <assign to="." from="*"></assign> <assign to="wsmq_MQMD_msgType">DATAGRAM</assign> <assign to="wsmq_qname">FromSB2BI</assign> <assign to="wsmq_sessionid" from="/ProcessData/WSMQ_TLG_wsmq_sessionid/text()"></assign> </output> <input message="inmsg"> <assign to="." from="*"></assign> </input> </operation> <operation name="WebSphereMQ Suite Commit"> <participant name="WSMQ_Commit"/> <output message="WSMQCommitInputMessage"> <assign to="." from="*"></assign> <assign to="wsmq_sessionid" from="/ProcessData/WSMQ_TLG_wsmq_sessionid/text()"></assign> </output> <input message="inmsg"> <assign to="." from="*"></assign> </input> </operation> <operation name="WebSphereMQ Suite Close Session"> <participant name="WSMQ_CloseSession"/> <output message="WSMQCloseSessionInputMessage"> <assign to="." from="*"></assign> <assign to="wsmq_sessionid" from="/ProcessData/WSMQ_TLG_wsmq_sessionid/text()"></assign> </output> <input message="inmsg"> <assign to="." from="*"></assign> </input> </operation> </sequence> </process>
There is one thing to notice if using a Windows Server for WebSphere MQ. WebSphere MQ has a built in limitation for the user name. It only has 12 characters. So if using Windows Server and as many using the default Administrator Account, it will not work since Administrator is 13 characters long, and WebSphere MQ thus only gets Administrato. So use a different username for connecting to the MQ Server. I have created the user SI_User and added that user to the mqm User group.
Testing
I upload my new Business Process to Sterling B2B Integrator and to test it I simply Execute the process manually with some file as input.
In IBM WebSphere MQ Explorer, I can the see that the Current queue depth got to 1 when the message was put there, and I can Browse the message and view the data in the file, which in this case was a simple text file with the text “Test Text”.
Summary
This is just a very simple example, but shows the basic theory on putting a message from Sterling B2B Integrator to IBM WebSphere MQ.
How and where do i put a file . PUT Message Step is where name of file has to be specified . I Tried adding a local path in DOCUMENT ID Field . Not working .
Hi,
In this example I have not specified a place to fetch a file. To test it I just manually executed the Business Process from the SB2BI GUI, and in the Execute Dialog in SB2BI, I added a file to use. If the process should use a file from somewhere, it is possible to have a scheduled File System Adapter fetching a file from a folder, and executing the Business Process when a file is fetched.
Can we put messages to cluster queues ( MQ) from the B2B integrator ?
what other considerations to be followed if we want to put/get the messages from the queue managers which are part of the cluster
Hi Pavan,
I have not tried it myself, but don’t see any reason why it should not be possible. Just use Alias Queue names, and control in MQ what Cluster Queues is pointed to by the alias.
ok got it now thanks
but one more question the installed MQ on SI is v 7_0_6_1 and the MQ server is v 7_0_0_1 is it fine to use the connector on the sever or there will be an issue?
sorry for this but i dont know a lot about the connector its first time
hi but here im using older version of websphere ! and i didnt get this command can you please clarify it more.
./install3rdParty.sh ibm8_0 -j !! what is ment by ibm 8_0 …. and the path is for what ?
You can download the needed jar-file from this link. It is the J2EE Connector Architecture Specification Interface Classes 1.5. It is a zip-file. Un-zip the file, and you will find a file named connector-api.jar. This is the file you need to install. It is the same for different MQ versions. The command is as follows:
– ./install3rdParty.sh is the program used to install 3rd Party software in SB2BI in a Linux environment. This jar is from Oracle, and thus a 3rd party peace of software.
– The “ibm 8_0” is the Vendor and Version of the software. It’s just the naming I have put on the folder where the jar is to be installed in the jar repository within the SB2BI installation. Since you are running MQ 7, you can write “ibm 7_0”. This is just to make it more easy to find if browsing through jars to see what jars is used for what software. Would probably work just as good with “ibmmq 7_0”, or something similar as well.
– The -j is kust to say that this is a jar/compressed file.
– The path in the end is where the jar-file is located on your server. Typically in a Download folder er similar.
More help on the install3rdParty script can be found here.
Dear Sir,
I tried to use the above BP but im getting this error
Throwable in ae.invokeservice:com.ibm.mq.MQEnvironment (initialization failure)
im using SBI v.525 and Websphere MQ v.7.0.0.1
do u have any idea?
Thanks
Hi Ali,
I don’t have any good answer other than checking your jar’s as mentioned in this support entry at IBM Support. http://www-01.ibm.com/support/docview.wss?uid=swg21691696
Have you by the way done the prerequisites in my first post on the MQ integration? The J2EE Connector Architecture has to be installed prior to get this working. There is a link to that blog post in the beginning of this one.
Erlend
no i didnt do any thing can u please send me the link for the prerequistes
Yes, on this Blog Post I do the initial setup for the communication between SB2BI and MQ. If you go through this, I hope it will work. There is some jars you need to install. A lot of the stuff on my blog is based upon things done in earlier posts. But then I try to link to those posts in the introduction.