Setting the JMS Destination, Destination Type, and Connection Factory Setting Subscription Durability

Configuring and Deploying MDBs Using JMS Topics 10-3 The message distribution tuning settings include the topicMessagesDistributionMode , distributedDestinationConnection, and generate-unique-client-id attributes. Most attributes can be configured either by using an annotation or via descriptor XML stanzas. In addition, specific attribute names for descriptor XML stanzas and annotations are summarized in the tables in Chapter 11, Deployment Elements and Annotations for MDBs.

10.2.1 Setting the JMS Destination, Destination Type, and Connection Factory

A topic MDBs configuration must properly specify the location of its JMS connection factory, its destination, and its destination type. Typically, this is accomplished by: 1. Specifying a topic type. In the message-driven-destination element of ejb-jar.xml , set destination-type to javax.jms.Topic. Alternatively, if using annotations, specify an ActivationConfigProperty with propertyName = destinationType and propertyValue = javax.jms.Topic . 2. Specifying a connection factory JNDI name and a destination JNDI name. Specifying a connection factory JNDI name is usually not necessary if the connection factory is hosted on the same cluster or server as the MDB. The default usually suffices. 3. If the destination is not located in the same cluster or server as the MDB pool, administratively configure a mapping from the remote destination and connection factory JNDI entries to local JNDI entries that match those specified in 2, above. There are alternative approaches to referencing remote resources, but the mapping approach is the Oracle-recommended best practice. For each free pool, the MDB container creates a connection using the specified connection factory, then uses the connection to find or create one or more subscriptions on its destination, and finally uses the connection to create JMS consumers that receive the messages from the subscriptions. For the specific names of connection factory and destination MDB attributes, as well as recommended JNDI mapping configuration, see Section 6.3, Configuring MDBs for Destinations.

10.2.2 Setting Subscription Durability

MDBs automatically create subscriptions on JMS topics. JMS topics support two types of subscriptions: durable and non-durable. ■ Non-durable subscriptions exist only for the length of time their subscribers exist. When a subscription has no more subscribers, the subscription is automatically deleted. Messages stored in a non-durable subscription are never recovered after a JMS server shut down or crash. ■ Durable subscriptions make it possible for a subscriber to receive messages that are published while the subscriber application is unavailable. For each durable subscription on a topic, JMS stores a copy of each published persistent message in a file or database until it can be delivered or until it expires, even if there are no active subscribers on the subscription at the time the message is delivered. JMS also stores a copy of each non-persistent message in each durable subscription, but such messages are not recovered if the JMS server shuts down or crashes. Non-durable subscriptions are the default. To specify a durable subscription, in the message-driven-destination element of ejb-jar.xml, set 10-4 Programming Message-Driven Beans for Oracle WebLogic Server subscription-durability to Durable. Alternatively, when using annotations, specify an ActivationConfigProperty with propertyName = subscriptionDurability and propertyValue = Durable.

10.2.3 Setting Automatic Deletion of Durable Subscriptions