Announcement Announcement Module
No announcement yet.
how to handle timeout for aggregating messages(both sequential&parallel)? Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • how to handle timeout for aggregating messages(both sequential&parallel)?

    Hi all,
    I am a new learnor of SI. Now I am writing a program to test some function of it. I stub client, mediator, two backend systems. Client sends a request to mediator, mediator would splitter it into two request messages and send to different b/e. b/e would send responses to mediator, mediator would aggregate the responses and send to client.
    Now I would like to test error handling for sequential and parallel case. And I would make the thread of b/e (A) sleep 20 seconds(or more) to let the responses from it process a little long. On the other hand, some handling would be implemented, so even A return null resp, it is accepted.
    Case 1.For sequential, the two reponses from b/e would be aggregated together and client can get the response,.even though b/e (A) return null response(this may due to timeout).
    Case 2.But for parallel, although the responses can be aggregated, but not response can be returned to client.
    I have no idea why case2 has not response while case1 has, Does anyone understand the cases?
    Besides, I would like to know how I can set timeout value for ws-inbound-gateway…as like the cases above, if the response from A takes too long time, I don’t want client to wait for this response.
    Thanks in advance.

  • #2
    Please show your configuration for the two cases.

    The inbound gateway has a reply-timeout attribute...

    			<xsd:attribute name="reply-timeout" type="xsd:string">
    	Maximum time in milliseconds to wait for a reply from the downstream message flow initiated by this gateway.
    	This attribute is only relevant if at least some part of the downstream flow is asynchronous.


    • #3
      hello Gary, thanks for your reply. Since I am on leave, I just typed the code from memory.
      <int:channel=”wsInbound” />
      <int:channel=”wsOutbound” />
      <int:channel=”wsOutbound1” />
      <int:channel=”errorChannel” />
      <int-ws:inbound-gateway request-Channel="wsInChannel" error-channel=”errorChannel” ref="" reply-Channel="wsOutChannel"
       marshall="profileMarshall" unmarshall="profileMarshall">
      <int:splitter input-Channel="wsInChannel" output-Channel="routingChannel" method="splitter">
      <beans:bean class="">
      <int:router input-Channel="routingChannel" default-Output-Channel="helloService" method="router">
      <beans:bean class="">
      <int:channel id="helloService">
      <int:dispatcher task-executor="executor">--------------Only add/remove this line to indicate sequential/parallel
      <int:channel id="calService">
      <int:dispatcher task-executor="executor">--------------Only add/remove this line to indicate sequential/parallel
      <int:service-activator input-Channel="helloService" ref="barista" method="sayHello" output-channel="helloChannel"/>
      <int:service-activator input-Channel="calService" ref="barista" method="calculate" output-channel="calChannel"/>
      <beans:bean id="barista" class=""/>
      <int-ws:outbound-gateway request-Channel="helloChannel" reply-Channel="wsOutChannel1" uri=”http:localhost:19555/calService/calService.wsdl”
       marshall="profileMarshall" unmarshall="profileMarshall">
      <int-ws:outbound-gateway request-Channel="calChannel" reply-Channel="wsOutChannel1" uri=”http:localhost:19777/helloService/calService.wsdl”
       marshall="profileMarshall" unmarshall="profileMarshall">
      <int:aggregator input-Channel=”wsOutChannel1” outputChannel=”wsOutChannel” method=”aggregate”>
      <beans:bean ref=””>
      <task:executor id="executor" pool-size="5">
      <int:transformer ref="testTransformerBean" method="transform" input-Channel="errorChannel" output-Channel="wsOutBound"/>
      <beans:bean id="testTransformerBean" class=""/>
      Last edited by oleg.zhurakousky; Jun 24th, 2012, 01:47 PM.


      • #4
        ". . .A return null resp, it is accepted. . ." - there is no null response. Its not allowed in SI, so if there is null returned during the response then no response Message will be created. For what to do in these type of cases you can look at this sample, however here is what I would suggest.
        It is stil hard to understand what you are trying to accomplish. So please only provide details and configuration for the use cases in question.
        Also, please go through our samples library before venturing into the advanced topics Believe me it will help you greatly to understand some of the inner-workings of SI


        • #5
          hi, sorry, I should have tried to make it clear. I think if the message is timeout, payload null will be returned, am I correct?
          and one more question, one of the message returns after at least 20 seconds, but the aggregator still wait for it to come back and aggregate the result to client, even I set the timeout to 5 seconds. What I understand is, the default timeout of aggregator is 1 second, so aggregator wouldn't send any messages to outputChannel if it timeout. does it means testAggregator below won't be processed? However, the real case I encountered is that it would always group messages with both(timeout message with null payload and correct one) and return to client.
          <int:aggregator input-Channel=”wsOutChannel1” outputChannel=”wsOutChannel” method=”aggregate”>
          <beans:bean ref=””>
          However, timeout seems not working for aggregator, it is always waiting for two messages and to start process in both sequential and parallel cases.
          For inbound-gateway, it can get response back in sequetial case, but not any response for parallel case. I just can't understand why don't it get response in parallel case?
          Last edited by me_lanie; Jun 25th, 2012, 12:37 PM.