0
votes

I'm using Spring Cloud Stream to send and receive messages from Google Pub/Sub topics and have a question regarding publishing. If I have an @Output MessageChanel and I call channel.send(message) and the call returns normally (no Exceptions), am I guaranteed that Pub/Sub now has the message? I'm looking for something akin to "persistent" message guarantees in JMS systems.

I seem to recall that there are batching parameters and/or async settings that can be configured for publishing and I'd also like to know how this all affects the guarentee, if any. These would seem to complicate any guarantees for sending a single message via channel.send.

Thanks.

1

1 Answers

1
votes

You are correct that Cloud Pub/Sub's Spring integrations by default publish asynchronously. On Spring Integration level, you can control the sync/async switch by using PubSubMessageHandler.setSync(boolean) setter. At that level, it is also possible to set up a publish callback in async mode. Unfortunately, there is no way right now to change this flag from a Spring Cloud Stream integration.

I have a PR out to add the first feature (turning off async) -- https://github.com/spring-cloud/spring-cloud-gcp/pull/2473