20

I already have a SimpleBrokerWebsocket implementation. Now I am migrating towards microservices based architecture and trying to create messaging as a separate microservice.

To avoid breaking existing client deployments and to gradually move towards a complete microservice based architecture, I want my old socket end points to redirect to the new socket end points provided by the microservice.

So I need some idea on, how to deal with the authentication and sending messages to correct users.

Also I would like to know how to go about the architecture for this requirement . I would like to use StompBrokerRelay for microservice.

Martin Algesten
  • 13,052
  • 4
  • 54
  • 77
Vivek
  • 326
  • 1
  • 3
  • 15

1 Answers1

4

Generally when you deploy web applications you run them behind a reverse proxy.
In a service oriented architecture this is even more common.
NGINX can perform reverse proxying of websocket connections.
So you can run your application behind NGINX pointing to your original application, then when you are ready to deploy your new websocket microservice, you can configure NGINX to proxy all requests for that particular websocket URL to your new service.
You could also try implementing your own reverse websocket proxy in Java by using a websocket client from your socket handler, but this would be difficult, error prone and slower than using a specialized tool like NGINX.

Magnus
  • 7,952
  • 2
  • 26
  • 52
  • 2
    thanks for your comment..we are already using nginx as a proxy however...currently authentication is managed by our existing system...which we will separate later as another microservice...so after authentication I want to redirect traffic to microservice from my existing application.. So my requirement is to redirect the traffic from application itself. – Vivek Sep 08 '16 at 07:08
  • 1
    @Vivek did you get an answer/solution for this? I'm looking for exactly a solution like this. Please advise if you have cracked it. – Jerokdeep Apr 17 '19 at 00:37