users@glassfish.java.net

Re: Sending messages between two different Glassfish instances

From: Nigel Deakin <Nigel.Deakin_at_Sun.COM>
Date: Mon, 02 Nov 2009 10:56:12 +0000

Nils,

Nils wrote:
>
> However I'm still a bit confused by your answer. In order to send a
> JMS message from one appserver to another (which are not clustered) I
> need to:
>
> 1. Add the AddressList property to the ConnectionFactory which is used
> for sending: mq://recievingHost:7676
>
> 2. Then I need to add the following annotation to the MDB receiving
> this message:
>
> @ActivationConfigProperty(propertyName = "addressList",
> propertyValue = "mq://sendingHost:7676")

No. The thing to keep in mind is that with two unclustered instances, you have to decide which one is going to handle
(and store) the messages, and then configure both sender (connection factory) and consumer (activation spec) to point to
the instance you choose.

Note that the sender and receiver don't need to know where the messages are originating (that's a basic principle of
JMS). However they do need to know where the MQ broker (which runs within the Glassfish instance) that will handle them
is running.

So, if you choose to use "sendingHost" to handle the messages, you need to configure *both* connection factory and
activation spec to point to "sendingHost".

So, if you choose to use "receivingHost" to handle the messages, you need to configure *both* connection factory and
activation spec to point to "receivingHost".

In practice, since a connection factory and activation spec point by default to their local instance, so you only need
to configure the one that is pointing to the "other" instance.

I hope this is clearer!

> Is there a way to check
> whether the message is stuck in the application server and why I could
> not be delivered?

Yes. You can use the imqcmd command (located in the imq/bin or mq/bin directory under your glassfish installation) to
list the destinations (queues and topics) on a MQ broker, and the numbers of messages in each.

Here's an example. Note that you need to specify which broker you wish to report on (in this case localhost port 7676):

----------------------------------------------------------------------------------------------------
C:\Sun\glassfish-2.1.1-b29\imq\bin>imqcmd list dst -b localhost:7676
Username: admin
Password: admin
Listing all the destinations on the broker specified by:

-------------------------
Host Primary Port
-------------------------
localhost 7676

---------------------------------------------------------------------------------------------------
       Name Type State Producers Consumers Msgs
                                    Total Wildcard Total Wildcard Count Remote UnAck Avg Size
---------------------------------------------------------------------------------------------------
mq.sys.dmq Queue RUNNING 0 - 0 - 0 0 0 0.0
testQueue Queue RUNNING 0 - 0 - 5163 0 0 172.0
testTopic Topic RUNNING 0 0 1 0 0 0 0 0.0

Successfully listed destinations.
----------------------------------------------------------------------------------------------------

imqcmd is documented here:
http://docs.sun.com/app/docs/doc/820-6740/aeonj?l=en&a=view

Nigel



>
> Since every MDB has a queue assigned, is this somehow related to the
> properties of the concerning queue? I still couldn't get it to work,
> is there anything else that I can check? Is there a way to check
> whether the message is stuck in the application server and why I could
> not be delivered?
>
> Nils
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_glassfish.dev.java.net
> For additional commands, e-mail: users-help_at_glassfish.dev.java.net
>