Results 1 to 4 of 4

Thread: Submitting JMS messages on to a remote queue

  1. #1

    Default Submitting JMS messages on to a remote queue

    I have set up a message listener, queue, connection factory and container beans on one machine. They all talk to each other nicely.
    I would like to house the queue on a different machine but I'm not sure which bit I need to change.

    Code:
        <bean id="connectionFactory" class="org.apache.activemq.ActiveMQConnectionFactory">
          <property name="brokerURL" value="tcp://localhost:61616"/>
        </bean>
    
        <!-- SessionAwareMessageListener -->
        <bean id="receiveClipToRemoteProxiesListener" class="com.quantel.SiteManager.ReceiveClipToRemoteProxiesService"/>
    
        <bean id="sendClipToRemoteProxiesQueue" class="org.apache.activemq.command.ActiveMQQueue">
            <constructor-arg value="jms/sendClipToRemoteProxies"/>
        </bean>
    
    
        <bean id="jmsSendClipToRemoteProxiesContainer" class="org.springframework.jms.listener.DefaultMessageListenerContainer">
            <property name="connectionFactory" ref="connectionFactory"/>
            <property name="destination" ref="sendClipToRemoteProxiesQueue"/>
            <property name="messageListener" ref="receiveClipToRemoteProxiesListener" />
            <property name="concurrentConsumers" value="1" />
            <property name="maxConcurrentConsumers" value="1" />
            <property name="transactionManager">
                <ref local="transactionManager"/>
            </property>
        </bean>
    Do I just change sendClipToRemoteProxiesQueue to point at hostname : port/qname or do I need to talk to a remote broker.

    Please can someone give me a hand re-jigging the xml?

    Thank,

  2. #2
    Join Date
    Feb 2008
    Posts
    17

    Default

    If i understand your question correctly:

    If you need to change to point to a queue on a different machine (broker), you need to change the value in the broker url property that you have defined. The queue that you are pointing to must exist in the mq broker that you are connecting to.

    Hope this helps.
    Last edited by silverdream; Feb 25th, 2008 at 05:19 PM.

  3. #3

    Default

    Thanks that is what I mean. How does it work in the xml though. The jmsSendClipToRemoteProxiesContainer contains ref's to the messageListener, do i just miss this line out because the receiveClipToRemoteProxiesListener bean is actually on a different machine?

  4. #4

    Default The answer

    The broker goes on the sender machine.
    Both machines have a connectionFactory going to the same machine ie myhostname (and not localhost).

    Sending side hosta
    Code:
        <bean id="sendClipToRemoteProxiesQueue" class="org.apache.activemq.command.ActiveMQQueue">
            <constructor-arg value="jms/sendClipToRemoteProxies"/>
        </bean>
    
        <bean id="connectionFactory" class="org.apache.activemq.ActiveMQConnectionFactory">
          <property name="brokerURL" value="tcp://hosta:61616"/>
        </bean>
    
        <bean id="jmsTemplate" class="org.springframework.jms.core.JmsTemplate">
          <property name="connectionFactory">
            <ref local="pooledConnectionFactory"/>
          </property>
        </bean>
    
        <bean id="jmsSendClipToRemoteProxiesContainer" class="org.springframework.jms.listener.DefaultMessageListenerContainer">
            <property name="connectionFactory" ref="connectionFactory"/>
            <property name="destination" ref="sendClipToRemoteProxiesQueue"/>
            <!-- no need to specifiy a messageListener bean because it is on the remote machine -->
            <property name="concurrentConsumers" value="1" />
            <property name="maxConcurrentConsumers" value="1" />
            <property name="transactionManager">
                <ref local="transactionManager"/>
            </property>
        </bean>
    Receiving side hostb
    Code:
        <!-- no broker -->
    
        <bean id="sendClipToRemoteProxiesQueue" class="org.apache.activemq.command.ActiveMQQueue">
            <constructor-arg value="jms/sendClipToRemoteProxies"/>
        </bean>
    
        <bean id="connectionFactory" class="org.apache.activemq.ActiveMQConnectionFactory">
          <property name="brokerURL" value="tcp://hosta:61616"/>
        </bean>
    
        <!-- no jmstemplate, because we are not sending -->
    
        <bean id="jmsSendClipToRemoteProxiesContainer" class="org.springframework.jms.listener.DefaultMessageListenerContainer">
            <property name="connectionFactory" ref="connectionFactory"/>
            <property name="destination" ref="sendClipToRemoteProxiesQueue"/>
            <property name="messageListener" ref="receiveClipToRemoteProxiesListener" />
            <property name="concurrentConsumers" value="1" />
            <property name="maxConcurrentConsumers" value="1" />
            <property name="transactionManager">
                <ref local="transactionManager"/>
            </property>
        </bean>

Posting Permissions

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