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

Can't handle SockJsMessageDeliveryException #25048

Closed
okraskat opened this issue May 11, 2020 · 2 comments
Closed

Can't handle SockJsMessageDeliveryException #25048

okraskat opened this issue May 11, 2020 · 2 comments
Assignees
Labels
status: duplicate A duplicate of another issue

Comments

@okraskat
Copy link

okraskat commented May 11, 2020

Affects: 2.1.3.RELEASE

Hi,
I can't handle SockJsMessageDeliveryException in my Spring app. Spring boot version:
2.1.3.RELEASE

releated stackoverflow question

https://stackoverflow.com/questions/61204651/how-can-i-handle-sockjsmessagedeliveryexception-in-spring-app

I tried:

@MessageExceptionHandler({SockJsMessageDeliveryException.class})
public void handle(SockJsMessageDeliveryException e) {
    log.error("Handled websocket exception: " + e.getClass().getSimpleName());
}

and also:

public class SilentErrorSimpMessagingTemplate extends SimpMessagingTemplate {
    private final SimpMessagingTemplate simpMessagingTemplate;

    SilentErrorSimpMessagingTemplate(SimpMessagingTemplate simpMessagingTemplate) {
        super(simpMessagingTemplate.getMessageChannel());
        simpMessagingTemplate.setMessageConverter(new MappingJackson2MessageConverter());
        this.simpMessagingTemplate = simpMessagingTemplate;
    }

    @Override
    public void convertAndSendToUser(@NotNull String user, @NotNull String destination, @NotNull Object payload) throws MessagingException {
        try {
            simpMessagingTemplate.convertAndSendToUser(user, destination, payload);
        } catch (SockJsMessageDeliveryException e) {
            log.error("Socket send error: " + e.getClass().getSimpleName());
        }
    }
}
@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged or decided on label May 11, 2020
@rstoyanchev
Copy link
Contributor

This may be a duplicate of #24986. How do you want to handle the issue?

@rstoyanchev rstoyanchev added the status: waiting-for-feedback We need additional information before we can continue label May 12, 2020
@rstoyanchev rstoyanchev self-assigned this May 12, 2020
@okraskat
Copy link
Author

Avoid logging this exception is enough for me. Thank you for fast feedback.

@rstoyanchev rstoyanchev added status: duplicate A duplicate of another issue and removed status: waiting-for-feedback We need additional information before we can continue status: waiting-for-triage An issue we've not yet triaged or decided on labels May 18, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: duplicate A duplicate of another issue
Projects
None yet
Development

No branches or pull requests

3 participants