activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From eidolon1138 <>
Subject Can I use a JNDI name in an Annotation?
Date Thu, 30 Oct 2008 20:18:28 GMT

I am using JBoss4.2.2 and a stand-alone AMQ5.1.  All my MDBs are decorated
with Annotations so I don't have any deployment descriptors.  In this
situation it is easiest to just hard-code the queue name (destination).  My
customer has multiple environments (dev, sit, qa, prd) and wants to use
unique names for all queues, like DEV.Trade.Receive and SIT.Trade.Receive.

I've read about using JNDI lookups for the queue names, but no matter what I
enter for destination, when my MDB deploys, AMQ just creates a queue with
that name, rather than treating it as a reference to a physical queue.

I have created an entry for the queue in my activemq-ds.xml file like this:

   <mbean code="org.jboss.resource.deployment.AdminObject"
      <attribute name="JNDIName">genericName</attribute>
      <attribute name="Type">javax.jms.Queue</attribute>
      <attribute name="Properties">PhysicalName=AMQ.dave.queue</attribute>

...and I can see the entry when JBoss starts up:

2008-10-30 10:09:22,041 INFO  [org.jboss.resource.deployment.AdminObject]
Bound admin object 'org.apache.activemq.command.ActiveMQQueue' at

So, what I'd like to do is tell my MDB that the destination is "genericName"
and have it actually connect to "AMQ.dave.queue" behind the scenes.  I've
tried variations on this theme, setting the destination to
"queue.genericName", "queue/genericName", and "activemq.queue.genericName". 
As I said, when I deploy the MDB, it just creates whatever name I've
specified rather than making any attempt to resolve it via JNDI.  I also
played with using mappedName=genericName, and
destinationJndiName=genericName, but in both cases AMQ complained that the
"destination" was missing.

I know that I can give up the EJB3-goodness, remove all the decorations,
implement MessageDriven, and go back to the old, ugly deployment
descriptors, but it seems to me that there has to be a way to do this with
Annotations and I can't be the first guy who wants to do this.

Has anyone else solved this problem already?

- Dave

View this message in context:
Sent from the ActiveMQ - User mailing list archive at

View raw message