JBoss.org Community Documentation

Chapter 21. Configuring Message Driven Beans through deployment descriptors

You configure properties by using the <message-driven> element and sub elements which correspond to the @ActivationConfigProperty annotation.

ejb-jar.xml:

			
<message-driven>
	<ejb-name>ExampleMDB</ejb-name>
	<ejb-class>org.jboss.tutorial.mdb_deployment_descriptor.bean.ExampleMDB</ejb-class>
     <transaction-type>Bean</transaction-type>
     <message-destination-type>javax.jms.Queue</message-destination-type>
   <activation-config>
      <activation-config-property>
      	<activation-config-property-name>acknowledgeMode</activation-config-property-name>
      	<activation-config-property-value>AUTO_ACKNOWLEDGE</activation-config-property-value>
      </activation-config-property>
    </activation-config>

</message-driven>

			
		

jboss.xml

			
<message-driven>
   <ejb-name>ExampleMDB</ejb-name>
   <destination-jndi-name>queue/tutorial/example</destination-jndi-name>
</message-driven>
			
		

The queue/tutorial/example is configured through the queue-example-service.xml

Building and Running

From the command prompt, move to the "mdb_deployment_descriptor" folder under the Section 1.3, “Set the EJB3_TUTORIAL_HOME”

Ant Users:

Make sure your JBossAS-5.x is running

			
$ ant
$ ant run

run:
     [java] Message sent successfully to remote queue.


		     
			

Maven Users: Make sure the AS is not running.

$ mvn clean install -PRunSingleTutorial
			

On the server console, you will notice the following logs:

				
23:37:38,175 INFO  [STDOUT] ----------------
23:37:38,175 INFO  [STDOUT] Received message
23:37:38,175 INFO  [STDOUT] ----------------