MDB config for Topic in JBoss

Application Servers
MDB config for Topic in JBoss.htm

Message driven bean listening on a Topic

 

This sample shows how to configure for a MDB listening on a topic 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>

<ejb-name>Log</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.Topic</destination-type>

</message-driven-destination>

</message-driven>

</enterprise-beans>

</ejb-jar>

 

jboss.xml:

 

<?xml version="1.0"?>

 

<jboss>

<enterprise-beans>

<message-driven>

<ejb-name>Log</ejb-name>

<destination-jndi-name>topic/testTopic</destination-jndi-name>

 

Note: testTopic topic must be configured in JBoss. By default, it is configured.

 

</message-driven>

</enterprise-beans>

</jboss>