activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dirful_zone <...@i-s.com.cn>
Subject How to add a TransportListener in spring.
Date Wed, 19 Aug 2009 08:32:46 GMT

Hi, this is dirful.
    I have two questions.Firstly, I found FAQ said if 'boker' a remote URL,
it need third tool such as jconsole or other else, isn't it? 
    And now, this is the second question. I make a project that there're two
applications A and B. The work flow like this: A----send message
----MQ------recieve message ------B , and B----send message
----MQ------recieve message ------A.  Because of using Struts, I invoke a
method in action to send a message, and I configued a ListenerContainer in
spring to monitor MQ. For example, when A send a message, B can receive it
quickly. The same to B do it. 
     I have implemented it used url "tcp:localhost....". But there's a
problem, when MQ is down, I let A send a message,of course,A connect the
port once more and the message send success. but B doesn't konw the MQ
restart until it send a message to A.
     I have look for FAQ, and I got that use "failover:tcp....." and add
TransportListener can resolve it.
     You see, I configured connenctionFactory, destination and so on in
spring's xml. So I don't konw how to add a TransportListener to a connetion
like this.

     This is my xml.(The JNDI is configured in Tomcat's xml)

<?xml version="1.0" encoding="UTF-8"?>   
<beans xmlns="http://www.springframework.org/schema/beans"   
    xmlns:amq="http://activemq.apache.org/schema/core"   
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"   
    xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.0.xsd    
  http://activemq.apache.org/schema/core
http://activemq.apache.org/schema/core/activemq-core.xsd">   
   
    <bean id="jmsConnectionFactory"   
        class="org.springframework.jndi.JndiObjectFactoryBean">   
        <property name="jndiName"
value="java:comp/env/jms/ConnectionFactory"></property>   
    </bean>   
   
    <bean id="jmsQueue1"   
        class="org.springframework.jndi.JndiObjectFactoryBean">   
        <property name="jndiName"
value="java:comp/env/jms/Queue1"></property>   
    </bean>  
        <bean id="jmsQueue2"   
        class="org.springframework.jndi.JndiObjectFactoryBean">   
        <property name="jndiName"
value="java:comp/env/jms/Queue2"></property>   
    </bean>   
   
    <bean id="jmsTemplate"   
        class="org.springframework.jms.core.JmsTemplate">   
        <property name="connectionFactory"
ref="jmsConnectionFactory"></property>   
        <property name="defaultDestination" ref="jmsQueue1"></property>   
    </bean>   
   
    <bean id="sender" class="message.Sender">   
        <property name="jmsTemplate" ref="jmsTemplate"></property>   
    </bean>   
   
    <bean id="receive" class="message.Receiver"></bean>   
    <bean id="listenerContainer"   
       
class="org.springframework.jms.listener.DefaultMessageListenerContainer">   
        <property name="connectionFactory"
ref="jmsConnectionFactory"></property>   
        <property name="destination" ref="jmsQueue2"></property>   
        <property name="messageListener" ref="receive"></property>   
    </bean>   
</beans> 


     Eagerly look forward to your help.
    
-- 
View this message in context: http://www.nabble.com/How-to-add-a-TransportListener-in-spring.-tp25039990p25039990.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.


Mime
View raw message