Reputation: 81
As we are not using stomp for our websocket server, spring doesn't offer message broker framework. My vision is to use spring messaging pub/sub with Redis message store for dev and migrate message broker from Redis to SQS+Dynamo for prod version.
As I exclude (since ios & Android not ready to put stomp client infront due to lack of support) Stomp, spring websocket library doesn't enable pub/sub function as well.
Our Business case example:
Every connected websocket session will initiate request to another microservice (which is a Java websocket client) to get data. My vision is to connect these two service through pub/sub architecture with redis.
Due to business reason we would like to keep 2 services for this use case. Websocket client can connect to customer agent system and its decoupled from our business logic. Our mobile apps will speak to our own websocket server. This gives us a flexibility to add more customization and independent from a specific vendor.
Here is my workaround
As our infrastructure doesn't offer Rabbit MQ support, Redis queue will be replaced by SQS in prod.
Question: Can we create spring integration channels at runtime and bind to specific service or queue? Thought process is to offer one channel per websocket session and delete channel when session ends.
Is there a better alternate solution available in spring integration or spring messaging to execute this use case?
Upvotes: 1
Views: 1620
Reputation: 174554
See the Java DSL Dynamic and Runtime Integration Flows.
You can register and destroy sub flows on-demand.
Keep a reference to the dynamically registered flow id and call remove()
on the context.
Spring integration has built-in Websocket support based on Spring Framework's foundation.
Upvotes: 1