Java Reference
In-Depth Information
Bean Example . ” However, the @MessageDriven annotation is different, because in-
stead of a queue, the bean is using a topic with a durable subscription, and it is also
using a message selector. Therefore, the annotation sets the activation config properties
messageSelector , subscriptionDurability , clientId , and subscrip-
tionName , as follows:
Click here to view code image
@MessageDriven(mappedName = "jms/Topic", activationConfig = {
@ActivationConfigProperty(propertyName = "messageSelector",
propertyValue = "NewsType = 'Sports' OR NewsType =
'Opinion'")
, @ActivationConfigProperty(propertyName = "subscriptionDurabil-
ity",
propertyValue = "Durable")
, @ActivationConfigProperty(propertyName = "clientId",
propertyValue = "MyID")
, @ActivationConfigProperty(propertyName = "subscriptionName",
propertyValue = "MySub")
})
Note
For a message-driven
bean, the destination
is specified
with the
mappedName element instead of the lookup element.
The JMS resource adapter uses these properties to create a connection factory for the
message-driven bean that allows the bean to use a durable subscriber.
Creating Resources for the clientsessionmdb Example
This example uses the topic named jms/Topic and the connection factory jms/Con-
nectionFactory , which are also used in previous examples. If you deleted the con-
nection factory or topic, they will be recreated when you deploy the example.
Running the clientsessionmdb Example
You can use either NetBeans IDE or Ant to build, package, deploy, and run the client-
sessionmdb example.
To Run the clientsessionmdb Example Using NetBeans IDE
1. To compile and package the project, follow these steps:
a. From the File menu, choose Open Project.
Search WWH ::




Custom Search