Page 2 of 2 FirstFirst 12
Results 11 to 16 of 16

Thread: Asynchronous request reply correlation (again)

  1. #11
    Join Date
    Mar 2010
    Location
    Gtr Philadelphia, PA
    Posts
    2,139

    Default

    Deleted: See May21 11:23pm post for a better work-around.
    Last edited by Gary Russell; May 21st, 2011 at 10:29 PM. Reason: Remove kludgy workaround
    Gary P. Russell
    Spring Integration Team
    SpringSource, a division of VMware

  2. #12
    Join Date
    Aug 2009
    Location
    Lima, Perú
    Posts
    38

    Default

    Yep, anyway tried the first suggestion with the same exception. Yet I didn't try extending the AbstractAggregatingMessageGroupProcessor.

    For the other suggestion, I believe that the header-enricher will need access to the aggregator's MessageStore in order to do the correlation by itself and find the request message. My correlation/release beans are stateless so I can't see how they will help me, or I'm missing something?

    Thanks for your help!
    Last edited by Diego Bravo; May 21st, 2011 at 09:32 PM.

  3. #13
    Join Date
    Mar 2010
    Location
    Gtr Philadelphia, PA
    Posts
    2,139

    Default

    Here's a cleaner work-around; I just tested this and it works fine...

    Code:
    public Message<String> aggregate(List<Message<String>> in) {
    	return MessageBuilder.fromMessage(in.get(1))
    		.setHeader("requestReplyChannel", in.get(0).getHeaders().getReplyChannel())
    		.build();
    }
    Code:
    <int:aggregator input-channel="in" ref="agg" output-channel="route.reply"/>
    
    <int:header-enricher input-channel="route.reply">
    	<int:header name="replyChannel" expression="headers.requestReplyChannel"/>
    </int:header-enricher>
    	
    <bean id="agg" class="org.myco.aggregator.gpr.GprAgg"/>
    i.e. Copy the replyChannel to a temporary header; route the aggregator output to a header-enricher, and voila.
    Gary P. Russell
    Spring Integration Team
    SpringSource, a division of VMware

  4. #14
    Join Date
    Aug 2009
    Location
    Lima, Perú
    Posts
    38

    Default

    it's working for me too... Awesome!

    Thanks a lot for your help and patience Gary!

  5. #15
    Join Date
    Mar 2010
    Location
    Gtr Philadelphia, PA
    Posts
    2,139

    Default

    Glad to help.

    I opened an improvement JIRA issue https://jira.springsource.org/browse/INT-1913, if you want to watch it.
    Gary P. Russell
    Spring Integration Team
    SpringSource, a division of VMware

  6. #16
    Join Date
    Mar 2010
    Location
    Gtr Philadelphia, PA
    Posts
    2,139

    Post

    BTW, this works too..

    Code:
    public Message<String> aggregate(List<Message<String>> in) {
    	return MessageBuilder.fromMessage(in.get(1))
    		.setReplyChannel((MessageChannel) in.get(0).getHeaders().getReplyChannel())
    		.build();
    }
    Code:
    <int:aggregator input-channel="in" ref="agg" output-channel="route.reply"/>
    
    <int:service-activator input-channel="route.reply" expression="payload"/>
    But it's perhaps not as obvious as to why it works :-)
    Gary P. Russell
    Spring Integration Team
    SpringSource, a division of VMware

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •