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

Support global @MessageExceptionHandler via @ControllerAdvice in RSocket #26636

Closed
kitkars opened this issue Mar 4, 2021 · 1 comment
Closed
Assignees
Labels
in: messaging Issues in messaging modules (jms, messaging) type: enhancement A general enhancement
Milestone

Comments

@kitkars
Copy link

kitkars commented Mar 4, 2021

This is specific to rSocket.

Add support for global @MessageExceptionHandler using @ControllerAdvice.
Currently @MessageExceptionHandler needs to be part of same controller to handle issues.

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged or decided on label Mar 4, 2021
@kitkars kitkars changed the title Add support for global @MessageExceptionHandler using @ControllerAdvice RSocket - Add support for global @MessageExceptionHandler using @ControllerAdvice Mar 4, 2021
@rstoyanchev rstoyanchev changed the title RSocket - Add support for global @MessageExceptionHandler using @ControllerAdvice Support global @MessageExceptionHandler via @ControllerAdvice in RSocket Mar 5, 2021
@rstoyanchev rstoyanchev added in: messaging Issues in messaging modules (jms, messaging) type: enhancement A general enhancement and removed status: waiting-for-triage An issue we've not yet triaged or decided on labels Mar 5, 2021
@rstoyanchev
Copy link
Contributor

rstoyanchev commented Mar 5, 2021

@ControllerAdvice and ControllerAdviceBean are in spring-web unfortunately and spring-messaging cannot depend on that.

What we could do however is expose a method in RSocketMessageHandler to accept MessagingAdviceBean registrations, which is an interface that can be implemented as a simple wrapper/delegate around a ControllerAdviceBean. That leaves only a small amount of glue code to be done by the application:

ControllerAdviceBean.findAnnotatedBeans(context).forEach(controllerAdviceBean ->
        rsocketMessageHandler.registerAdviceBean(new MessagingAdviceBeanWrapper(controllerAdviceBean));

Spring Boot can probably do that automatically in its RSocketMessagingAutoConfiguration.

@rstoyanchev rstoyanchev added this to the 5.3.5 milestone Mar 5, 2021
@rstoyanchev rstoyanchev self-assigned this Mar 8, 2021
This was referenced Mar 16, 2021
This was referenced Mar 17, 2021
Zoran0104 pushed a commit to Zoran0104/spring-framework that referenced this issue Aug 20, 2021
lxbzmy pushed a commit to lxbzmy/spring-framework that referenced this issue Mar 26, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: messaging Issues in messaging modules (jms, messaging) type: enhancement A general enhancement
Projects
None yet
Development

No branches or pull requests

3 participants