Remote JBoss JMS Queue?

I want to send messages to a remote queue? What steps should I take I can not find documentation about this? can anyone help?

+5
source share
2 answers

Add another "JMSProvider" to your $ {JBOSS_CONF} /deploy/messaging/jms-ds.xml. I use the provider name "RemoteJMSProvider" in this example:

<!-- Remote JMS Server-->
<mbean code="org.jboss.jms.jndi.JMSProviderLoader"
  name="jboss.mq:service=JMSProviderLoader,name=RemoteJMSProvider,server=your_remote_host">
    <attribute name="ProviderName">RemoteJMSProvider</attribute>
    <attribute name="ProviderAdapterClass">org.jboss.jms.jndi.JNDIProviderAdapter</attribute>
    <!-- The connection factory -->
    <attribute name="FactoryRef">XAConnectionFactory</attribute>
    <!-- The queue connection factory -->
    <attribute name="QueueFactoryRef">XAConnectionFactory</attribute>
    <!-- The topic factory -->
    <attribute name="TopicFactoryRef">XAConnectionFactory</attribute>
    <!-- Connect to JNDI on the host "the-remote-host-name" port 1099-->
    <attribute name="Properties">
       java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
       java.naming.factory.url.pkgs=org.jnp.interfaces
       java.naming.provider.url=your_remote_host:1099
    </attribute>

Then add “Factory Remote Connection”:

<tx-connection-factory>
  <jndi-name>RemoteJMSConnectionFactory</jndi-name>
  <xa-transaction/>
  <rar-name>jms-ra.rar</rar-name>
  <connection-definition>org.jboss.resource.adapter.jms.JmsConnectionFactory</connection-definition>
  <config-property name="SessionDefaultType" type="java.lang.String">javax.jms.Queue</config-property>
  <config-property name="JmsProviderAdapterJNDI" type="java.lang.String">java:/RemoteJMSProvider</config-property>
  <max-pool-size>20</max-pool-size>
  <security-domain-and-application>JmsXARealm</security-domain-and-application>
  <depends>jboss.messaging:service=ServerPeer</depends>

Now, when you create a factory link to "RemoteJMSFactory", any link to your queue will be viewed on the remote server:

ConnectionFactory factory =(ConnectionFactory)JNDIContext.lookup("java:/RemoteJMSConnectionFactory");
queue = (Destination) JNDIContext.lookup("queue/myqueue");
connection = factory.createConnection();
session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
MessageProducer sender = session.createProducer(queue);
sender.send(jmsMessage);

See also: http://community.jboss.org/wiki/HowDoIConfigureAnMDBToTalkToARemoteQueue

+6

/ jboss. , , - , JNDI .

0

All Articles