I am using this below configuration and it is working fine to consume message from one node.
myproperties.properties
applicationContext.xmlCode:jms.brokerurl=tcp://jms1.my.com:61616
My requirement, messages are going to distribute among 'n' different node. For example n=4, If I do copy-paste the above 'connectionFactory','Listener' and 'listener-container' configuration '4' time with different brokerURL and 'id', it will work. But based on the environment (like development, testing and production), the value of 'n' is going to vary.Code:<bean id="connectionFactory" class="org.apache.activemq.ActiveMQConnectionFactory" p:brokerURL="${jms.brokerurl}?jms.redeliveryPolicy.maximumRedeliveries=5" /> <bean id="myMsgListener" class="my.MessageListener" /> <jms:listener-container container-type="default" connection-factory="connectionFactory" acknowledge="client" concurrency="10-50" cache="consumer"> <jms:listener destination="someQueue" ref="myMsgListener" method="onMessage" /> </jms:listener-container>
So I can't keep changing my applicationContext.xml. We have script in place to expand the value in properties file as below with respect to environment. Part of deployment, this script will expand the values in property file.
myproperties.properties
Based on the above ',' separated 'jms.brokerurl' property, I want to do this dynamic configuration in application context to consume the messages from the different nodes. Please share your ideas.Code:jms.brokerurl=tcp://jms1.my.com:61616,tcp://jms2.my.com:61616,tcp://jms3.my.com:61616,tcp://jms4.my.com:61616


Reply With Quote
