Websocket stomp channel pool config
Skill kjuhwa/skills-hub/skills/backend/websocket-stomp-channel-pool-config
Spring WebSocket STOMP config with separate inbound/outbound task executors and raised transport buffer limits, sized for burst notification fan-out to many role-filtered subscribers.From its SKILL.md
npx -y skills add kjuhwa/skills-hub --skill websocket-stomp-channel-pool-configAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
One thing to look at
- 0 stars0 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.
SKILL.md
2.1 KB, 370 tokens by cl100k_base, as published. Nobody here has run it
WebSocket STOMP Channel Pool Config
Shape
Override WebSocketMessageBrokerConfigurer to provide two independently-sized thread pools (inbound small, outbound larger) and bump transport buffer limits. Authenticate on CONNECT via a channel interceptor that stashes identity/role into session attributes for later routing.
Steps
- Implement
WebSocketMessageBrokerConfigurer. configureClientInboundChannel(CONNECT/SUBSCRIBE/DISCONNECT, lightweight):core=2, max=4, queue=50, keepAlive=30s.
configureClientOutboundChannel(per-subscriber sends, heavy due to authorization filtering):core=4, max=8, queue=200, keepAlive=120s.
configureWebSocketTransport:messageSizeLimit ≈ 10 MB,sendTimeLimit ≈ 1000 s,sendBufferSizeLimit ≈ 1.5 MB.
- Register a
StompChannelInterceptorthat validates JWT onCONNECT, extractsorgId,loginId,roleIds, and stores them in STOMP session attributes. - Track sessions via a
SessionTrackerConfigbean for metrics and forced disconnect. - Use role/org-scoped destinations so broker filtering runs before fan-out work.
Counter / Caveats
- Inbound pool can stay small — outbound is where fan-out cost lives. Don't "scale both the same".
- Raising
sendBufferSizeLimitdelays dropping slow clients — monitor and force-disconnect to protect the broker. - External STOMP broker relay (RabbitMQ) has different tuning; these values target the simple in-memory broker.
- Without the interceptor attaching identity to the session, downstream filtering re-does JWT work on every message.
What ships with it: 1 file
327 B alongside SKILL.md
- content.md327 B