users@glassfish.java.net

Re: Possibilities to configure JMS in Glassfish. Problem ...

From: Nigel Deakin <nigel.deakin_at_oracle.com>
Date: Thu, 15 Dec 2011 17:37:42 +0000

On 15/12/2011 14:32, forums_at_java.net wrote:
> Thank you for your reply.
>
> I was trying to distribute message across cluster in the way that you said
> and that Glassfish will do that by default.
>
> Servlet to send messages: pastebin.com/1Di0BZsj [1]
>
> MDB to receive messages: pastebin.com/n87raeZw [2]

That's all fine.

>
> MyConnectionFactory and MyTopic are enabled on cluster and server. I've
> missed something in configuration ? Or maybe I should do it in a different
> way.

You don't say what your problem is. First thing to check is that you've configured your connection factory on "server"
to connect to the cluster (otherwise it will connect to the JMS broker in "server", which is not part of the cluster).
You'll need to configure its "addressList" property to the host and JMS port of one of the instances in the cluster
using a format mq://hostname:1234/jms where you need to replace "1234" with the *JMS* port used by that instance.

(If you want, you can also set this to a list of all the instances in the cluster, and configure the addressListBehavior
property to be RANDOM so each connection uses a random instance, but you can skip this for now).

Connection factory properties are listed here:
http://docs.oracle.com/cd/E18930_01/html/821-2438/aeoop.html

It's best to leave the connection factory on the cluster to use the default value of "addressList" property.

Try that, send some messages and you should see messages being received by your MDB. If you only send one or two
messages they will probably be received by MDBs on the instance you mentioned in the addressList. However if you
increase the number of messages you should see messages being processed on all the instances.

When you've got that far please report back and we can discuss the next step.

Nigel