activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From asdfg195 <mez5...@psu.edu>
Subject Re: How can I avoid hard coding the remote queue name in @MessageDriven when using resource adapter
Date Wed, 03 May 2017 12:19:59 GMT
I found the solution. The trick is the "useJndi" ActivationConfigProperty

@MessageDriven(
    activationConfig = {
    @ActivationConfigProperty(propertyName = "destination", propertyValue =
"java://activemq/Queue.Notifications.Project"),
    @ActivationConfigProperty(propertyName = "destinationType",
propertyValue = "javax.jms.Queue"),
    @ActivationConfigProperty(propertyName = "acknowledgeMode",
propertyValue = "Auto-acknowledge"),
    @ActivationConfigProperty(propertyName = "useJndi", propertyValue =
"true")})
public class MyNotificationMDB implements MessageListener {
 ...
} 

This allows use to use the JNDI name of the queue defined in standalone.xml

<resource-adapters>
  <resource-adapter id="wl-cpr-ra">
    ....
    <admin-objects>
      <admin-object class-name="org.apache.activemq.command.ActiveMQQueue"
jndi-name="java://activemq/Queue.Notifications.Project"
use-java-context="true" pool-name="MyPool">
        <config-property name="PhysicalName">
          Queue.Notifications.Project
        </config-property>
      </admin-object>
    </admin-objects>
  </resource-adapter>
</resource-adapters>



--
View this message in context: http://activemq.2283324.n4.nabble.com/How-can-I-avoid-hard-coding-the-remote-queue-name-in-MessageDriven-when-using-resource-adapter-tp4725481p4725509.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Mime
View raw message