Announcement Announcement Module
Collapse
No announcement yet.
jms outbound gateway doesn't pick up repy Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • jms outbound gateway doesn't pick up repy

    Hi!
    Maybe it's a stupid question and I'm missing something very simple, but I'm really stuck.
    I'm using ActiveMQ 5.5.1 and SI 2.1.4

    My configs snippets:

    ---SERVER---
    Code:
        <beans:bean id="connectionFactory" class="org.apache.activemq.ActiveMQConnectionFactory">
            <beans:property name="brokerURL" value="tcp://localhost:61616" />
        </beans:bean>
    
     
       <beans:bean id="listQueue" class="org.apache.activemq.command.ActiveMQQueue">
            <beans:constructor-arg name="name" value="LIST_QUEUE"/>
        </beans:bean>   
        
       <beans:bean id="replyListQueue" class="org.apache.activemq.command.ActiveMQQueue">
            <beans:constructor-arg name="name" value="REPLY_LIST_QUEUE"/>
        </beans:bean>             
              
        <channel id="replyListChannel"/> 
        <channel id="listIn" />
        <channel id="listDriver"/>
        <channel id="listStock"/>    
    
        
       <jms:inbound-channel-adapter id="listInJms"
            connection-factory="connectionFactory"
            destination="listQueue"
            channel="listIn"        
            auto-startup="true">
            <poller fixed-rate="3000"/>
        </jms:inbound-channel-adapter>  
        
    
        
        <header-value-router input-channel="listIn" header-name="List"
                default-output-channel="nullChannel">        
            <mapping value="Driver" channel="listDriver" />
            <mapping value="Stock" channel="listStock" />
        </header-value-router>
       
        <jms:outbound-channel-adapter connection-factory="connectionFactory"
            channel="replyListChannel"
            destination="replyListQueue"
            auto-startup="true">                 
        </jms:outbound-channel-adapter>

    ---CLIENT---
    Code:
       <beans:bean id="connectionFactory" class="org.apache.activemq.ActiveMQConnectionFactory">
            <beans:property name="brokerURL" value="tcp://localhost:61616" />
        </beans:bean>      
        
        <beans:bean id="requestListQueue" class="org.apache.activemq.command.ActiveMQQueue">
            <beans:constructor-arg value="LIST_QUEUE"/>
        </beans:bean>         
    
        <beans:bean id="replyListQueue" class="org.apache.activemq.command.ActiveMQQueue">
            <beans:constructor-arg value="REPLY_LIST_QUEUE"/>
        </beans:bean> 
                 
       
       <channel id="requestListChannel">
            <queue capacity="20"/>
        </channel>   
    
       <channel id="listStockChannel">
            <queue capacity="20"/>
        </channel>   
        
       <channel id="listDriverChannel">
            <queue capacity="20"/>
        </channel>       
                    
       <channel id="replyListChannel"/>                
    
        <jms:outbound-gateway id="outListGW"
            connection-factory="connectionFactory"
            request-destination="requestListQueue"
            request-channel="requestListChannel"
            reply-destination="replyListQueue"
            reply-channel="replyListChannel" 
            reply-timeout="20000"
            receive-timeout="20000">
            <poller fixed-rate="5000" />
        </jms:outbound-gateway>     
            
        
        <header-value-router input-channel="replyListChannel" header-name="List"
                default-output-channel="nullChannel">        
            <mapping value="Driver" channel="listDriverChannel" />
            <mapping value="Stock" channel="listStockChannel" />
        </header-value-router>

    Then in some place in code I manually do the request and listen to the reply-channel:
    Code:
     public static DriverList requestDriverList() {
       
            Message<String> ldrm = MessageBuilder.withPayload("DriverList request").
                    setHeader("List", "Driver").build();            
            try {
                ApplicationContext ctx = 
                new ClassPathXmlApplicationContext("classpath:dmclnt/config/integ-context.xml");
                MessageChannel requestListChannel = 
                        ctx.getBean("requestListChannel", MessageChannel.class);
                QueueChannel listDriverChannel = 
                        ctx.getBean("listDriverChannel", QueueChannel.class);
                
      
                logger.info("Request for DriverList is sent to channel");
    
                Message dlm = listDriverChannel.receive(20000);
    
                String xmlDL = (String)dlm.getPayload(); 
    
                JAXBContext jaxbctx = JAXBContext.newInstance(DriverList.class);
                DriverList dl = (DriverList)jaxbctx.createUnmarshaller().unmarshal(new StringReader(xmlDL));
                logger.info("DriverList objct unmarshalled: "+dl.toString());
                return dl;            
            } catch (JAXBException e) {
                logger.error("Error converting xmlDriverList to DriverList object",e);
                return null;
            } catch (RuntimeException e){
                logger.error(e); 
                return null;
            } 
        }
    But I receive
    "MessageTimeoutException: failed to receive JMS response within timeout of: 20000ms"
    all the time.
    When I look through server log I see that reply with correct payload was successfully sent from server to client and, moreover,
    the reply is placed into REPLY_LIST_QUEUE, as I can see in ActiveMQ admin console.
    And nothing more happens!
    Message in REPLY_LIST_QUEUE __With_Correct_Payload__ resides in Pending and Enqueued state in this queue.
    No messages are Dequeued.
    It seems, JmsOutboundGateway does not pick up messages from reply-destination queue, despite receive-timeout="20000ms" delay is far more than enough to get the reply.
    What am I doing wrong?
    TIA

  • #2
    I replied to the same question on Stack Overflow... http://stackoverflow.com/questions/1...-pick-up-reply

    Comment

    Working...
    X