JMS ActivationSpec JavaBean
An ActivationSpec JavaBean instance encapsulates the configuration information needed to set up asynchronous message delivery to a message endpoint. The JCA recommends that JMS providers include the following properties in their implementation of an ActivationSpec JavaBean:
- destination
Recall that a JMS destination encapsulates addressing information for the JMS provider. A JMS client explicitly specifies a destination when sending a message to, or receiving a message from, the JMS provider. A message endpoint needs to specify which destination the resource adapter should monitor for incoming messages. The resource adapter is then responsible for notifying the message endpoint when a message arrives at the specified destination.
The JCA does not define the format for the destination property, but it does acknowledge that it is not always practical for a value to be specified in the deployment descriptor for a message endpoint application. However, a value for the destination property is required when deploying the message endpoint application. For this reason, the JCA recommends that a JMS resource adapter defines the destination property as a required property on the ActivationSpec JavaBean. The resource adapter for the default messaging JMS provider within WAS does just this.
The JCA also recommends that, if the destination object specified implements the javax.jms.Destination interface, the JMS resource adapter should provide an administered object that implements this same interface. Once again, the resource adapter for the default messaging JMS provider within WAS does just this.
- destinationType
The destinationType property simply indicates whether the destination specified is a JMS queue or JMS topic. The valid values for this property are, therefore, javax.jms.Queue or javax.jms.Topic. The JCA recommends that a JMS resource adapter defines the destinationType property as a required property on the ActivationSpec JavaBean. The resource adapter for the default messaging JMS provider within WAS does just this.
- messageSelector
The JMS ActivationSpec JavaBean can optionally define a messageSelector property. JMS message selectors are discussed in Message selectors.
- acknowledgeMode
The JMS ActivationSpec JavaBean can optionally define an acknowledgeMode property. This property indicates to the EJB container how a message received by a message endpoint (MDB) should be acknowledged. Valid values for this property are Auto-acknowledge or Dups-ok-acknowledge. If no value is specified, Auto-acknowledge is assumed.
For a full description of message acknowledgement, please see both the JMS V1.1 and the EJB V2.1 specifications. Links for these specifications are contained in 8.8, References and resources.
- subscriptionDurability
The JMS ActivationSpec JavaBean can optionally define a subscriptionDurability property. This property is only relevant if the message endpoint (MDB) is receiving messages from a JMS topic. The destinationType property specifies a value of javax.jms.Topic.
As discussed in Durable subscriptions in the Publish/Subscribe domain, in the JMS Publish/Subscribe domain, in order for a message to be retained on a destination when a subscribing application is not available, the subscribing application must create a durable subscription. With message-driven beans, it is the EJB container that is responsible for creating subscriptions when the specified destination is a JMS topic. This property indicates to the EJB container whether it must create a durable subscription to the JMS topic.
The valid values for the subscriptionDurability property are either Durable or NonDurable. If no value is specified, NonDurable is assumed.
- clientId
The JMS ActivationSpec JavaBean can optionally define a clientId property. This property is only relevant if the message endpoint (MDB) defines a durable subscription to a JMS topic (the destinationType property specifies a value of javax.jms.Topic and the subscriptionDurability property specifies a value of Durable).
The JMS provider uses the clientId for durable subscriptions to uniquely identify a message consumer. If a message endpoint defines a durable subscription, then a value for the clientId property must be specified. A suitable value for the clientId property would normally be specified when deploying the message endpoint application.
- subscriptionName
The JMS ActivationSpec JavaBean can optionally define a subscriptionName property. This property is only relevant if the message endpoint (MDB) defines a durable subscription to a JMS topic. The destinationType property specifies a value of javax.jms.Topic and the subscriptionDurability property specifies a value of Durable.
The JMS provider uses the subscriptionName in combination with the clientId to uniquely identify a message consumer. If a message endpoint defines a durable subscription, then a value for the subscriptionName property must be specified. A suitable value for the subscriptionName property would normally be specified when deploying the message endpoint application.