1
votes

What is the benefit of using Spring integartion as sender and receiver for gcp pubsub message? i was publishing the messages using service activator as described here:

https://spring.io/guides/gs/messaging-gcp-pubsub/

Then i have found that GCP cloud library has also support for Publisher in java language as example here: https://cloud.google.com/pubsub/docs/publisher

So i am confused because i see Publisher is more simpler and seems easy to manage retries in case of failure and it has stop to save resources.

Then what is the benefit of using spring Integration in this case? We are not yet on production so is it worth to refactor it and use GCP pubsub direct?

Any best practice or explanation how to choose best library are welcome please.

1

1 Answers

1
votes

Idioms!!

Google Cloud Java Client libraries follow the same idiomatic structure. You can use Secret Manager, Compute or PubSub, you will create and handle the object in the same way. It's google style.

Same things for Spring: use annotation and naming convention and the spring magic occurs! Because you follow the idiomatic structure of Spring.

What is better? If you want to stick absolutely to Spring idioms, use it. If not, use the style that you want, the easiest to understand for the other teams member and the newcomers.

(I love spring, but I prefer to use the Google Cloud client library style. I feel less locked and sticky to a strict structure)