[jboss-user] [Beginner's Corner] - JMS MDB (Message Driven Bean)

Wolfgang Knauf do-not-reply at jboss.com
Fri Jun 18 05:16:12 EDT 2010


Wolfgang Knauf [http://community.jboss.org/people/WolfgangKnauf] replied to the discussion

"JMS MDB (Message Driven Bean)"

To view the discussion, visit: http://community.jboss.org/message/548671#548671

--------------------------------------------------------------
Hi,

I assume that your post at  http://community.jboss.org/thread/153262?tstart=0 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
[http://community.jboss.org/message/548671#548671]

Start a new discussion in Beginner's Corner at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2075]

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-user/attachments/20100618/fd573c8a/attachment-0001.html 


More information about the jboss-user mailing list