Durable Subscriptions with MDBs

G

GCampolo

Hi all!

I asked this question already a couple of weeks ago in the Sun forums
but got no reply...I hope that someone can help me there...

I have set up one TopicConnectionFactory and one Topic. A component
sends a JMS message to the JMS server.
Several message driven beans are listening on the same topic but they
all have a different Message Selector,
so depending on that the messages are consumed by the respective MDB.
This does work perfectly fine, but now
I want the MDBs to be durable subscribers for the topic. I thought it
would be possible to set the 'Durable
Subscription' option in deploy tool with each MDB having another
Subscription name. Additionally I added the
property (ClientId, MyID) to the TopicConnectionFactory in the JMS
settings for the AppServer. But if I have
more than one MDB an exception is thrown during deployment, if I only
deploy one MDB it does work.

So now, my question is: is it possible at all to have more than one
durable subscribers for only
TopicConnectionFactory and Topic or not? And if it would be possible
what am I doing wrong? How can
else solve my problem?

Thanks in advance
 
D

David Hilsee

GCampolo said:
Hi all!

I asked this question already a couple of weeks ago in the Sun forums
but got no reply...I hope that someone can help me there...

I have set up one TopicConnectionFactory and one Topic. A component
sends a JMS message to the JMS server.
Several message driven beans are listening on the same topic but they
all have a different Message Selector,
so depending on that the messages are consumed by the respective MDB.
This does work perfectly fine, but now
I want the MDBs to be durable subscribers for the topic. I thought it
would be possible to set the 'Durable
Subscription' option in deploy tool with each MDB having another
Subscription name. Additionally I added the
property (ClientId, MyID) to the TopicConnectionFactory in the JMS
settings for the AppServer. But if I have
more than one MDB an exception is thrown during deployment, if I only
deploy one MDB it does work.

So now, my question is: is it possible at all to have more than one
durable subscribers for only
TopicConnectionFactory and Topic or not? And if it would be possible
what am I doing wrong? How can
else solve my problem?

My instinct tells me that each of your MDBs is durably subscribing using the
same client ID but different connections, which may be giving your JMS
provider fits. From the J2EE javadocs for
javax.jms.Connection.setClientID():

"If another connection with the same clientID is already running when this
method is called, the JMS provider should detect the duplicate ID and throw
an InvalidClientIDException."

Have you tried using a different TopicConnectionFactory for each MDB? If
this isn't the problem, then stack trace or some other more detailed
explanation of the problem may help.
 
D

David Hilsee

My instinct tells me that each of your MDBs is durably subscribing using the
same client ID but different connections, which may be giving your JMS
provider fits. From the J2EE javadocs for
javax.jms.Connection.setClientID():

"If another connection with the same clientID is already running when this
method is called, the JMS provider should detect the duplicate ID and throw
an InvalidClientIDException."

Have you tried using a different TopicConnectionFactory for each MDB? If
this isn't the problem, then stack trace or some other more detailed
explanation of the problem may help.

To be 100% clear, I mean different TopicConnectionFactories, each with a
unique client ID. So, for example, one MDB would have a TCF with a client
ID of "MDB1", the next would have a TCF with a client ID of "MDB2", etc.
 
G

GCampolo

David Hilsee said:
To be 100% clear, I mean different TopicConnectionFactories, each with a
unique client ID. So, for example, one MDB would have a TCF with a client
ID of "MDB1", the next would have a TCF with a client ID of "MDB2", etc.

Yes, I tried it with different TopicConnectionFactories and this did
work. What I wanted to know was if this is the only way to do it. From
what I read until now it really seems that for each "Durable MDB" one
seperate TCF has to be set up. I thought that maybe the option
"SubscriptionName" in deploytool from the SUN application server would
allow to register more than durable subscriber to one TCF.
 
D

David Hilsee

GCampolo said:
"David Hilsee" <[email protected]> wrote in message

Yes, I tried it with different TopicConnectionFactories and this did
work. What I wanted to know was if this is the only way to do it. From
what I read until now it really seems that for each "Durable MDB" one
seperate TCF has to be set up. I thought that maybe the option
"SubscriptionName" in deploytool from the SUN application server would
allow to register more than durable subscriber to one TCF.

The subscription name is different from the client ID, and changing it
shouldn't affect your problem. From what I can tell, the problem is that
the application server is establishing a connection for each MDB, and each
connection has the same client ID, which is not allowed. I don't use Sun's
application server, so I don't have an answer for this. It seems to me that
you want to find a way for all three MDBs to share the same connection to
the JMS provider, and I wouldn't know how to do that using that product.
Heck, I don't think I know if it's possible the application server I'm
currently using.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,756
Messages
2,569,535
Members
45,008
Latest member
obedient dusk

Latest Threads

Top