Announcement Announcement Module
Collapse
No announcement yet.
ActiveMQ 4.1 + Tomcat 5 + Spring 2.5 Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • ActiveMQ 4.1 + Tomcat 5 + Spring 2.5

    Hi!

    I'm currently struggling with ActiveMQ JMS. So far I was able to send/recieve messages within same web application. But now I'm trying to send messages between two web applications.

    One application is sending messages, while another just listening for them. Both are using embedded brokers.
    It looks like sender is working normally, but listener isn't recieving any messages.

    Here is configurations for both applicationContext.xml files (sender / listener accordingly)

    SENDER:
    [ code]
    <?xml version="1.0" encoding="UTF-8"?>
    <beans
    ........">

    <!-- lets create an embedded ActiveMQ Broker -->
    <amq:broker useJmx="false" persistent="false" brokerName="broker1">
    <amq:networkConnectors>
    <amq:networkConnector name="default-nc" uri="multicast://default" />
    <!--
    <amq:networkConnector uri="static: //(tcp://localhost:61617)" />
    -->
    </amq:networkConnectors>

    <amq:transportConnectors>
    <amq:transportConnector uri="tcp: //localhost:0" />
    </amq:transportConnectors>
    </amq:broker>

    <amq:queue id="defaultQueue" physicalName="defaultQueue"/>

    <amq:connectionFactory id="jmsConnectionFactory" brokerURL="vm://broker1"/>

    <!-- Spring JMS Template -->
    <bean id="producerJmsTemplate" class="org.springframework.jms.core.JmsTemplate">
    <property name="defaultDestination" ref="defaultQueue"/>
    <property name="connectionFactory">
    <!-- lets wrap in a pool to avoid creating a connection per send -->
    <bean class="org.springframework.jms.connection.SingleCo nnectionFactory">
    <property name="targetConnectionFactory">
    <ref local="jmsConnectionFactory" />
    </property>
    </bean>
    </property>
    </bean>

    <!-- a sample POJO which uses a Spring JmsTemplate -->
    <bean id="producer" class="mypackage.MySpringProducerImpl">
    <property name="jmsTemplate">
    <ref bean="producerJmsTemplate"></ref>
    </property>
    <property name="destination">
    <ref bean="defaultQueue" />
    </property>
    </bean>

    </beans>
    [/code ]

    LISTENER:
    [ code]
    <?xml version="1.0" encoding="UTF-8"?>
    <beans
    xmlns="....

    ">

    <amq:broker useJmx="false" persistent="false" brokerName="broker2">
    <amq:networkConnectors>
    <amq:networkConnector name="default-nc" uri="multicast://default" />
    </amq:networkConnectors>

    <amq:transportConnectors>
    <amq:transportConnector uri="tcp: //localhost:0" />
    </amq:transportConnectors>
    </amq:broker>

    <amq:queue id="defaultQueue" physicalName="defaultQueue"/>

    <amq:connectionFactory id="jmsConnectionFactory" brokerURL="tcp://localhost:0"/>

    <bean id="myListener" class="MyMessageListener"/>

    <bean class="org.springframework.jms.listener.DefaultMes sageListenerContainer">
    <property name="connectionFactory" ref="jmsConnectionFactory" />
    <property name="destinationName" value="defaultQueue" />
    <property name="messageListener" ref="myListener" />
    </bean>

    </beans>
    [/code ]


    What should I change to force second application listen for broker1?
    Last edited by bondtnt; Aug 11th, 2008, 11:21 AM.
Working...
X