Skip to content

Future<Message> as a result of MessageChannelTemplate.sendAndReceive [INT-972] #4982

Closed

Description

@spring-operator

Andrew Skiba opened INT-972 and commented

sendAndReceive has a unique and useful feature: temporary reply channel, but it's a synchronous method. So it would be useful to have an asynchronous method to send to a few channels and wait for all to reply. It might have a very similar API like this:

Future<Message<?>> sendAndReceiveFuture(final Message<?> request, final MessageChannel channel)

The changes in the code would be relatively small. Without this feature and without a temporary reply channel available as public class it's very hard to send to a few channels and wait for replies in parallel.


Reference URL: http://forum.springsource.org/showthread.php?p=280809#post280809

Attachments:

Issue Links:

Activity

  1. spring-operator commented on Jan 28, 2010

    @spring-operator
    ContributorAuthor

    Mark Fisher commented

    I have some code like this in the sandbox. The main question I have is whether it should be a new method ("asyncSendAndReceive") or a new class AsyncMessageChannelTemplate.

  2. spring-operator commented on Jan 28, 2010

    @spring-operator
    ContributorAuthor

    Andrew Skiba commented

    IMO it must be a new method. Of course sendAndReceiveFuture is a word play (Future version of the same method and "receive Future<>" instead of receiving message), and async is better name.

    So I think a new method is better because send() is already asynchronous (if the channel is a queue) and the receive() must stay synchronous because there is no point to get a Future of a random channel message. But sendAndReceive() is the only method (I ignore the convention overload) which can give added value by sending now and receiving later.

    Hope that makes sense.

  3. spring-operator commented on Jan 28, 2010

    @spring-operator
    ContributorAuthor

    Mark Fisher commented

    It definitely makes sense. In fact, your point about the "send" already being async if the channel itself is makes me wonder if 'asyncSendAndReceive' might not be such a great name after all. Maybe something like 'asyncSendAndReceiveLater' would be better :)

  4. spring-operator commented on Feb 16, 2010

    @spring-operator
    ContributorAuthor

    Andrew Skiba commented

    Patch with basic implementation of the feature.

  5. spring-operator commented on Feb 16, 2010

    @spring-operator
    ContributorAuthor

    Andrew Skiba commented

    fixed patch

  6. spring-operator commented on Nov 13, 2014

    @spring-operator
    ContributorAuthor

    Artem Bilan commented

    Fixed with #5406

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions