Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Question on MessageDriven Beans

 
Joe Harry
Ranch Hand
Posts: 10124
3
Eclipse IDE Mac PPC Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What would a subscriptionDurability mean in an MDB? Why this property is not applicable for Messages that listen to a Queue?
 
Sergio Tridente
Ranch Hand
Posts: 329
Java Linux Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Jothi,

Accordingly to section 5.4.2 of the ejb core specification:


If the message-driven bean class implements more than one interface other than java.io.Serializable, java.io.Externalizable, or any of the interfaces defined by the javax.ejb package, the message listener interface must be specified by the messageListenerInterface element of the MessageDriven annotation or the messaging-type element of the message-driven deployment descriptor element.
 
Joe Harry
Ranch Hand
Posts: 10124
3
Eclipse IDE Mac PPC Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sergio,

Your reply does not have a relationship to what I asked originally!
 
Sergio Tridente
Ranch Hand
Posts: 329
Java Linux Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sorry, wrong topic.

(BTW, both topics have the same title.)
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
First, the publish/subscribe concept is related to Topics, not to Queue. Many clients subscribe to a topic and are notified when the topic they have subscribed to has arrived. So, the subscriptionDurability is related to Topics, not Queues.

I've never tried the subscriptionDurability attribute, so I can only quote the spec 5.4.16.1 JMS Message-Driven Beans :

The property name used to specify whether a durable or non-durable subscription should be used is subscriptionDurability. The value for this property must be either Durable or NonDurable for a JMS message-driven bean. If a topic subscription is specified and subscriptionDurability is not specified, a non-durable subscription is assumed.
  • Durable topic subscriptions, as well as queues, ensure that messages are not missed even if the EJB server is not running. Reliable applications will typically make use of queues or durable topic subscriptions rather than non-durable topic subscriptions.
  • If a non-durable topic subscription is used, it is the container�s responsibility to make sure that the message driven bean subscription is active (i.e., that there is a message driven bean available to service the message) in order to ensure that messages are not missed as long as the EJB server is running. Messages may be missed, however, when a bean is not available to service them. This will occur, for example, if the EJB server goes down for any period of time.

  •  
    Joe Harry
    Ranch Hand
    Posts: 10124
    3
    Eclipse IDE Mac PPC Ubuntu
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    Thanks Christophe!
     
    • Post Reply
    • Bookmark Topic Watch Topic
    • New Topic