FAST and Furious Rupesh's Blog

Thursday Dec 06, 2007


This is a question I get asked frequently from the field, so I've tried to cover available options in detail. There is more than one way to integrate IBM WebSphere MQ (aka MQ or MQSeries) with JavaCAPS. We'll go over these, along with how to configure each for high concurrency and hence, high performance. 

1. Using the MQSeries eWay

The diagram below shows typical use of MQSeries eWay operations - in this case, from a Business Process

The Connectivity Map for this use case with MQSeries eWay would look like this:
 

 
The concurrency for outbound MQ operations (in this case, put to MQ_RESPONSE) is configurable using the Outbound MQSeries eWay connection pool settings. The default is a maximum of 20 concurrent connections to MQ for the puts.

However, the inbound MQ operation (receive) uses only 1 channel per CM link and a pool size cannot be configured for the number of concurrent listeners (this is due to a limitation in the underlying IBM API where XA will not work when channels are pooled)

To overcome this serial behavior on the inbound side, use multiple MQ eWay links on the connectivity map configured for the same inbound queue (in our example, MQ_REQUEST). In the example below, 3 inbound MQ eWay links are made to the same business process to force 3 concurrent channels (listeners) to the same queue and hence increasing the concurrency 3 folds.
 

 
All 3 links are configured to talk to the same IBM queue and the polling interval was reduced from the default of 5 seconds to every 100ms.
 

 
There are other ways to use the MQSeries eWay for high throughput. For instance, the process could be triggered by a Scheduler and use MQSeries eWay in outbound mode to do a BulkGet operation that gets every message on the queue. However, this requires modifying business logic to enable concurrent processing.

A cleaner approach for configurable concurrency is to use the JMS interface to MQ as seen below.

2. Using JMS JCA

This option uses the default JMS design time artifacts of JavaCAPS and points to IBM WebSphere MQ as the JMS provider. The example below shows the same BP seen earlier, this time redesigned to use corresponding JMS operations instead of the MQ eWay operations.

On the connectivity map, use the JMS Queue or Topic artifacts from the palette. In the case of JMS, the name given on the connectivity map is very important since it signifies the actual name of the IBM MQ queue/topic (In this case, queues named ‘MQ_REQUEST’ and ‘MQ_RESPONSE’)

Concurrency Options

The inbound and outbound concurrency is configured using the standard JMS configuration in JavaCAPS. That is, outbound concurrency via the ‘maximum pool size’ parameter on the outbound link and inbound concurrency via the ‘connection consumer mode’ on the inbound link. When using connection consumer mode for concurrency, the server session pool size allows you to create multiple listeners (default of 5) to the same endpoint.


Configuring IBM WebSphere MQ as a JMS Server

On the Environment, under your logical host, create a new ‘IBM WebSphere MQ’ server to represent your MQ Server as a JMS provider.

Configure the Webphere MQ JMS provider as shown below (details on available configuration options covered below)

When building and deploying to this Environment, make sure that your MQ JMS endpoints (MQ_REQUEST, MQ_RESPONSE) get mapped to the 'WebSphereMQ' server and not to another JMS server (like the default Sun Seebeyond JMS IQ Manager).

Before running this project, there are some IBM runtime dependencies that need to be added. On your app server (Integration Server), add the location to the following jars under “classpath suffix” (can be done using Enterprise Manager or by editing the domain.xml file):
  • com.ibm.mqjms.jar
  • com.ibm.mq.jar
  • com.ibm.mqetclient.jar (if available, needed for XA)
  • dhbcore.jar

These jar files need to be obtained from your IBM WebSphere install location and are not shipped by Sun. After the jar file locations are added to the classpath, a restart will be required so the jars are loaded by the app server.

Configuration options in Environment Explorer

  • IBM MQ Message Server URL:  specifies the host and port of the MQ server in the format “wmq://[hostname]:[port]”
  • QueueManager: specifies both the QueueManager name and all JMSJCA options. It takes the format
    [queue_manager_name]&option1=value1&option2=value2
    Use the xml escaped ampersand (&) as separator between options. Valid JMSJCA options are covered in the next section.
  • TransportType: specifies the MQ transport type. Use “JMSC.MQJMS_TP_BINDINGS_MQ” for Bindings mode (type exactly). For TCP/IP mode, either leave this empty (since default is TCP/IP) or enter “JMSC_MQJMS_TP_CLIENT_MQ_TCPIP”. Note: the difference in underscore versus period between the two values is NOT a typo. The default Transport Type is TCPIP, this is why this option still works even if you did make a typo  (Update: There is a bug in the editor where the TransportType is not automatically appended to the  'wmq://'  URL . So you have to manually append the TransportType to the QueueManager URL as another option. For instance: "QM_rupeshr_tecra&JMSJCA.NoXA=true&TransportType=JMSC.MQJMS_TP_BINDINGS_MQ")
  • Username/Password: specify if required by MQ

JMSJCA Options

A detailed description of all available JMSJCA options, along with additional JMS JCA documentation, is available in your JavaCAPS runtime location as readme files

/logicalhost/extras/JMSJCA-readme.html

/logicalhost/extras/rawmq-readme.html



Comments:

Very nice! I've added a link to this from http://jmsjca.dev.java.net

Posted by Frank Kieviet on December 06, 2007 at 05:50 PM PST #

Hello Rupesh,

I am trying to invoke IBM MQ from JCAPS 6, BPEL and using the JMSBC Binding Component. I have already put all below mentioned jar files in the path. To me it seems that we need to install the IBM MQ Client on the box and point the MQ_INSTALL\lib and MQ_INSTALL\bin folder in the classpath? Is that a correct assessment? I tried with few jar files and DLL files but it seems it requires the entire set of DLL and JAR files in those folders. Correct me if I am wrong in this. I am presently getting below mentioned error, and thinking that installing MQ Client may help.

Thanks,
Rajan

amqxcs2.dll
amqzst.dll
CL3Export.jar
CL3Nonexport.jar
com.ibm.mq.fta.jar
com.ibm.mq.jar
com.ibm.mq.jms.Nojndi.jar
com.ibm.mq.soap.jar
com.ibm.mqetclient.jar
com.ibm.mqjms.jar
commonservices.jar
connector.jar
dhbcore.jar
fscontext.jar
jms.jar
jndi.jar
jta.jar
ldap.jar
mqjbdf02.dll
mqjbnd05.dll
mqjexitstub01.dll
mqm.dll
mqmxa.dll
MQXAi02.dll
PgmIpLayer.dll
postcard.jar
providerutil.jar
rmm.jar

