Java Reference
In-Depth Information
</enterprise-beans>
</ejb-jar>
The approach you choose is largely a matter of taste. Next, we'll look at configuring your
MessageListener interface.
4.3.6. Using ActivationConfigProperty
The ActivationConfigProperty of the @MessageDriven annotation allows you
to provide messaging provider-specific configuration information through an array of
ActivationConfigProperty instances. ActivationConfigProperty is
defined as follows:
@Target(value = {})
@Retention(value = RetentionPolicy.RUNTIME)
public @interface ActivationConfigProperty {
String propertyName();
String propertyValue();
}
Each activation property is a name-value pair that the underlying messaging provider un-
derstands and uses to set up the MDB. The best way to grasp how this works is through an
example. Here, we provide two of the most common JMS activation configuration proper-
ties: destinationType and destinationLookup :
@MessageDriven(activationConfig = {
@ActivationConfigProperty(propertyName = "destinationType",
propertyValue = "javax.jms.Queue"),
@ActivationConfigProperty(propertyName = "destinationLookup",
propertyValue = "jms/ShippingRequestQueue")
})
First, the destinationType property tells the container this JMS MDB is listening to a
queue. If you were listening to a topic instead, the value could be specified as javax.jms
.Topic . The destinationLookup parameter specifies that you're listening for mes-
sages arriving at a destination with the JNDI name of jms/ShippingRequestQueue .
There are a few other configuration properties for a JMS provider that handle JMS mes-
sages. Table 4.1 summarizes these properties.
Search WWH ::




Custom Search