I\'ve created simplified example which reproduces my real problem.
My example accepts from google pub/sub, logs it and send ack back to the Pub/Sub
You problem is here:
.gateway(acknowledgementFlow);
It means request-reply and we can't guess that your acknowledgementFlow is one-way flow. I see that by your MyPubSubAckHandler implementation which returns void for its handleMessage() implementation. This way a gateway waits for reply, but the real sub-flow will never return any result. Therefore awaiting for reply threads are stuck and eventually your application fail.
One of the solution is to make a GatewayEndpointSpec.replyTimeout() as 0. So, your void sub-flow won't block a main flow for potential reply.
Another way just don't use gateway(), but that sub-flow content directly in the main flow. It really doesn't look like you expect some reply so this should work for you:
return flow -> flow.channel(bucketNotificationChannel())
.handle(handler)
.log(INFO, "Handler finished", m -> {
return "got" + m;
})
.log(DEBUG, "acknowledgementFlow", m -> "Handling acknowledgement for message: " + m)
.handle(pubSubAckHandler);