users@glassfish.java.net

Re: how can I connect remote JMS Queues?

From: Jon Faldmo <jfaldmo_at_gmail.com>
Date: Thu, 19 Feb 2009 11:00:26 -0700

I am currently finishing up a project that provides one MQ broker to
multiple applications/clusters. I don't have the original references I read
to get it setup but hopefully my notes will be helpful to you.

What I did in the glassfish configuration was-- configured a new JMS host,
change the JMS service type from "local" to "Remote", started the remote
broker, and restarted the clusters.

Here are some examples of the asadmin commands I used. You can make these
changes through the Admin Server as well.
asadmin create-jms-host --user admin --passwordfile .DomainPasswords
--target clusterName-config --mqhost svrName --mqport 6769 svrNameBroker1
asadmin delete-jms-host --user admin --passwordfile .DomainPasswords
--target clusterName-config default_JMS_host
asadmin set --user admin --passwordfile .DomainPasswords
clusterName-config.jms-service.default-jms-host="svrNameBroker1"
asadmin set --user admin --passwordfile .DomainPasswords
clusterName-config.jms-service.type="REMOTE"

Of course you will have to modify the target name, mqhost name (the server
name the broker is running on,) I believe the referece to svrNameBroker1 is
arbitrary, and I believe the port was taken from another example so you can
choose a unique port if wanted.


Then on the server were I wanted the mq broker to be running I just created
a little script that I run to start the broker.
#!/bin/ksh
nohup /usr/bin/imqbrokerd -tty -name svrNameBroker1 -port 6769
1>/tmp/logs/svrNameBroker1.log 2>&1 &
print $! > broker1.pid

One problem with this script is the log gets really big and I haven't looked
into a good way to rotate it besides restarting everything.

Then I restarted the clusters, which already had the other JMS resource
information configured.

This is not a high availability setup but it was simple to do. I plan on
revisiting the setup to start multiple brokers. Here are the commands I
believe will work--

Start the MQ cluster. The last line is run on a second server.
/usr/bin/imqbrokerd -tty -name brokerm -port 6772 -cluster
svrName:6769,svr2Name:6770 -D"imq.cluster.masterbroker=svrName:6772"
/usr/bin/imqbrokerd -tty -name svrNameBroker1 -port 6769
-D"imq.cluster.masterbroker=svrName:6772" &
/usr/bin/imqbrokerd -tty -name svrName2Broker2 -port 6770
-D"imq.cluster.masterbroker=svrName:6772" &

Configure another JMS host in glassfish
asadmin create-jms-host --user admin --passwordfile .DomainPasswords
--target clusterName-config --mqhost svrName2 --mqport 6770 svrName2Broker2

Please feel free to critique this setup and let me know if there is a better
way to do something above.

--Jon

On Wed, Feb 18, 2009 at 2:23 PM, <glassfish_at_javadesktop.org> wrote:

> So far I've only been running JMS queues inside a single instance of
> Glassfish, but now I need to publish to a queue on one host and have it
> picked up on another host also running Glassfish.
>
> What is the simplest way to make this work?
>
> Currently I am using Spring's JmsTemplate to publish and
> MessageListenerAdapter with DefaultMessageListenerContainer to listen.
> [Message sent by forum member 'brian_of_fortent' (brian_of_fortent)]
>
> http://forums.java.net/jive/thread.jspa?messageID=332757
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_glassfish.dev.java.net
> For additional commands, e-mail: users-help_at_glassfish.dev.java.net
>
>