[#|2009-03-18T16:17:53.715-0700|SEVERE|sun-appserver9.1|sun-jms-binding.com.sun.jbi.jmsbc.OutboundMessageProcessor|_ThreadID=29;_ThreadName=JMSBC-pool-1-thread-2;Context=TestJMSBCCA-sun-jms-binding::Facets_OutPort::JMSOutOperation;_RequestID=60db9961-7954-43d1-83db-d110679d2d3b;|JMSBC-E0747: Failed to process the message exchange with ID 179595048645720-60732-134567110737150128 and exchange pattern http://www.w3.org/2004/08/wsdl/in-only due to error: JMSBC-W0728:Unable to send message to JMS provider, message exchange 179595048645720-60732-134567110737150128, end point TestJMSBCCA-sun-jms-binding{http://j2ee.netbeans.org/wsdl/TestJMSBCBPEL/Facets}JMSOutServiceFacets_OutPortOUTBOUND and operation {http://j2ee.netbeans.org/wsdl/TestJMSBCBPEL/Facets}JMSOutOperation.
java.lang.Exception: JMSBC-W0728:Unable to send message to JMS provider, message exchange 179595048645720-60732-134567110737150128, end point TestJMSBCCA-sun-jms-binding{http://j2ee.netbeans.org/wsdl/TestJMSBCBPEL/Facets}JMSOutServiceFacets_OutPortOUTBOUND and operation {http://j2ee.netbeans.org/wsdl/TestJMSBCBPEL/Facets}JMSOutOperation.
at com.sun.jbi.jmsbc.OutboundMessageProcessor.processOneWayOutbound(OutboundMessageProcessor.java:1272)
at com.sun.jbi.jmsbc.OutboundMessageProcessor.execute(OutboundMessageProcessor.java:372)
at com.sun.jbi.jmsbc.OutboundMessageProcessor.run(OutboundMessageProcessor.java:179)
at com.sun.jbi.jmsbc.OutboundReceiver$Task.run(OutboundReceiver.java:214)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:885)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:907)
at java.lang.Thread.run(Thread.java:619)
Caused by: com.sun.jbi.jmsbc.jms.ChannelException: JMSBC-E0209: Failed to create a JMS message of type TextMessage
at com.sun.jbi.jmsbc.jms.SendChannelJCAImpl.createMessage(SendChannelJCAImpl.java:145)
at com.sun.jbi.jmsbc.OutboundMessageProcessor.denormalizeMessage(OutboundMessageProcessor.java:1481)
at com.sun.jbi.jmsbc.OutboundMessageProcessor.processOneWayOutbound(OutboundMessageProcessor.java:1259)
... 6 more
Caused by: java.lang.NoClassDefFoundError: Could not initialize class com.ibm.mq.server.MQSESSION
at com.ibm.mq.MQSESSIONServer.getMQSESSION(MQSESSIONServer.java:70)
at com.ibm.mq.MQSESSION.getSession(MQSESSION.java:523)
at com.ibm.mq.MQManagedConnectionJ11.<init>(MQManagedConnectionJ11.java:194)
at com.ibm.mq.MQBindingsManagedConnectionFactoryJ11._createManagedConnection(MQBindingsManagedConnectionFactoryJ11.java:179)
at com.ibm.mq.MQBindingsManagedConnectionFactoryJ11.createManagedConnection(MQBindingsManagedConnectionFactoryJ11.java:215)
at com.ibm.mq.StoredManagedConnection.<init>(StoredManagedConnection.java:84)
at com.ibm.mq.MQSimpleConnectionManager.allocateConnection(MQSimpleConnectionManager.java:168)
at com.ibm.mq.MQQueueManagerFactory.obtainBaseMQQueueManager(MQQueueManagerFactory.java:774)
at com.ibm.mq.MQQueueManagerFactory.procure(MQQueueManagerFactory.java:690)
at com.ibm.mq.MQQueueManagerFactory.constructQueueManager(MQQueueManagerFactory.java:646)
at com.ibm.mq.MQQueueManagerFactory.createQueueManager(MQQueueManagerFactory.java:153)
at com.ibm.mq.MQQueueManager.<init>(MQQueueManager.java:544)
at com.ibm.mq.MQSPIQueueManager.<init>(MQSPIQueueManager.java:69)
at com.ibm.mq.jms.MQConnection.createQM(MQConnection.java:2401)
at com.ibm.mq.jms.MQConnection.createQMNonXA(MQConnection.java:1830)
at com.ibm.mq.jms.MQConnection.<init>(MQConnection.java:811)
at com.ibm.mq.jms.MQConnectionFactory.createConnection(MQConnectionFactory.java:4733)
at com.stc.jmsjca.core.RAJMSObjectFactory.createConnection(RAJMSObjectFactory.java:216)
at com.stc.jmsjca.core.GenericSessionConnection.<init>(GenericSessionConnection.java:91)
at com.stc.jmsjca.core.RAJMSObjectFactory.createSessionConnection(RAJMSObjectFactory.java:684)
at com.stc.jmsjca.core.JSession.<init>(JSession.java:94)
at com.stc.jmsjca.core.XManagedConnection.<init>(XManagedConnection.java:110)
at com.stc.jmsjca.core.XManagedConnectionFactory.createManagedConnection(XManagedConnectionFactory.java:268)
at com.stc.jmsjca.core.XDefaultConnectionManager.obtainConnection(XDefaultConnectionManager.java:508)
at com.stc.jmsjca.core.XDefaultConnectionManager.allocateConnection(XDefaultConnectionManager.java:416)
at com.stc.jmsjca.core.JConnection.createSessionByApplication(JConnection.java:131)
at com.stc.jmsjca.core.JConnection.createSession(JConnection.java:314)
at com.stc.jmsjca.core.WConnection.createSession(WConnection.java:94)
at com.sun.jbi.jmsbc.jms.SendChannelJCAImpl.createMessage(SendChannelJCAImpl.java:109)
... 8 more
|#]

Posted by Rajan Jain on March 18, 2009 at 04:29 PM PDT #

Placed an online order and received an immediate confirmation. From that point had no communications until two full weeks later when I received an email cancelling my order and offering to sell me the same item at roughly 9X the original price. There really is no excuse for a two week delay.

Posted by Used Refurbished Laptops on April 05, 2009 at 06:12 AM PDT #

Post a Comment:
  • HTML Syntax: NOT allowed