Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Consider adding originalMessage to ErrorMessage [SPR-15459] #22193

Closed
spring-projects-issues opened this issue Apr 18, 2017 · 5 comments
Closed

Consider adding originalMessage to ErrorMessage [SPR-15459] #22193

spring-projects-issues opened this issue Apr 18, 2017 · 5 comments
Labels
in: messaging type: enhancement
Milestone

Comments

@spring-projects-issues
Copy link
Collaborator

@spring-projects-issues spring-projects-issues commented Apr 18, 2017

Gary Russell opened SPR-15459 and commented

In Spring Integration (and derivative projects such as Spring Cloud Stream), we have a need to add property inputMessage or originalMessage or similar to the ErrorMessage.

Typically, the payload of an ErrorMessage is a MessagingException with a failedMessage property containing the message at the point of failure.

The original message at the place in the stack where the exception is caught (and the ErrorMessage created) may be different to the message at the point of failure - it may have gone through several transformations before the exception occurs.

In certain use cases, it would be useful to have access to both messages for error handling purposes. Hence the desire to add this property.

We can (and have) create a subclass for this, but are having a hard time coming up with a good name EnhancedErrorMessage , ExtendedErrorMessage etc.

So we wish to float the idea to add it to the core ErrorMessage since it might be useful elsewhere.

If you concur, we'd be happy to issue a PR. It would be nice to have it in a 4.3.x release too, but we can live with our badly named subclass until 5.0 (or indefinitely if you don't want this in core messaging).

Juergen Hoeller rstoyanchev

EnhancedErrorMessage.


Issue Links:

  • INT-2116 Support Capture of Original Inbound Message in ErrorMessage

Referenced from: pull request #1395, and commits c16c8f2, e93e49f, e677342

@spring-projects-issues
Copy link
Collaborator Author

@spring-projects-issues spring-projects-issues commented Apr 18, 2017

Rossen Stoyanchev commented

We don't seem to be using ErrorMessage in spring-messaging and since we do have it, you're the main driver effectively. A property such as contextMessage (or similar) on ErrorMessage sounds fine to me. What do you think Juergen Hoeller?

@spring-projects-issues
Copy link
Collaborator Author

@spring-projects-issues spring-projects-issues commented Apr 19, 2017

Juergen Hoeller commented

We can definitely add this for 5.0 so that SI 5.0 GA can rely on it from day one. I'm rather reluctant regarding a backport if you got a working solution in place for SI 4.3.x already.

@spring-projects-issues
Copy link
Collaborator Author

@spring-projects-issues spring-projects-issues commented Apr 19, 2017

Juergen Hoeller commented

Gary Russell, would you mind if I changed the toString() output to an ErrorMessage [...] for original GenericMessage [...] style format, without nested braces? I've tried this locally and it looks less convoluted (and avoids the artificial shortening of the parent class toString result).

@spring-projects-issues
Copy link
Collaborator Author

@spring-projects-issues spring-projects-issues commented Apr 19, 2017

Gary Russell commented

Certainly; I have no issue with that. Thanks!

@spring-projects-issues
Copy link
Collaborator Author

@spring-projects-issues spring-projects-issues commented Apr 19, 2017

Gary Russell commented

Much nicer; thanks.

@spring-projects-issues spring-projects-issues added in: messaging type: enhancement labels Jan 11, 2019
@spring-projects-issues spring-projects-issues added this to the 5.0 RC1 milestone Jan 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: messaging type: enhancement
Projects
None yet
Development

No branches or pull requests

1 participant