Configuring an MDB to receive messages from ActiveMQThere are three MDBs declared in the ejb-jar.xml deployment descriptor. For this example, I will be explaining how to configure the The BeanIn the ejb-jar.xml deployment descriptor, the ejb-jar.xml <message-driven> ... <ejb-name>TopicDurableMDB</ejb-name> <ejb-class>com.panacya.platform.service.bus.mdb.SimpleMessageReceiverBean</ejb-class> <messaging-type>javax.jms.MessageListener</messaging-type> ... <activation-config> <activation-config-property> <activation-config-property-name>Destination</activation-config-property-name> <activation-config-property-value>topic.testTopic</activation-config-property-value> </activation-config-property> <activation-config-property> <activation-config-property-name>DestinationType</activation-config-property-name> <activation-config-property-value>javax.jms.Topic</activation-config-property-value> </activation-config-property> ... </activation-config> ... </message-driven> The The ConnectorThe two ra.xml <inbound-resourceadapter> ... <activationspec> <activationspec-class>org.activemq.ra.ActiveMQActivationSpec</activationspec-class> <required-config-property> <config-property-name>Destination</config-property-name> </required-config-property> <required-config-property> <config-property-name>DestinationType</config-property-name> </required-config-property> </activationspec> ... </inbound-resourceadapter> In the ejb-jar.xml file section shown above, the value of the The GlueIn JBoss, the thing which connects an inbound JMS destination to an MDB is a JBoss container. To use ActiveMQ as the inbound message source for the Three things are needed in the jboss.xml file in order to tie an MDB to a connector. They are:
This first snippet configures a new jboss.xml – invoker-proxy-binding <invoker-proxy-binding> <name>activemq-message-driven-bean</name> <invoker-mbean>default</invoker-mbean> <proxy-factory>org.jboss.ejb.plugins.inflow.JBossMessageEndpointFactory</proxy-factory> ... </invoker-proxy-binding> This second snippet configures a new MDB container which uses the jboss.xml – container-configuration <container-configuration> <container-name>ActiveMQ Message Driven Bean</container-name> <call-logging>false</call-logging> <invoker-proxy-binding-name>activemq-message-driven-bean</invoker-proxy-binding-name> ... </container-configuration> This third snippet links the jboss.xml – TopicDurableMDB <message-driven> <ejb-name>TopicDurableMDB</ejb-name> <resource-adapter-name>activemq-ra-1.2-SNAPSHOT.rar</resource-adapter-name> <configuration-name>ActiveMQ Message Driven Bean</configuration-name> </message-driven> The above examples highlight the key configuration settings needed to enable MDBs deployed in JBoss to process messages from an ActiveMQ destination. You can try the above example, plus a few more, by downloading the activemq-jboss-test.zip file which contains the complete sample project. |