RetrySettings not working?

755 views
Skip to first unread message

Andrii Abramov

unread,
Dec 5, 2017, 8:07:56 AM12/5/17
to Google Cloud Pub/Sub Discussions
Hi! 

I have the following configuration for topic publisher:


val topic = TopicName.create(config.projectName, config.topicName)

val retrySettings = RetrySettings.newBuilder()
.setRetryDelayMultiplier(7)
.setTotalTimeout(Duration.ofDays(1))
.setInitialRetryDelay(Duration.ofSeconds(5))
.setMaxRetryDelay(Duration.ofDays(1))
.setMaxAttempts(0)
.setInitialRpcTimeout(Duration.ofSeconds(5))
.setRpcTimeoutMultiplier(7)
.setMaxRpcTimeout(Duration.ofDays(1))
.build()

Publisher.defaultBuilder(topic)
.setRetrySettings(retrySettings)
.setCredentialsProvider(config.provider)
.build()

And I have created pull subscription for topic with Acknowledgement deadline = 10 seconds.
If I don't 'ack' the message, PubSub resends me the message in 10 seconds forever.

The result I am trying to achieve is typical:
- Timeout multiplier: x7 (5 sec, 35 sec, etc.)
- Initial retry timeout: 5 seconds
- Max retry duration: 1 day

Could you advice me what I am doing wrong?

Thank you!

Kir Titievsky

unread,
Dec 5, 2017, 9:40:04 AM12/5/17
to aabr...@gmail.com, Google Cloud Pub/Sub Discussions
Andrii,

Publisher retry setting are client-side and determine how the publisher handles errors of the publish() call.  The symptom you are reporting -- re-delivery every ten seconds -- is the property of a subscription. As you've said, your ackDeadline = 10 seconds. That's equivalent to "re-deliver each message if you don't get an ack after 10 seconds."  So there is no reason to believe your publisher codes is not working as you've intended.

Perhaps you are trying to give your subscribers more time to process the message?  In this case, may I recommend you rely on the automatic deadline management of the most recent client libraries (>=google-cloud-java 0.31).  There you just attach a listener to a subscription client and take as much time as you need (up to a configurable limit of 30 min, I think).


Does this help?
k


--
You received this message because you are subscribed to the Google Groups "Google Cloud Pub/Sub Discussions" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cloud-pubsub-dis...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/cloud-pubsub-discuss/b4f14669-e6db-47a4-a95b-9c4d50c7152c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
Kir Titievsky | Product Manager | Google Cloud Pub/Sub 

Andrii Abramov

unread,
Dec 5, 2017, 10:24:13 AM12/5/17
to Google Cloud Pub/Sub Discussions
Hi Kir,

Thank you for quick response!

Well, this does not solve my problem because we chose push strategy for our service.

Can I somehow specify strategy for push subscription, at least maximum attempts / duration? PubSub seems to be very poor about push configuration. 

Kind Regards,
Andrii

вторник, 5 декабря 2017 г., 16:40:04 UTC+2 пользователь Kir Titievsky написал:
To unsubscribe from this group and stop receiving emails from it, send an email to cloud-pubsub-discuss+unsub...@googlegroups.com.

Kir Titievsky

unread,
Dec 5, 2017, 10:42:14 AM12/5/17
to aabr...@gmail.com, Google Cloud Pub/Sub Discussions
Andrii,

Ah.  So: Push servers will automatically back off, exponentially, when your server fails to return a 200 code.   So your strategy might be either to shed load or return 500 error codes when you are overloaded.  This will cause Pub/Sub to reduce the rate of delivery.  The rate will go back up once you consistently return 200s in your responses. Does that make sense?



Kind Regards,
To unsubscribe from this group and stop receiving emails from it, send an email to cloud-pubsub-dis...@googlegroups.com.
--
Kir Titievsky | Product Manager | Google Cloud Pub/Sub 

--
You received this message because you are subscribed to the Google Groups "Google Cloud Pub/Sub Discussions" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cloud-pubsub-dis...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/cloud-pubsub-discuss/40429a55-d866-4fe5-975e-5a4d53ebe799%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

Andrii Abramov

unread,
Dec 5, 2017, 11:04:24 AM12/5/17
to Google Cloud Pub/Sub Discussions
Yes, it does.

But today we faced a situation when PubSub was full of messages (?) and started to spam us ignoring our 404 responses.

We did not receive any new messages until these 404 were not "consumed".


вторник, 5 декабря 2017 г., 17:42:14 UTC+2 пользователь Kir Titievsky написал:

Kind Regards,
To unsubscribe from this group and stop receiving emails from it, send an email to cloud-pubsub-discuss+unsub...@googlegroups.com.
--
Kir Titievsky | Product Manager | Google Cloud Pub/Sub 

--
You received this message because you are subscribed to the Google Groups "Google Cloud Pub/Sub Discussions" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cloud-pubsub-discuss+unsub...@googlegroups.com.

Kir Titievsky

unread,
Dec 5, 2017, 11:06:40 AM12/5/17
to aabr...@gmail.com, Google Cloud Pub/Sub Discussions
That seems broken. Could you please share your project number and subscription name with me privately (off-list) so I can look into this?



Kind Regards,
To unsubscribe from this group and stop receiving emails from it, send an email to cloud-pubsub-dis...@googlegroups.com.
--
Kir Titievsky | Product Manager | Google Cloud Pub/Sub 

--
You received this message because you are subscribed to the Google Groups "Google Cloud Pub/Sub Discussions" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cloud-pubsub-dis...@googlegroups.com.
--
Kir Titievsky | Product Manager | Google Cloud Pub/Sub 

--
You received this message because you are subscribed to the Google Groups "Google Cloud Pub/Sub Discussions" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cloud-pubsub-dis...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/cloud-pubsub-discuss/3e1b0de9-ffad-4eef-aadc-0a1c74e4c0d4%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

Andrii Abramov

unread,
Dec 5, 2017, 11:09:25 AM12/5/17
to Google Cloud Pub/Sub Discussions
Yes, sure.

How should I send it to you? Email?

вторник, 5 декабря 2017 г., 18:06:40 UTC+2 пользователь Kir Titievsky написал:

Kind Regards,
To unsubscribe from this group and stop receiving emails from it, send an email to cloud-pubsub-discuss+unsub...@googlegroups.com.
--
Kir Titievsky | Product Manager | Google Cloud Pub/Sub 

--
You received this message because you are subscribed to the Google Groups "Google Cloud Pub/Sub Discussions" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cloud-pubsub-discuss+unsub...@googlegroups.com.
--
Kir Titievsky | Product Manager | Google Cloud Pub/Sub 

--
You received this message because you are subscribed to the Google Groups "Google Cloud Pub/Sub Discussions" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cloud-pubsub-discuss+unsub...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages