users@glassfish.java.net

Re: Using JMS for duplex communication

From: Nigel Deakin <nigel.deakin_at_oracle.com>
Date: Tue, 18 Jan 2011 18:21:36 +0000

Peter,

On 18/01/2011 16:38, Major Péter wrote:
> Hi,
>
>> By default, applications will connect to the JMS broker defined in the
>> JMS service configuration (in your examples, either the embedded broker
>> or the remote broker). You can also override this on a per-connection
>> basis by configuring the connection factory explicitly. So it sounds as
>> if you've basically got it right.
>
> How can I configure a MDB to use a given connectionfactory?

In sun-ejb-jar.xml, you can define a <mdb-connection-factory> element, though you can't do that using annotation.

Fortunately there's no need to specify a connection factory as you can define all the required properties directly on
the "activation spec" using either a deployment descriptor file or annotation.

>
>>> What did I do wrong?
>>
>> Are you asking why setting "AddressList=mq://localhost:7676/jms" in the
>> topic connection factory on your "client app" didn't cause it to receive
>> messages from the "master app" running on a different machine?
>
> it's running on the same machine (since it's just a PoC), so this wasn't the problem.

Ah. I was misled by your words "The 'master' app and the client apps they're all on different machines." :-)

>
>> First thing, you need to replace "localhost" with the hostname on which
>> your "master app" was running.
>>
>> Was this for a MDB? In this case you need to set addressList on the MDB
>> something like this:
>>
>> @MessageDriven(name="foo", mappedName = "bar", activationConfig = {
>> @ActivationConfigProperty(propertyName = "AddressList", propertyValue =
>> "mq://somehost:7676")
>> })
>
> This was the missing part! Thanks!!
> Although I didn't find any documentation where this "magic" property was described (at least not in the EJB 3.0 core
> spec), do you know any doc resource for these properties? (The docs.sun.com links are broken :'( )

Yes, all the docs have moved to oracle.com. That's very recent, so Google still returns old links.

The GlassFish 2.1 and 2.1.1 docs are here:
http://download.oracle.com/docs/cd/E19879-01/index.html

The activation config properies are defined by the message queue resource adapter, and are listed here
http://download.oracle.com/docs/cd/E19879-01/821-0027/aeooq/index.html

The connection factory properties are defined by the message queue resource adapter, are defined here:
http://download.oracle.com/docs/cd/E19879-01/821-0027/aeoop/index.html

Nigel