Announcement Announcement Module
Collapse
No announcement yet.
Problem nesting RequestReplyTemplate Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Problem nesting RequestReplyTemplate

    Hi

    I having problems with a ReplyRequest concatenation. I have two templates nested. The second reply is the reply of the first one.

    Code:
    	
    <beans:bean id="CommunicationManager" class="org.sescam.cisos.bie.integration.communication.CommunicationManager">
    	<beans:property name="outputChannel" ref="inputMsgChan" />
    </beans:bean>
    <service-activator ref="CommunicationManager" method="sendMessage" input-channel="endpointInput" />
    
    <beans:bean id="TransactionManager" class="org.sescam.cisos.bie.integration.transaction.TransactionManager">
    	<beans:property name="outputChannel" ref="normalizedMsgChan" />
    </beans:bean>
    The first RequestReplyTemplate send a message to CommunicationManager bean through endpointInput channel
    Code:
    		RequestReplyTemplate template = new RequestReplyTemplate(endpointInput);
    		Message<?> reply = template.request(new GenericMessage<String>(message+" : "+this.getId()));
    CommunicationManager process the message and make a new RequestReplyTemplate.
    Code:
    	public Message<?> sendMessage(Message<?> message){
    		MessageHeader header = message.getHeader();
    
    		RequestReplyTemplate template = new RequestReplyTemplate(this.outputChannel);
    		Message<?> reply = template.request(message);
    		return new GenericMessage<String>((String)reply.getPayload()+": exito");
    		
    	}
    The second RequestReplyTemplate works ok, but the reply doesn't arrive to the first template, i get the following error

    Code:
    13-ago-2008 11:38:08 org.springframework.integration.scheduling.MessagePublishingErrorHandler handle
    WARNING: failure occurred in messaging task with message: [ID=89e99635-d10c-40ec-a407-845f28880797][Header=[CorrelationID=993b2cd2-9537-4d42-a0c7-397b53a70e79][Properties={}][Attributes={TMTime=1218623887218, CMTime=1218623887218}][Timestamp=Wed Aug 13 11:38:07 GMT+01:00 2008][Expiration=null][Priority=NORMAL][Sequence #1 (of 1)]][Payload='TM: mensaje1 : 13: exito']
    org.springframework.integration.message.MessageDeliveryException: unable to send reply message within alloted timeout of 1000 milliseconds
    Where is the problem?

  • #2
    I think your problem is related to the service-activator for CommunicationManager. The "sendMessage" method returns a Message, but there is no 'output-channel' on service-activator.

    It would probably be much simpler if you rely on the service-activator for the request/reply handling, since there would be no need to use the RequestReplyTemplate in your code. For example:
    Code:
    <beans:bean id="CommunicationManager" class="org.sescam.cisos.bie.integration.communication.CommunicationManager"/>
    
    <service-activator ref="CommunicationManager" method="sendMessage" input-channel="endpointInput" output-channel="inputMsgChan" />

    Comment

    Working...
    X