1

I'm developing message-broker communication between 2 applications: Grails client and Spring Boot micro service. To make my client-side updated in long-polling manner I use WebSockets.

I've successfully configured Grails and Spring Boot to use web sockets over RabbitMQ broker. Grails client gets all publications from Spring Boot as expected.

But I faced a problem to send message from my JS code on Grails side to Spring Boot handler on server side.

I follows all default configuration from: https://github.com/zyro23/grails-spring-websocket/blob/010ea1fb3557a63b6ce0d87a0b055f6cbc7df319/README.md

The same config I used to write on Spring Boot side:

  @Override
    public void configureMessageBroker(MessageBrokerRegistry config) {
        config.enableStompBrokerRelay("/topic", "/queue")
                .setRelayHost(brokerRelayHost)
                .setSystemLogin(brokerRelayUsername)
                .setSystemPasscode(brokerRelayPassword)
        config.setApplicationDestinationPrefixes("/app");
    }

    @Override
    public void registerStompEndpoints(StompEndpointRegistry registry) {
        registry.addEndpoint("/stomp").withSockJS()
    }

My client code call:

client.send("/app/hello", {}, JSON.stringify("world"));

But annotation @MessageMapping("/hello") doesn't work on my Spring boot handler methods.

Another one strange thing that when I enable Grails handlers with the same annotation they works good and receives all messages.

I've monitored RabbitMQ admin console and seems like in case with Spring Boot handlers client never send message to broker.

Did anybody find the same issue with cross-application web socket message sending?

Thanks in advance!

ybondar
  • 399
  • 2
  • 18

0 Answers0