Oracle® Containers for J2EE Enterprise JavaBeans Developer's Guide 10g (10.1.3.5.0) Part Number E13981-01 |
|
|
View PDF |
You can configure how a message-driven bean's listener thread responds to connection failures due to such events as network and JMS server outages.
These options are applicable to only container-managed transactions in a message-driven bean.
You can configure connection failure recovery options using OC4J-proprietary annotations (see "Using Annotations") or using the orion-ejb-jar.xml
file (see "Using Deployment XML").
For more information, see:
How you configure this option depends on the type of message-service provider you are using:
Accessing a Message Service Provider Using a J2CA Resource Adapter
Accessing a Message Service Provider Without Using a J2CA Resource Adapter
Accessing a Message Service Provider Using a J2CA Resource Adapter
If you access your message-service provider using a J2CA resource adapter, the Oracle JMS Connector does an infinite retry of polling for the JMS resource and this retry interval can be configured in the activation config property, EndpointFailureRetryInterval
as Example 10-5 shows.
Note that the recovery of message after retry does not guarantee message ordering, and messages can be lost or duplicated when MDB subscription to the JMS topic is non-durable.
For more information, see EndpointFailureRetryInterval
in Table B-2.
Example 10-7 Configuring Connection Failure Recovery for a J2CA Adapter Message Service Provider
import javax.ejb.MessageDriven; import oracle.j2ee.ejb.MessageDrivenDeployment; import javax.ejb.ActivationConfigProperty; import javax.jms.Message; import javax.jms.MessageListener; @MessageDriven( activationConfig = { @ActivationConfigProperty( propertyName="EndpointFailureRetryInterval", propertyValue="20000" ), ... } ) @MessageDrivenDeployment( resourceAdapter = "OracleASjms", ... ) public class JCAQueueMDB implements MessageListener { public void onMessage(Message msg) { ... } }
Accessing a Message Service Provider Without Using a J2CA Resource Adapter
If you access your message-service provider directly (without using a J2CA resource adapter), set OC4J-proprietary annotation @MessageDrivenDeployment
attributes dequeueRetryCount and dequeueRetryInterval as Example 10-8 shows.
For more information on this @MessageDrivenDeployment
attribute, see Table A-3. For more information on the @MessageDrivenDeployment
annotation, see "Configuring OC4J-Proprietary Deployment Options on an EJB 3.0 MDB".
Note:
Oracle recommends that you access a message service provider using a J2CA resource adapter such as the Oracle JMS Connector. For more information, see:Example 10-8 Configuring Connection Failure Recovery for a Non-J2CA Adapter Message Service Provider
import javax.ejb.MessageDriven; import oracle.j2ee.ejb.MessageDrivenDeployment; import javax.jms.Message; import javax.jms.MessageListener; @MessageDriven( ... ) @MessageDrivenDeployment( dequeueRetryCount=3, dequeueRetryInterval=90 ) public class QueueMDB implements MessageListener { public void onMessage(Message msg) { ... } }
For an EJB 3.0 message-driven bean, you configure the dequeue retry in the orion-ejb-jar.xml
file as you would for an EJB 2.1 message-driven bean (see "Using Deployment XML").