MDB config for Queue in JBoss.htm

Application Servers
MDB config for Queue in JBoss

Message driven bean listening on a Queue

 

This sample shows how to configure an MDB listening on a queue in JBoss application server. The ejb-jar.xml is according to EJB 2.0 DTD.

 

 

ejb-jar.xml:

 

<!DOCTYPE ejb-jar PUBLIC "-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 2.0//EN" "http://java.sun.com/j2ee/dtds/ejb-jar_2_0.dtd">

 

<ejb-jar>

<enterprise-beans>

<message-driven>

<!-- The nickname for the bean (could be used later in DD -->

<ejb-name>LogQueueMDB</ejb-name>

<!-- The fully qualified package name of the bean class -->

<ejb-class>mdb.LogBean</ejb-class>

<transaction-type>Container</transaction-type>

<!-- Whether I'm listening to a topic or a queue -->

<message-driven-destination>

<destination-type>javax.jms.Queue</destination-type>

</message-driven-destination>

</message-driven>

</enterprise-beans>

</ejb-jar>

 

jboss.xml:

 

<?xml version="1.0"?>

 

<jboss>

<enterprise-beans>

<message-driven>

<ejb-name>LogQueueMDB</ejb-name>

<destination-jndi-name>queue/testQueue</destination-jndi-name>

 

Note: testQueue queue must be configured in JBoss. By default, it is configured.

</message-driven>

</enterprise-beans>

</jboss>