Mini-Howto: MDB listens on remote topic hosted by another jb
jieshengz Feb 9, 2004 11:47 PMSuppose you have two JBoss instances. Instance A hosts the JMS.
Instance B hosts the MDB. The above rule still apply.
You need to modify the jbossmq-state.xml and jbossmq-destinations-server.xml associated with instance A.
The ejb.jar containing ejb-jar.xml and jboss.xml is deployed to instance B.
Right now, we need to configure the instance B to listen the JMS hosted by A for this particular MDB.
1. configure instance B to listen on the JMS hosted by A
Add this mbean to $JBOSS/server/default/deploy/jms/jms-ds.xml
<attri bute name="ProviderName">RemoteJMSProvider</attri bute>
<attri bute name="ProviderAdapterClass">org.jboss.jms.jndi.JBossMQProvider</attri bute>
<!-- instance A IP and JNDI port -->
<attri bute name="ProviderUrl">192.168.1.10:1099</attri bute>
<!-- this JBOSS instance will connect the remote JMS server through the
OILServerILService invocation layer or UILServerILService invocation layer.
This connection is defined in the remote server's $JBOSS/server/default/deploy/jms/oil-service.xml
or uil2-service.xml
Use UIL2XAConnectionFactory first since UIL does not need to open socket back to client. There is no
firewall implication.
After you succeed with UIL, you can try OIL.
-->
<attri bute name="QueueFactoryRef">UIL2XAConnectionFactory
<attri bute name="TopicFactoryRef">UIL2XAConnectionFactory
]]
2. use this JMSProvider for this MDB.
edit the jboss.xml associated together with the MDB. In this example file, the MDB uses a special
invoker which connects to remote JMS.
<![CDATA[
<enterprise-beans>
<message-driven>
<ejb-name>NodePathModListener</ejb-name>
<destination-jndi-name>topic/StoreEventTopic</destination-jndi-name>
<mdb-user>share</mdb-user>
<mdb-passwd>share</mdb-passwd>
<mdb-client-id>nodePathMDB</mdb-client-id>
<mdb-subscription-id>nodePathMDBName</mdb-subscription-id>
<invoker-bindings>
<invoker-proxy-binding-name>shareBinding</invoker-proxy-binding-name>
</invoker-bindings>
</message-driven>
</enterprise-beans>
<invoker-proxy-bindings>
<invoker-proxy-binding>
shareBining
<invoker-mbean/>
<proxy-factory>org.jboss.ejb.plugins.jms.JMSContainerInvoker</proxy-factory>
<proxy-factory-config>
<!-- use the remote JMS provider -->
<JMS ProviderAdapterJNDI>RemoteJMSProvider</JMS ProviderAdapterJNDI>
<Server SessionPoolFactoryJNDI>StdJMSPool</Server SessionPoolFactoryJNDI>
<Maximum Size>15</Maximum Size>
<Max Messages>1</Max Messages>
<MDB Config>
<Re connectIntervalSec>10</Re connectIntervalSec>
<DLQ Config>
<Destination Queue>queue/DLQ</Destination Queue>
<Max TimesRedelivered>10</Max TimesRedelivered>
<Time ToLive>0</Time ToLive>
</DLQ Config>
</MDB Config>
</proxy-factory-config>
</invoker-proxy-binding>
</invoker-proxy-bindings>
]]