In the The Java EE 6 Tutorial, Chapter 17 A Message-Driven Bean Example , I came across this:
@MessageDriven(mappedName="jms/Queue", activationConfig = {
@ActivationConfigProperty(propertyName = "acknowledgeMode",
propertyValue = "Auto-acknowledge"),
@ActivationConfigProperty(propertyName = "destinationType",
propertyValue = "javax.jms.Queue")
})
public class SimpleMessageBean implements MessageListener {
@Resource
private MessageDrivenContext mdc;
...
Since the MDB is transacted - (default value for transaction attributes points to TransactionAttributeType.REQUIRED
and TransactionManagementType.CONTAINER)
)
how makes @ActivationConfigProperty(propertyName = "acknowledgeMode", propertyValue = "Auto-acknowledge")
any sence?
In Controlling Message Acknowledgment I read
In transacted sessions (see Using JMS API Local Transactions), acknowledgment happens automatically when a transaction is committed. If a transaction is rolled back, all consumed messages are redelivered.
This got me confused; I would expect not to declare acknowledgeMode here (since we are in a transacted session)