Understand the key differences between direct and asynchronous communication:
- With direct channels there is no hand-off between threads, the functionality is all handled in the same thread and exceptions (wrapped in a MessageHandlingException) are propagated and caught as usual
- Asynchronous commmunication - for example a queue channel - involves multiple threads, this creates complexity like how to pass back exceptions and transaction management (the standard transaction context is thread bound). To handle the asynchronous exception problem SI wraps the exception in an ErrorMessage and places it on an error channel (again read the Error Handling link to understand which error channel it will choose). You can call getPayload() and generally cast the result to a MessagingException.
No comments:
Post a Comment