user manual

218 BES Developers Guide
Error Recovery
consumption of a message, then you should consider deploying a queue
rather than a topic.
Error Recovery
The following section deals with JMS server connection failures and setting
connection rebind attempt properties. It also covers the redelivery of
messages to the JMS service when an MDB fails to consume a message. The
section on redelivery covers setting the redeliver attempt property as well as
two properties for delivering messages to a dead queue.
Rebinding
A connection failure usually occurs after you deploy your bean, causing a
need for rebind attempt. You also receive an error if you are trying to deploy
your bean and a connection to the JMS server was never established.
Whether a failure occurs post deployment or no connection was found during
deployment, the container will transparently attempt to rebind the JMS service
provider connection when you set the rebind attempt properties. This ensures
even greater fault-tolerance from an MDB instance.
The two bean-level properties that control the number of rebind attempts
made and the time interval between attempts are:
ejb.mdb.rebindAttemptCount: this is the number of times the EJB Container
tries to re-establish a failed JMS connection for this MDB. The default value
is 5 (five).
To make the container attempt to rebind infinitely you need to explicitly
specify ejb.mdb.rebindAttemptCount=0.
ejb.mdb.rebindAttemptInterval: the time in seconds between successive
retry attempts. The default value is 60.
Redelivered messages
Should the MDB fail to consume a message for any reason, the message will
be re-delivered by the JMS service. The message will only be re-delivered five
times. After five attempts, the message will be delivered to a dead queue (if
one is configured). There is one bean-level property that controls the re-deliver
attempt count:
ejb.mdb.maxRedeliverAttemptCount: the max number of times a message will
be re-delivered by the JMS service provider if an MDB is unable to
consume it. The default value is 5.
There are two bean-level properties for delivering a message to a dead queue:
ejb.mdb.unDeliverableQueueConnectionFactory: looks up JNDI name for the
connection factory to create connection to the JMS service.