0
votes

We want to use Google pub/sub to consume messages. In rabbitMQ, whenever a message published, we were getting it and processing it. Our process operation takes 3-4 hours and because of that our consumers are windows services.

We dont want to use pub/sub pull because we dont want to poll. But Pub/sub push publishing to a web endpoint. Because of our long running process, we cannot use web app or web api. Is there any chance to consume pub/sub messages like in rabbitmq without requesting always and consuming when there is a message only.

Thanks

1
I'm not following the puzzle. Can you clarify what you mean when you say you don't want to poll? I am imagining a subscriber application which is notified when a new message is available. Where is the polling? - Kolban
@Kolban there are two choices on google pub/sub. Pull or Push. Pull is a one time request. To get newcomer messages, always have to ask in a loop with a pull request. Push is sending immediately without asking but it needs a web endpoint. My operation is a long process and cannot be done in web app. - PepeDeLew
What programming language are you using? When I look here ... cloud.google.com/pubsub/docs/pull I seem to find that for many of the languages, one registers a callback function to be invoked when a new message is available. To me this means that my logic starts and then identifies the specific subscription and registers a callback function. At that point, no further explicit "polling" is required ... when a new message is published, my app "simply" receives the new message. - Kolban
@Kolban I am using c# but I think documentation mislead me (in cloud.google.com/pubsub/docs/subscriber it is telling that "The subscribing application explicitly calls the pull method, which requests messages for delivery. ") and I used subscriberServiceApiClient.PullAsync. But your sample works as expected. I don't know if it call pullasync multiple times implicitly but at least I dont have to. Thanks a lot. - PepeDeLew

1 Answers

2
votes

The Google Pub Sub technology does not requires that one continually explicitly poll the PubSub environment. If one is using the client libraries one can configure a callback function within the client application that is invoked when a new message is published to the topic against which the subscription has been taken.