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.
#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.
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?
Joined: Aug 24, 2005
#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.