JMS - Java Message Service



Resource adapter integrating Weblogic 8.1+ with IBM Websphere MQ
version 5.2.1 / 5.3 / 6.0 (formerly MQseries)
Illustrated with examples






Extyernal JNDI definition ..
c:\jms-jndi-directory-bridge\.bindings



TOPSECURITY_Q/ClassName=com.ibm.mq.jms.MQQueue
TOPSECURITY_Q/FactoryName=com.ibm.mq.jms.MQQueueFactory
TOPSECURITY_Q/RefAddr/0/Content=6
TOPSECURITY_Q/RefAddr/0/Encoding=String
TOPSECURITY_Q/RefAddr/0/Type=VER
TOPSECURITY_Q/RefAddr/1/Content=-2
TOPSECURITY_Q/RefAddr/1/Encoding=String
TOPSECURITY_Q/RefAddr/1/Type=EXP
TOPSECURITY_Q/RefAddr/2/Content=-2
TOPSECURITY_Q/RefAddr/2/Encoding=String
TOPSECURITY_Q/RefAddr/2/Type=PRI
TOPSECURITY_Q/RefAddr/3/Content=-2
TOPSECURITY_Q/RefAddr/3/Encoding=String
TOPSECURITY_Q/RefAddr/3/Type=PER
TOPSECURITY_Q/RefAddr/4/Content=1208
TOPSECURITY_Q/RefAddr/4/Encoding=String
TOPSECURITY_Q/RefAddr/4/Type=CCS
TOPSECURITY_Q/RefAddr/5/Content=0
TOPSECURITY_Q/RefAddr/5/Encoding=String
TOPSECURITY_Q/RefAddr/5/Type=TC
TOPSECURITY_Q/RefAddr/6/Content=273
TOPSECURITY_Q/RefAddr/6/Encoding=String
TOPSECURITY_Q/RefAddr/6/Type=ENC
TOPSECURITY_Q/RefAddr/7/Content=1
TOPSECURITY_Q/RefAddr/7/Encoding=String
TOPSECURITY_Q/RefAddr/7/Type=FIQ
TOPSECURITY_Q/RefAddr/8/Content=TOPSECURITY.QUEUE
TOPSECURITY_Q/RefAddr/8/Encoding=String
TOPSECURITY_Q/RefAddr/8/Type=QU
TOPSECURITY_Q/RefAddr/9/Content=BEAQM
TOPSECURITY_Q/RefAddr/9/Encoding=String
TOPSECURITY_Q/RefAddr/9/Type=QMGR
TOPSECURITY_QCF/ClassName=com.ibm.mq.jms.MQQueueConnectionFactory
TOPSECURITY_QCF/FactoryName=com.ibm.mq.jms.MQQueueConnectionFactoryFactory
TOPSECURITY_QCF/RefAddr/0/Content=2
TOPSECURITY_QCF/RefAddr/0/Encoding=String
TOPSECURITY_QCF/RefAddr/0/Type=VER
TOPSECURITY_QCF/RefAddr/1/Content=1
TOPSECURITY_QCF/RefAddr/1/Encoding=String
TOPSECURITY_QCF/RefAddr/1/Type=TRAN
TOPSECURITY_QCF/RefAddr/10/Content=10
TOPSECURITY_QCF/RefAddr/10/Encoding=String
TOPSECURITY_QCF/RefAddr/10/Type=MBS
TOPSECURITY_QCF/RefAddr/11/Content=1
TOPSECURITY_QCF/RefAddr/11/Encoding=String
TOPSECURITY_QCF/RefAddr/11/Type=FIQ
TOPSECURITY_QCF/RefAddr/12/Content=
TOPSECURITY_QCF/RefAddr/12/Encoding=String
TOPSECURITY_QCF/RefAddr/12/Type=LA
TOPSECURITY_QCF/RefAddr/13/Content=5000
TOPSECURITY_QCF/RefAddr/13/Encoding=String
TOPSECURITY_QCF/RefAddr/13/Type=RINT
TOPSECURITY_QCF/RefAddr/14/Content=SYSTEM.DEFAULT.MODEL.QUEUE
TOPSECURITY_QCF/RefAddr/14/Encoding=String
TOPSECURITY_QCF/RefAddr/14/Type=TM
TOPSECURITY_QCF/RefAddr/15/Content=
TOPSECURITY_QCF/RefAddr/15/Encoding=String
TOPSECURITY_QCF/RefAddr/15/Type=TQPFX
TOPSECURITY_QCF/RefAddr/16/Content=1
TOPSECURITY_QCF/RefAddr/16/Encoding=String
TOPSECURITY_QCF/RefAddr/16/Type=MRET
TOPSECURITY_QCF/RefAddr/2/Content=BEAQM
TOPSECURITY_QCF/RefAddr/2/Encoding=String
TOPSECURITY_QCF/RefAddr/2/Type=QMGR
TOPSECURITY_QCF/RefAddr/3/Content=semp20
TOPSECURITY_QCF/RefAddr/3/Encoding=String
TOPSECURITY_QCF/RefAddr/3/Type=HOST
TOPSECURITY_QCF/RefAddr/4/Content=1421
TOPSECURITY_QCF/RefAddr/4/Encoding=String
TOPSECURITY_QCF/RefAddr/4/Type=PORT
TOPSECURITY_QCF/RefAddr/5/Content=SYSTEM.DEF.SVRCONN
TOPSECURITY_QCF/RefAddr/5/Encoding=String
TOPSECURITY_QCF/RefAddr/5/Type=CHAN
TOPSECURITY_QCF/RefAddr/6/Content=819
TOPSECURITY_QCF/RefAddr/6/Encoding=String
TOPSECURITY_QCF/RefAddr/6/Type=CCS
TOPSECURITY_QCF/RefAddr/7/Content=false
TOPSECURITY_QCF/RefAddr/7/Encoding=String
TOPSECURITY_QCF/RefAddr/7/Type=SPAG
TOPSECURITY_QCF/RefAddr/8/Content=true
TOPSECURITY_QCF/RefAddr/8/Encoding=String
TOPSECURITY_QCF/RefAddr/8/Type=UCP
TOPSECURITY_QCF/RefAddr/9/Content=5000
TOPSECURITY_QCF/RefAddr/9/Encoding=String
TOPSECURITY_QCF/RefAddr/9/Type=PINT
TOPSECURITY_XAQCF/ClassName=com.ibm.mq.jms.MQXAQueueConnectionFactory
TOPSECURITY_XAQCF/FactoryName=com.ibm.mq.jms.MQXAQueueConnectionFactoryFactory
TOPSECURITY_XAQCF/RefAddr/0/Content=2
TOPSECURITY_XAQCF/RefAddr/0/Encoding=String
TOPSECURITY_XAQCF/RefAddr/0/Type=VER
TOPSECURITY_XAQCF/RefAddr/1/Content=1
TOPSECURITY_XAQCF/RefAddr/1/Encoding=String
TOPSECURITY_XAQCF/RefAddr/1/Type=TRAN
TOPSECURITY_XAQCF/RefAddr/10/Content=10
TOPSECURITY_XAQCF/RefAddr/10/Encoding=String
TOPSECURITY_XAQCF/RefAddr/10/Type=MBS
TOPSECURITY_XAQCF/RefAddr/11/Content=1
TOPSECURITY_XAQCF/RefAddr/11/Encoding=String
TOPSECURITY_XAQCF/RefAddr/11/Type=FIQ
TOPSECURITY_XAQCF/RefAddr/12/Content=
TOPSECURITY_XAQCF/RefAddr/12/Encoding=String
TOPSECURITY_XAQCF/RefAddr/12/Type=LA
TOPSECURITY_XAQCF/RefAddr/13/Content=5000
TOPSECURITY_XAQCF/RefAddr/13/Encoding=String
TOPSECURITY_XAQCF/RefAddr/13/Type=RINT
TOPSECURITY_XAQCF/RefAddr/14/Content=SYSTEM.DEFAULT.MODEL.QUEUE
TOPSECURITY_XAQCF/RefAddr/14/Encoding=String
TOPSECURITY_XAQCF/RefAddr/14/Type=TM
TOPSECURITY_XAQCF/RefAddr/15/Content=
TOPSECURITY_XAQCF/RefAddr/15/Encoding=String
TOPSECURITY_XAQCF/RefAddr/15/Type=TQPFX
TOPSECURITY_XAQCF/RefAddr/16/Content=1
TOPSECURITY_XAQCF/RefAddr/16/Encoding=String
TOPSECURITY_XAQCF/RefAddr/16/Type=MRET
TOPSECURITY_XAQCF/RefAddr/2/Content=BEAQM
TOPSECURITY_XAQCF/RefAddr/2/Encoding=String
TOPSECURITY_XAQCF/RefAddr/2/Type=QMGR
TOPSECURITY_XAQCF/RefAddr/3/Content=semp20
TOPSECURITY_XAQCF/RefAddr/3/Encoding=String
TOPSECURITY_XAQCF/RefAddr/3/Type=HOST
TOPSECURITY_XAQCF/RefAddr/4/Content=1421
TOPSECURITY_XAQCF/RefAddr/4/Encoding=String
TOPSECURITY_XAQCF/RefAddr/4/Type=PORT
TOPSECURITY_XAQCF/RefAddr/5/Content=SYSTEM.DEF.SVRCONN
TOPSECURITY_XAQCF/RefAddr/5/Encoding=String
TOPSECURITY_XAQCF/RefAddr/5/Type=CHAN
TOPSECURITY_XAQCF/RefAddr/6/Content=819
TOPSECURITY_XAQCF/RefAddr/6/Encoding=String
TOPSECURITY_XAQCF/RefAddr/6/Type=CCS
TOPSECURITY_XAQCF/RefAddr/7/Content=false
TOPSECURITY_XAQCF/RefAddr/7/Encoding=String
TOPSECURITY_XAQCF/RefAddr/7/Type=SPAG
TOPSECURITY_XAQCF/RefAddr/8/Content=true
TOPSECURITY_XAQCF/RefAddr/8/Encoding=String
TOPSECURITY_XAQCF/RefAddr/8/Type=UCP
TOPSECURITY_XAQCF/RefAddr/9/Content=5000
TOPSECURITY_XAQCF/RefAddr/9/Encoding=String
TOPSECURITY_XAQCF/RefAddr/9/Type=PINT



