Results 1 to 4 of 4

Thread: How to consume the messages from different URL? I want to avoid repetition in applica

Threaded View

  1. #1
    Join Date
    Oct 2008
    Posts
    9

    Default How to consume the messages from different URL? I want to avoid repetition in applica

    I am using this below configuration and it is working fine to consume message from one node.

    myproperties.properties

    Code:
    jms.brokerurl=tcp://jms1.my.com:61616
    applicationContext.xml
    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>
    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.
    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
    Code:
    jms.brokerurl=tcp://jms1.my.com:61616,tcp://jms2.my.com:61616,tcp://jms3.my.com:61616,tcp://jms4.my.com:61616
    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.
    Last edited by smaheskumar; Aug 12th, 2012 at 12:26 AM.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •