Community

JMS MDB (Message Driven Bean)

reply from Wolfgang Knauf in Beginner's Corner - View the full discussion

Hi,

 

I assume that your post at http://community.jboss.org/thread/153262?tstart=0 contains further information about your configuration?

 

Anyway: if you use annotations, you bind the queue to a JNDI name by using the attribute "mappedName" of the "@MessageDriven" annotation.

 

@MessageDriven(
    activationConfig =
    {
        @ActivationConfigProperty(propertyName = "destinationType", propertyValue = "javax.jms.Queue")
    },
    mappedName = "queue/MessageBeanQueue")

 

 

Otherwise, you might do this through ejb-jar.xml. Here it is a property of "activation-config".

I am just wondering why my sample one time uses two different approaches to do this mapping, but both seemed to work ;-)

 

<?xml version="1.0" encoding="UTF-8"?>
<ejb-jar id="ejb-jar_ID" version="3.0" xmlns="http://java.sun.com/xml/ns/javaee"
     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
     xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
                           http://java.sun.com/xml/ns/javaee/ejb-jar_3_0.xsd">
     <display-name>MessageEJB</display-name>
     <enterprise-beans>
     
          <message-driven>
               <display-name>MessageBean</display-name>
               <ejb-name>MessageBean</ejb-name>
               <ejb-class>...MessageBean</ejb-class>
               <messaging-type>javax.jms.MessageListener</messaging-type>
               <transaction-type>Container</transaction-type>
               <message-destination-type>javax.jms.Queue</message-destination-type>
               <activation-config>
                    <activation-config-property>
                         <activation-config-property-name>destinationType</activation-config-property-name>
                         <activation-config-property-value>javax.jms.Queue</activation-config-property-value>
                    </activation-config-property>
                    <activation-config-property>
                         <activation-config-property-name>destination</activation-config-property-name>
                         <activation-config-property-value>queue/MessageBeanQueue</activation-config-property-value>
                    </activation-config-property>
               </activation-config>
          </message-driven>
     </enterprise-beans>
</ejb-jar>

 

 

Best regards

 

Wolfgang

Reply to this message by going to Community

Start a new discussion in Beginner's Corner at Community