Durable Subscriptions with MDBs

Discussion in 'Java' started by GCampolo, Oct 4, 2004.

  1. GCampolo

    GCampolo Guest

    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
     
    GCampolo, Oct 4, 2004
    #1
    1. Advertising

  2. GCampolo

    David Hilsee Guest

    "GCampolo" <> wrote in message
    news:...
    > 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.

    --
    David Hilsee
     
    David Hilsee, Oct 5, 2004
    #2
    1. Advertising

  3. GCampolo

    David Hilsee Guest

    "David Hilsee" <> wrote in message
    news:eek:...
    <snip>
    > 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.

    --
    David Hilsee
     
    David Hilsee, Oct 5, 2004
    #3
  4. GCampolo

    GCampolo Guest

    "David Hilsee" <> wrote in message news:<>...
    > 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.
     
    GCampolo, Oct 5, 2004
    #4
  5. GCampolo

    David Hilsee Guest

    "GCampolo" <> wrote in message
    news:...
    > "David Hilsee" <> wrote in message

    news:<>...
    > > 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.


    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.

    --
    David Hilsee
     
    David Hilsee, Oct 6, 2004
    #5
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    0
    Views:
    295
  2. Jazil
    Replies:
    2
    Views:
    1,756
    Owen Jacobson
    Jun 15, 2008
  3. Douglas Livingstone

    Number formatting + subscriptions

    Douglas Livingstone, Apr 1, 2005, in forum: Ruby
    Replies:
    2
    Views:
    123
    Douglas Livingstone
    Apr 1, 2005
Loading...

Share This Page