Reputation: 8420
I am trying to fully define my message driven beans using the deployment descriptor as I am deploying my app to Websphere and it doesn't handle annotations very nicely.
I'm wondering if there is a way of specifying the message listener interface of an MDB in the ejb-jar.xml file?
Upvotes: 0
Views: 3146
Reputation: 11926
You must use the @javax.ejb.MessageDriven
annotation to declare the EJB type as message-driven. You can specify the following optional attributes:
The bean class must implement, directly or indirectly, the message listener interface required by the messaging type that it supports or the methods of the message listener interface. In the case of JMS, this is the javax.jms.MessageListener interface.
Activation configuration properties are name-value pairs that are passed to the MDB container when an MDB is deployed. The properties can be declared in either an ejb-jar.xml deployment descriptor or by using the @ActivationConfigProperty
annotation on the MDB bean class.
Activation Configuration Properties Set in ejb-jar.xml
<message-driven>
. . .
<activation-config>
<activation-config-property>
<activation-config-property-name>destinationJNDIName</activation-config-property-name>
<activation-config-property-value>myQueue</activation-config-property-value>
</activation-config-property>
<activation-config-property>
<activation-config-property-name>destinationType</activation-config-property-name>
<activation-config-property-value>javax.jms.Queue</activation-config-property-value>
<activation-config-property>
</activation-config>
. . .
</message-driven>
<message-driven>
. . .
<activation-config>
<activation-config-property>
<activation-config-property-name>destinationJNDIName</activation-config-property-name>
<activation-config-property-value>myQueue</activation-config-property-value>
</activation-config-property>
<activation-config-property>
<activation-config-property-name>destinationType</activation-config-property-name>
<activation-config-property-value>javax.jms.Queue</activation-config-property-value>
<activation-config-property>
</activation-config>
. . .
</message-driven>
Upvotes: 2