Get hands-on experience with 20+ free Google Cloud products and $300 in free credit for new customers.

NET client SubscriberServiceApiClient.Pull method to return immediately if no messages on topic

Using the NET client API, how is it possible to achieve the same functionality with  SubscriberServiceApiClient Pull (or PullAsync) method as with the now deprecated returnImmediately parameter such that the PULL method returns to the caller immediately , with no exception raised, if there are no messages present on the topic?  I have tried to set the call setting parameter with a Timeout expiration:

CallSettings.FromExpiration(Expiration.FromTimeout(TimeSpan.FromSeconds(1)))

but this seems to result in an exception of DeadlineExceeded.

The default behaviour seems to timeout around 12 seconds when there are no messages on the topic, which is not ideal.

many thanks

0 3 695
3 REPLIES 3