SwiftMQ inbound resource adapter for MDB

SwiftMQ provide a JCA 1.5 resource that allows JMS message delivery to an MDB. The attached example ant project shows how to deploy such an EJB3 MDB.

AnnotatedTestMDBBean.java

The AnnotatedTestMDBBean.java is the source for the EJB3 MDB. Note the annotations:

@MessageDriven(name="test/mdb", activationConfig =
{
@ActivationConfigProperty(propertyName="messagingType", propertyValue="javax.jms.MessageListener"),
@ActivationConfigProperty(propertyName="destinationType", propertyValue="javax.jms.Queue"),
@ActivationConfigProperty(propertyName="Destination", propertyValue="testqueue"),
@ActivationConfigProperty(propertyName="ConnectionFactoryName", propertyValue="ConnectionFactory"),
@ActivationConfigProperty(propertyName="Transacted", propertyValue="true"),
@ActivationConfigProperty(propertyName="Xa", propertyValue="true"),
@ActivationConfigProperty(propertyName="DeliveryOption", propertyValue="B"),
@ActivationConfigProperty(propertyName="SubscriptionDurability", propertyValue="Durable"),
@ActivationConfigProperty(propertyName="MaxPoolSize", propertyValue="20"),
@ActivationConfigProperty(propertyName="MaxMessages", propertyValue="1"),
@ActivationConfigProperty(propertyName="resourceAdaptorName", propertyValue="swiftmq.rar")
})
@ResourceAdapter("swiftmq.rar")

These annotations correspond the following deployment descriptors:

NOTE: these properties could equally go in jboss.xml if you want to avoid polluting ejb-jar.xml with vendor specific properties.

ejb-jar.xml

jboss.xml

Here we define jboss specific stuff. There are two main items: * We define we want to use the jca 1.5 message inflow container * We tell jboss which rar will provide the inflow

Running the example

* Make sure you have the Swift jmsxaasf swiftlet installed within SwiftMQ
* Add swiftmq.rar to the deploy directory
* Change build.properties to point at your JBoss installation
* Deploy the mdb by typing "ant" to run the deploy target in build.xml
* Use the swiftmq example {{{SimpleQueueSender}}} to send a message to the queue

You should get some output like the following on the jboss console:

12:47:29,515 INFO  [STDOUT] [TextMessageImpl com.swiftmq.jms.TextMessageImpl@4065c4
messageIndex = 5_0
messageId = ID:/10.10.10.115-11333728494210
userId = anonymous
clientId = null
timeStamp = 113337849421
correlationId = null
replyTo = null
destination = testqueue@router1
deliveryMode = 2
redelivered = false
deliveryCount = 1
type = null
expiration = 0
priority = 4
props = null
readOnly = true
sourceRouter = null
destRouter = null
destQueue = testqueue@router1 text=Here is a message]