activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Clebert Suconic <clebert.suco...@gmail.com>
Subject Re: How can I avoid hard coding the remote queue name in @MessageDriven when using resource adapter
Date Tue, 02 May 2017 21:41:09 GMT
That's more a question to the application server guys.. I would ask
that question to wildfly. I believe there's a thing you can do that..
some guys from Wildfly I know are part of this list but i doubt they
follow this on a daily basis, so you would be better asking this
question to wildfly guys at their user forum.

On Tue, May 2, 2017 at 4:04 PM, asdfg195 <mez5001@psu.edu> wrote:
> I am using an ActiveMQ resource adapter to connect to a remote ActiveMQ queue
> on a wildfly server. I have the following code in my jboss-ejb.xml to set up
> my resource adapter
>
> <mdb:resource-adapter-binding>
>   <ejb-name>MyNotificationMDB</ejb-name>
>   <mdb:resource-adapter-name>mq-ra</mdb:resource-adapter-name>
> </mdb:resource-adapter-binding>
>
> This maps to the following MDB
>
> @MessageDriven(
>     activationConfig = {
>     @ActivationConfigProperty(propertyName = "destination", propertyValue =
> "Queue.Notifications.Project"),
>     @ActivationConfigProperty(propertyName = "destinationType",
> propertyValue = "javax.jms.Queue"),
>     @ActivationConfigProperty(propertyName = "acknowledgeMode",
> propertyValue = "Auto-acknowledge")})
> public class MyNotificationMDB implements MessageListener {
>  ...
> }
>
> This code works, but I do not like having the name of the remote queue hard
> coded into my code. I would like to add another layer of bindings so that we
> can change the server configuration to change the queue instead of
> recompiling and redeploying the code. The only solution I found was to set
> an system property in my standalone.xml and add the following to my
> jboss-ejb.xml
>
> <enterprise-beans>
>     <message-driven>
>       <ejb-name>MyNotificationMDB</ejb-name>
>       <activation-config>
>         <activation-config-property>
>
> <activation-config-property-name>destination</activation-config-property-name>
>
> <activation-config-property-value>${project.queue.queuename.override}</activation-config-property-value>
>         </activation-config-property>
>       </activation-config>
>     </message-driven>
>   </enterprise-beans>
>
> I am not a big fan of this solution since we will have many queues and
> setting system properties for each will be a difficult maintenance problem.
> Are there any alternative ways that will allow me to not hard code the
> remote queue name into my MDB?
>
>
>
> --
> 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-tp4725481.html
> Sent from the ActiveMQ - User mailing list archive at Nabble.com.



-- 
Clebert Suconic

Mime
View raw message