spring-projects / spring-framework

Spring Framework
https://spring.io/projects/spring-framework
Apache License 2.0
56.69k stars 38.14k forks source link

Handle STOMP messages from client session in order #21798

Closed spring-projects-issues closed 1 year ago

spring-projects-issues commented 6 years ago

Marcus Held opened SPR-17265 and commented

In my project I have the case that a client can potentially send a lot of messages simultaneously (which we prefer to avoid, but still can happen. Esp. with hacked clients). This leads to many different threads to modify the state of the same entity which then cause optimistic locking exceptions.

To avoid this I'd like to process all messages of the same client in the same thread. This behavior could be achieved by configuring a ThreadPoolTaskExecutor that distributes the messages accordingly. This strategy was suggested in this stackoverflow question.


1 votes, 2 watchers

rstoyanchev commented 1 year ago

This is similar to #18562 but for the clientInboundChannel. Most of the logic is in OrderedMessageChannelDecorator which is used to decorate the brokerChannerl. We could do the same but for the clientInboundChannel enabled through an additional property similar to preservePublishOrder.