I know that spring has websocket scope.
But it means that it will collect values within session.
I need to have something like request scope. It shoud start when we receive values in controller:
@MessageMapping("/common/url")
public void foo(SimpMessageHeaderAccessor headerAccessor, StubObject payLoad) {
Foo foo = someService.toDoSmth();
simpMessagingTemplate.convertAndSendToUser(username, "path/to/queue", foo );
and when last line will be finished it should disappear.
Why do I need this?
I use aspects in my code.
When I receive message I should create entry in database
When I invoke someService
I need update entry which I created in previous step
When I send message through simpMessagingTemplate
I need update entry one more time.