Oracle® Containers for J2EE Enterprise JavaBeans Developer's Guide 10g (10.1.3.1.0) Part Number B28221-02 |
|
|
View PDF |
You can configure OC4J-proprietary deployment options for an EJB 3.0 message-driven bean using OC4J-proprietary annotations (see "Using Annotations") or using the orion-ejb-jar.xml
file (see "Using Deployment XML").
Configuration in the orion-ejb-jar.xml
file overrides the corresponding configuration made with OC4J-proprietary annotations.
For more information, see "Message Service Configuration Options: Annotations or XML? Attributes or Activation Configuration Properties?".
You can specify OC4J-proprietary deployment options for an EJB 3.0 message-driven bean using the @MessageDrivenDeployment
OC4J-proprietary annotation.
Example 10-16 shows how to configure OC4J-proprietary deployment options for an EJB 3.0 message-driven bean using the @MessageDrivenDeployment
annotation. For more information on @MessageDrivenDeployment
attributes, see Table A-3.
You can override @MessageDriven
annotation activationConfig
attribute settings (see "Configuring an EJB 3.0 MDB to Access a Message Service Provider Using J2CA") by configuring activation configuration properties using @MessageDrivenDeployment
attributes. You can also override annotation configuration using deployment XML (see "Using Deployment XML").
Example 10-16 @MessageDrivenDeployment
import javax.ejb.MessageDriven; import oracle.j2ee.ejb.MessageDrivenDeployment; import javax.ejb.ActivationConfigProperty; import javax.annotation.Resource; @MessageDriven( activationConfig = { @ActivationConfigProperty( propertyName="messageListenerInterface", propertyValue="javax.jms.MessageListener"), @ActivationConfigProperty( propertyName="connectionFactoryJndiName", propertyValue="jms/TopicConnectionFactory"), @ActivationConfigProperty( propertyName="destinationName", propertyValue="jms/demoTopic"), @ActivationConfigProperty( propertyName="destinationType", propertyValue="javax.jms.Topic"), @ActivationConfigProperty( propertyName="messageSelector", propertyValue="RECIPIENT = 'MDB'") } ) @MessageDrivenDeployment( maxInstances=10, poolCacheTimeout=30 ) public class MessageLogger implements MessageListener, TimedObject { @Resource javax.ejb.MessageDrivenContext mc; public void onMessage(Message message) { ... } public void ejbTimeout(Timer timer) { ... } }
You can specify OC4J-proprietary deployment options for a message-driven bean using the orion-ejb-jar.xml
file element <message-driven-deployment>
as Example 10-17 shows. For more information on the <message-driven-deployment>
element, see "<message-driven-deployment>".
Example 10-17 orion-ejb-jar.xml File <message-driven-deployment> Element
<?xml version="1.0" encoding="utf-8"?> <orion-ejb-jar xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://xmlns.oracle.com/oracleas/schema/orion-ejb-jar-10_0.xsd" deployment-version="10.1.3.1.0" deployment-time="10b1fb5cdd0" schema-major-version="10" schema-minor-version="0" > <enterprise-beans> <message-driven-deployment name="MessageLogger" max-instances="10" cache-timeout="30" ... > </message-driven-deployment> ... </enterprise-beans> ... </orion-ejb-jar>