-
1. Re: JBOSS 7 JMS Bridge, connect HornetQ to Webpsphere MQ
mnovak Jul 19, 2013 3:10 AM (in response to matvei)Hi,
there is example config for JMS bridge which is working in AS 7.2/EAP 6.1:
<subsystem xmlns="urn:jboss:domain:messaging:1.3">
<hornetq-server>
...
</hornetq-server>
<jms-bridge name="myBridge">
<source>
<connection-factory name="jms/RemoteConnectionFactory"/>
<destination name="jms/queue/InQueue"/>
</source>
<target>
<connection-factory name="jms/RemoteConnectionFactory"/>
<destination name="jms/queue/OutQueue"/>
<context>
<property key="java.naming.factory.initial" value="org.jboss.naming.remote.client.InitialContextFactory"/>
<property key="java.naming.provider.url" value="remote://192.168.40.1:4447"/>
</context>
</target>
<quality-of-service>AT_MOST_ONCE</quality-of-service>
<failure-retry-interval>1000</failure-retry-interval>
<max-retries>-1</max-retries>
<max-batch-size>10</max-batch-size>
<max-batch-time>100</max-batch-time>
<add-messageID-in-header>true</add-messageID-in-header>
</jms-bridge>
...
</subsystem>
This creates JMS bridge between two AS 7.2 servers. I did not try with Websphere MQ but following is what I guess is needed to configure:
1. Set correct properties in <context>, something like:
<context>
<property key="java.naming.factory.initial" value="
com.ibm.mq.jms.context.WMQInitialContextFactory
"/><property key="java.naming.provider.url" value="ip_of_websheremq_server
:1414/CH
"/><property key="
java.naming.factory.url.pkgs
" value="com.ibm.mq.jms.naming
"/>
</context>
2. Now AS 7.2 has no idea where to find class
WMQInitialContextFactory or
com.ibm.mq.jms.naming so it's necessary to add new module with correct jars:
- Create new directory $JBOSS_HOME/modules/system/layers/base/ibm/wsmq/main
- Create file module.xml in$JBOSS_HOME/modules/system/layers/base/ibm/wsmq/main directory which links all the jar files (not sure if all of the jars are needed):
<?xml version="1.0" encoding="UTF-8"?>
<module xmlns="urn:jboss:module:1.1" name="ibm.wsmq">
<resources>
<resource-root path="remote-object-factory-ibmmq-1.0.jar"/> <!-- jar file with the created object factory -->
<resource-root path="mqcontext.jar"/>
<resource-root path="dhbcore.jar"/>
<resource-root path="com.ibm.mqjms.jar"/>
<resource-root path="com.ibm.mq.pcf.jar"/>
<resource-root path="com.ibm.mq.jmqi.jar"/>
<resource-root path="com.ibm.mq.jar"/>
<resource-root path="com.ibm.mq.headers.jar"/>
<resource-root path="com.ibm.mq.commonservices.jar"/>
</resources>
<dependencies>
<module name="javax.api"/>
<module name="javax.resource.api"/>
<module name="javax.validation.api"/>
<module name="org.hibernate.validator"/>
<module name="org.jboss.as.naming"/>
<module name="org.jboss.as.transactions"/>
<module name="org.jboss.common-core"/>
<module name="org.jboss.jboss-transaction-spi"/>
<module name="org.jboss.ironjacamar.api"/>
<module name="org.jboss.logging"/>
<module name="org.jboss.threads"/>
<module name="javax.xml.stream.api"/>
<module name="javax.jms.api" />
</dependencies>
</module>- Copy all jars from <resources> to $JBOSS_HOME/modules/system/layers/base/ibm/wsmq/main
If it's still not working try to edit $JBOSS_HOME/modules/system/layers/base/org/jboss/as/messaging/main/module.xml and add into <dependencies>:
<module name="
ibm.wsmq
"/>Hopefully this gets you further.
Cheers,
Mirek
-
2. Re: JBOSS 7 JMS Bridge, connect HornetQ to Webpsphere MQ
matvei Jul 19, 2013 10:06 AM (in response to mnovak)Thanks, I'll try these classes, but at the moment I use Websphere JCA ResourceAdapter, have no idea how integrate it inside "source/context" of JMS Bridge. The config for this rar looks like:
standalone.xml
<subsystem xmlns="urn:jboss:domain:resource-adapters:1.0"> <resource-adapters> <resource-adapter> <archive> wmq.jmsra.rar </archive> <connection-definitions> <connection-definition class-name="com.ibm.mq.connector.outbound.ManagedConnectionFactoryImpl" jndi-name="java:jboss/IVTCF" enabled="true" use-java-context="true" pool-name="connection-definition" use-ccm="true"> <config-property name="port"> 1421 </config-property> <config-property name="hostName"> mqserver </config-property> <config-property name="channel"> SYSTEM.DEF.SVRCONN </config-property> <config-property name="transportType"> CLIENT </config-property> <config-property name="queueManager"> QM01 </config-property> <pool> <min-pool-size>1</min-pool-size> <max-pool-size>10</max-pool-size> <prefill>false</prefill> <use-strict-min>false</use-strict-min> </pool> <security> <application/> </security> </connection-definition> </connection-definitions> <admin-objects> <admin-object class-name="com.ibm.mq.connector.outbound.MQQueueProxy" jndi-name="java:jboss/Updates" enabled="true" use-java-context="true" pool-name="Updates"> <config-property name="baseQueueName"> Updates </config-property> </admin-object> </admin-objects> </resource-adapter> </resource-adapters> </subsystem>
And aftewards I may use this "Updates" queue for my MDB:
@MessageDriven( name="UpdateCheck", activationConfig = { @ActivationConfigProperty(propertyName = "messagingType",propertyValue="javax.jms.MessageListener"), @ActivationConfigProperty(propertyName = "destinationType",propertyValue = "javax.jms.Queue"), @ActivationConfigProperty(propertyName = "destination", propertyValue = "java:jboss/Updates"), @ActivationConfigProperty(propertyName = "useJNDI", propertyValue = "true"), @ActivationConfigProperty(propertyName = "maxMessages", propertyValue = "1"), @ActivationConfigProperty(propertyName = "channel", propertyValue = "SYSTEM.DEF.SVRCONN"), @ActivationConfigProperty(propertyName = "hostName", propertyValue = "mqserver"), @ActivationConfigProperty(propertyName = "queueManager", propertyValue = "QM01"), @ActivationConfigProperty(propertyName = "port", propertyValue = "1421"), @ActivationConfigProperty(propertyName = "transportType", propertyValue = "CLIENT") }) @ResourceAdapter("wmq.jmsra.rar") public class Updates extends BasicMDB implements MessageListener { ..}
-
3. Re: JBOSS 7 JMS Bridge, connect HornetQ to Webpsphere MQ
jbertram Jul 19, 2013 10:18 AM (in response to matvei)If you have an MDB which can consume from WebSphereMQ and an outbound connection factory which can send to WebSphereMQ then why do you need/want the JMS bridge?
In any case, the JMS bridge doesn't use a JCA RA so none of your current configuration really applies to it. The JMS bridge connects to a provider just like a standalone remote client would. In other words it uses JNDI to look up the connection factory and destination and then uses the JMS API to send/receive messages. Of course, every vendor implements JNDI differently so each needs unique InitialContext parameters. That is what the <context> for the <source> and <target> are for on the bridge. The entries here would be the same kind of entries used from a remote standalone JMS client.
-
4. Re: JBOSS 7 JMS Bridge, connect HornetQ to Webpsphere MQ
matvei Jul 19, 2013 3:52 PM (in response to jbertram)I just want to detouch the application from MQ configuration. If I use ejb3 deployment descriptor - I can use jboss system properties to inject there config parameters, but the problem is, that I want to use Camel XML Spring config to send messages to different destinations and than inject this bean into Session Bean or MDB. In such a case I can simpy call the method "sendMessageToTheSecondQueue(Message m)" or "sendMessageToTheThirdQueue(Message m)". Camel takes the delivery liability and I can route/change the messages if necessary. Spring searches for the file "businesBeans.xml" and I can not inject there (at least in Jboss 7.2) any system properties, that means that I have to hardcode connection parameters inside EAR archive and that's absolute "no go" for the packaging system we use...
Thanks for the hint abour Bridge approach. I will try to use standard classes, hope that will work.
-
5. Re: JBOSS 7 JMS Bridge, connect HornetQ to Webpsphere MQ
phamtuanchip Mar 25, 2014 9:40 PM (in response to matvei)Hi Matteo Ts,
I also have a task to make hornetq work with MQ then, I would like to now that using Bridge approach is correct way ?. and do you have any specific code example can share.
Thank you in advanced
-
6. Re: JBOSS 7 JMS Bridge, connect HornetQ to Webpsphere MQ
jbertram Mar 25, 2014 10:41 PM (in response to phamtuanchip)Both the JMS bridge and the WebSphereMQ JCA Resource Adapter can be used to integrate. Neither is necessarily "correct." It really depends on your use-case.
-
7. Re: JBOSS 7 JMS Bridge, connect HornetQ to Webpsphere MQ
phamtuanchip Mar 26, 2014 5:57 AM (in response to jbertram)Thank Justin Bertram for the answers, I will investigate more my case and maybe ask in detail.
regard.