Source for client programs:

Non-transactional:

What you need to add to config.xml in your Weblogic installation to enable non-transactional access to MQ through a native Weblogic JMS queue - which can either be accessed from deployed applications on Weblogic - or externally by sending messages to the Weblogic JMS queue, where they'll be persisted until transmission to MQ is possible (sent with "Atmost-once" quality of service).


What you need to add to config.xml in your Weblogic installation to enable ..
config.xml

...
<JMSConnectionFactory JNDIName="wlsQCF" Name="wlsQCF" Targets="myserver" XAConnectionFactoryEnabled="false"/> <JMSFileStore Directory="topsec_jmsstore" Name="TOPSEC JMS File Store"/> <JMSServer Name="TOPSEC JMS Server" Store="TOPSEC JMS File Store" Targets="myserver"> <JMSQueue JNDIName="wlTopsin" Name="wlTopsin" StoreEnabled="true"/> <JMSQueue JNDIName="wlTopsout" Name="wlTopsout" StoreEnabled="true"/> </JMSServer> <ForeignJMSServer ConnectionURL="file:/C:/jms-jndi-directory-bridge" InitialContextFactory="com.sun.jndi.fscontext.RefFSContextFactory" JNDIProperties="" Name="MQ JMS Server" Targets="myserver"> <ForeignJMSConnectionFactory LocalJNDIName="mqQCF" Name="mqQCF" RemoteJNDIName="TOPSECURITY_QCF"/> <ForeignJMSDestination LocalJNDIName="mqTopsin" Name="mqTopsin" RemoteJNDIName="TOPSECURITY_Q"/> <ForeignJMSDestination LocalJNDIName="mqTopsout" Name="mqTopsout" RemoteJNDIName="TOPSECURITY_Q"/> </ForeignJMSServer> <JMSBridgeDestination AdapterJNDIName="eis.jms.WLSConnectionFactoryJNDINoTX" ConnectionFactoryJNDIName="mqQCF" DestinationJNDIName="mqTopsin" Name="MQ Receive Destination"/> <JMSBridgeDestination AdapterJNDIName="eis.jms.WLSConnectionFactoryJNDINoTX" ConnectionFactoryJNDIName="mqQCF" DestinationJNDIName="mqTopsout" Name="MQ Send Destination"/> <JMSBridgeDestination AdapterJNDIName="eis.jms.WLSConnectionFactoryJNDINoTX" ConnectionFactoryJNDIName="wlsQCF" DestinationJNDIName="wlTopsin" Name="WLS Receive Destination"/> <JMSBridgeDestination AdapterJNDIName="eis.jms.WLSConnectionFactoryJNDINoTX" ConnectionFactoryJNDIName="wlsQCF" DestinationJNDIName="wlTopsout" Name="WLS Send Destination"/> <MessagingBridge BatchInterval="10" Name="WLS-MQ Send Bridge" QualityOfService="Atmost-once" SourceDestination="WLS Send Destination" Started="true" TargetDestination="MQ Send Destination" Targets="myserver"/> <MessagingBridge BatchInterval="10" Name="MQ-WLS Receive Bridge" QualityOfService="Atmost-once" SourceDestination="MQ Receive Destination" Started="true" TargetDestination="WLS Receive Destination" Targets="myserver"/> <Application Name="jms-notran-adp" Path="C:\bea\weblogic81\server\lib" StagingMode="nostage" TwoPhase="false"> <ConnectorComponent Name="jms-notran-adp" Targets="myserver" URI="jms-notran-adp.rar"/> </Application> ...




