We have a JHipster microservice application with websockets. Currently, the main microservice (with frontend) is the one who send/receives messages through websockets relying on RabbitMQ as relay for the topics. We have configured Spring WebSockets + RabbitMQ like described in this blog post: http://djeison.me/2017/11/04/spring-websocket-rabbitmq/
Can I send a message to a topic from the other microservices in my architecture if I also configure this other microservices to relay to the same RabbitMQ instance?
Edit:
Here is the configuration class for Spring Websockets to relay on RabbitMQ. This is in the main microservice, where there are STOMP WebSockets with the frontend Angular application:
@Configuration
@EnableWebSocketMessageBroker
public class WebSocketConfig extends AbstractWebSocketMessageBrokerConfigurer {
@Override
public void configureMessageBroker(MessageBrokerRegistry config) {
config
.setApplicationDestinationPrefixes("/app")
.enableStompBrokerRelay("/topic")
.setRelayHost("localhost")
.setRelayPort(61613)
.setClientLogin("guest")
.setClientPasscode("guest");
}
@Override
public void registerStompEndpoints(StompEndpointRegistry registry) {
registry.addEndpoint("/websocket-app").withSockJS();
}
}
My question is if I replicate this configuration in another microservice will it be able to reach the frontend application? Will it share the same WebSocket connections relaid to RabbitMQ? Thanks in advance.
Reactor2TcpStompClient
from spring-messaging package. It will not share websocket connection, it make its' own connection to Rabbit. – user1516873session.send
,session.subscribe
– user1516873