简体   繁体   中英

How to send message to JMS server from one machine and receive that from another machine in JBoss 7

I am trying to send message(TextMessage) to JMS server from my laptop, then I am trying to receive that message from another laptop. I am using JBoss AS 7.1 . My both laptops are connected in same network.

When I am doing that I am getting exception. I searched for this in google and some is saying that in JBoss 7.1 JNDI will not get connections from remote IP's and they are saying that we have to use HornetQ .

Can any one please help in this issue.

Looks like you have two queues, one on each machine. They only have the same name, but are not connected in any way. You could make the sender machine use the remote queue directly, but it's advisable to use (like you have) two queues instead, one on each node, and then configure a bridge to move the messages from one to the other. In this way, sending as well as receiving messages will work within your local transactions, which is what you'll normally want.

In order to configure the bridge, HornetQ offers two options: A generic JMS bridge, and a core bridge. The former is generic, as it can bridge between JMS queues of any JMS provider. But the HornetQ docs recommend core bridges when using HornetQ on both sides, as they are faster and more robust.

The JBoss docs (the section "JMS Bridge"), describes the setup for a JMS-Bridge using the CLI. The HornetQ docs for core bridges describes the stand alone setup (outside of the JBoss server); converting that to CLI, you'll get (replace the parts in curly brackets with your values):

/subsystem=messaging/hornetq-server=default/bridge={bridge-name}:add(queue-name="{queue-name}", forwarding-address="{remote-hostname}", static-connectors=["http-acceptor"])

To see a brief description of all parameters, use this command:

/subsystem=messaging/hornetq-server=default/bridge=x:read-resource-description

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM