• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Doubts on MDB's

 
Ranch Hand
Posts: 372
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Got a few questions on MDB's this time !!

1. What tag do you use in the DD of an MDB to say which queue / topic you are listening to / subscribing to? The HFEJB book just talks about the tag <message-driven-destination> with the <destination-type> sub-element that says whether this bean listens to a topic or queue. How do you say WHICH queue / topic you are listening to? If it's a topic, what tag do you use to say whether your subscription is durable / non-durable. Surprised that this is not covered in the HFEJB

2. Is it possible for the same MDB to subscribe to many topics / listen to many queues?

3. Are the message acknowledgement rules the same for topics and queues? ie for CMT beans, message acknowledgement is tied to the transaction status and for BMT beans, message acknowledgement is tied to the method completion status. Does this hold good for topics as well? What about the <acknowledge-mode> tag for BMT beans with Auto-acknowledge and Dups-ok-acknowledge values? Does that hold good for topics as well? The HFEJB book talks only about message acknowledement related to queues.
 
Ranch Hand
Posts: 90
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
#1) This is done to make MDBs portable across app servers. The DD only states if the destination is a queue or a topic but does not state the specific queue/topic. The actual names of the topics/queues deployed into the JMS server are app-server specific and therefore the mapping of the container to a specific JMS destination happens in the app-server specific deployment descriptor.

#2) Deploy the MDB multiple times � once as a consumer of Queue1 and once as a consumer of Queue2.

#3) Queue and Topic are message destinations for the point-to-point and publish-subscribe message delivery models respectively. The mode of acknowledgement applies not only to Queues but also to Topics. Topics have an additional facility of stating the durability of the subscription.
 
B.Sathish
Ranch Hand
Posts: 372
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Ram, that sounds reasonable

1. Is the message-driven-destination tag optional or mandatory in the ejb-jar.xml? The spec said that the bean provider may tell the deployer whether the bean in using a topic or a queue. I guess, it should be optional, just wanted to confirm.

2. I read in the spec that if the subscription-durability is not specified for an MDB subscribing to a topic, the default is non-durable. I am a bit surprised about this. Should the default not be durable? Can someone think of a reason why the spec designers decided to keep the default as non-durable, given the fact that mostly durable topic subscriptions are used?

Thanks
 
Ramakrishnan Viswanathan
Ranch Hand
Posts: 90
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
#1) The <message-driven-destination> is optional - however if mentioned, then <destination-type> is mandatory.

#2) I do not know the answer to this. My only guess here is that a durable subscription has an overhead due to the increased reliability that it provides. So if you really dont mind about messages getting missed, you wouldn't make the subscription durable. If someone could give a better explanation, it would really help.
 
B.Sathish
Ranch Hand
Posts: 372
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Great, that clears up the MDB chapter for me !
 
reply
    Bookmark Topic Watch Topic
  • New Topic