Skip to content

MessagingTemplate send methods should return void but throw exceptions for timeouts, etc. [INT-1301] #5253

Closed

Description

@spring-operator

Mark Fisher opened INT-1301 and commented

Currently, MessagingTemplate send methods return the boolean value as returned by the underlying MessageChannel send() method. At the template level, we should actually always throw an Exception for 'false' returns there. Most likely this would be a "timeout" condition (otherwise the underlying channel would already be throwing a runtime Exception that simply propagates).

If someone has a real need to send and handle a false return for timeouts, they should be working at a lower level, directly with the MessageChannel itself. However, since the MessagingTemplate is used in many places within the framework, such as the MessageHandler implementations, we need to close the gap where a handler implementation (e.g. service-activator or transformer) might silently fail to send a reply Message to its output-channel. By throwing runtime Exceptions we would instead cause those cases to produce a fatal condition for an entire message flow.


This issue is a sub-task of #5137

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