Unable to get STOMP working/connecting in spring-boot on GKE cluster

3/28/2019

I'm trying to get my application running in GKE. I'm using an RabbitMQ instance from cloudamqp. I use this instance for all internal messaging between my microservices through AMQP.

Now I want to send messages to the browser using STOMP over SockJS using the stompRelay. When I connect to the instance locally ( on my dev-machine ), everything works like a charm. Messages get send and acknowledged, ...

When I move the application to production ( GKE ) all the AMQP queues work correctly, but I'm unable to have STOMP working with the relay ... When I use the simpleBroker everything works correctly.

I'm pretty sure the code is correctly as it works correctly from my development PC. I think it has to do with the GKE firewalls intercepting.

I've tried add extra rules to the firewall on gce by allowing all in/out traffic on TCP 61613,61614.

Errors

o.s.m.s.s.StompBrokerRelayMessageHandler : TCP connection failure in session _system_: No CONNECTED frame received in 60000 ms.
r.io.net.impl.netty.tcp.NettyTcpClient   : CLOSED: [id: 0x5d96aa8d, /10.20.6.78:47136 :> xxxxxxxxxx.rmq.cloudamqp.com/35.195.232.78:61613]

My dockerfile

FROM openjdk:8-jre-alpine

RUN apk add --no-cache tzdata
ENV TZ Europe/Brussels

ENV SPRING_PROFILES_ACTIVE production

WORKDIR /app
ADD target/application.jar /app/application.jar

EXPOSE 8080

CMD ["java", "-jar", "application.jar"]

My relay config

    @Override
    public void configureMessageBroker(MessageBrokerRegistry config) {
        config.enableStompBrokerRelay("/topic", "/queue")
                .setRelayHost(relayHost)
                .setRelayPort(relayPort)
                .setSystemLogin(relayLogin)
                .setSystemPasscode(relayPasscode)
                .setVirtualHost(relayVHost)
                .setClientLogin(relayLogin)
                .setClientPasscode(relayPasscode);
    }

I've been struggling for 2 days now trying to get this running ...

Anyone have got STOMP in Spring-boot running on GKE with an external rabbitMQ?

-- Elvander
google-kubernetes-engine
rabbitmq
spring-boot
stomp

1 Answer

3/29/2019

After looking in the config again, I've found a typo which was causing the problems connecting to the RabbitMQ.

@Value("${app.stomp.username:guest}")
private String relayLogin;

But config was

app:
  stomp:
    user: xxxxxxxx
-- Elvander
Source: StackOverflow