Non-transactionally...add this to startWeblogic.cmd ..
config.xml

...
set CLASSPATH=.\mqlib\com.ibm.mq.jar;.\mqlib\com.ibm.mqjms.jar;.\mqlib\fscontext.jar;.\mqlib\providerutil.jar;.\mqlib\dbhcore.jar;%CLASSPATH% ...





Transactional:

What you need to add to config.xml in your Weblogic installation to enable transactional access to MQ through a native Weblogic JMS queue - which can either be accessed from deployed applications on Weblogic - or externally by sending messages to the Weblogic JMS queue, where they'll be persisted until transmission to MQ is possible (sent with "Exactly-once" quality of service).


Transactional access from Weblogic... add this to config.xml...
config.xml

...
<JMSConnectionFactory JNDIName="wlsQCF" Name="wlsQCF" Targets="myserver" XAConnectionFactoryEnabled="true"/> <JMSFileStore Directory="topsec_jmsstore" Name="TOPSEC JMS File Store"/> <JMSServer Name="TOPSEC JMS Server" Store="TOPSEC JMS File Store" Targets="myserver"> <JMSQueue JNDIName="wlTopsin" Name="wlTopsin" StoreEnabled="true"/> <JMSQueue JNDIName="wlTopsout" Name="wlTopsout" StoreEnabled="true"/> </JMSServer> <ForeignJMSServer ConnectionURL="file:/C:/jms-jndi-directory-bridge" InitialContextFactory="com.sun.jndi.fscontext.RefFSContextFactory" JNDIProperties="" Name="MQ JMS Server" Targets="myserver"> <ForeignJMSConnectionFactory LocalJNDIName="mqQCF" Name="mqQCF" RemoteJNDIName="TOPSECURITY_XAQCF"/> <ForeignJMSDestination LocalJNDIName="mqTopsin" Name="mqTopsin" RemoteJNDIName="TOPSECURITY_Q"/> <ForeignJMSDestination LocalJNDIName="mqTopsout" Name="mqTopsout" RemoteJNDIName="TOPSECURITY_Q"/> </ForeignJMSServer> <JMSBridgeDestination AdapterJNDIName="eis.jms.WLSConnectionFactoryJNDIXA" ConnectionFactoryJNDIName="mqQCF" DestinationJNDIName="mqTopsin" Name="MQ Receive Destination"/> <JMSBridgeDestination AdapterJNDIName="eis.jms.WLSConnectionFactoryJNDIXA" ConnectionFactoryJNDIName="mqQCF" DestinationJNDIName="mqTopsout" Name="MQ Send Destination"/> <JMSBridgeDestination AdapterJNDIName="eis.jms.WLSConnectionFactoryJNDIXA" ConnectionFactoryJNDIName="wlsQCF" DestinationJNDIName="wlTopsin" Name="WLS Receive Destination"/> <JMSBridgeDestination AdapterJNDIName="eis.jms.WLSConnectionFactoryJNDIXA" ConnectionFactoryJNDIName="wlsQCF" DestinationJNDIName="wlTopsout" Name="WLS Send Destination"/> <MessagingBridge BatchInterval="10" Name="WLS-MQ Send Bridge" QualityOfService="Exactly-once" SourceDestination="WLS Send Destination" Started="true" TargetDestination="MQ Send Destination" Targets="myserver"/> <MessagingBridge BatchInterval="10" Name="MQ-WLS Receive Bridge" QualityOfService="Exactly-once" SourceDestination="MQ Receive Destination" Started="true" TargetDestination="WLS Receive Destination" Targets="myserver"/> <Application Name="jms-xa-adp" Path="C:\bea\weblogic81\server\lib" StagingMode="nostage" TwoPhase="true"> <ConnectorComponent Name="jms-xa-adp" Targets="myserver" URI="jms-xa-adp.rar"/> </Application> ...




Transactionally...add this to startWeblogic.cmd ..
config.xml

...
set CLASSPATH=.\mqlib\com.ibm.mqetclient.jar;.\mqlib\com.ibm.mq.jar;.\mqlib\com.ibm.mqjms.jar;.\mqlib\fscontext.jar;.\mqlib\providerutil.jar;.\mqlib\dbhcore.jar;%CLASSPATH% ...







Advantages: Disadvantages:


/topsecurity.dk, december 2005