Does Google Play "Real-time developer notifications" have an ordering key? And what about redelivers?

Viewed 103

I am using the Real-time developer notifications to handle my app subscriptions. I've read that Pub/Sub messages may be ordered.

I want to execute some logic when the notification type is SUBSCRIPTION_PURCHASED, but if it arrives unordered and after another message, maybe it could be problematic and could be better if I ignore the notification type and deal with the DB data directly. Are Real-time developer notifications ordered?

As I am using Cloud Functions and it unfortunately don't support this Pub/Sub message ordering directly, I would have to create a HTTP endpoint with Functions, set it in Pub/Sub console, and verify myself if the Authorization header is ok.

Also, that list link says the messages are sent at least once, so I could receive that SUBSCRIPTION_PURCHASED again. At which rate they may be redelivered even if ack'ed? How to handle that in CF, where there may be multiple Functions instances running? If the redeliver messages are sent too quickly, maybe I couldn't handle that via DB check.

1 Answers

According to the documentation:

To receive notifications, you need to create a backend server to consume the messages sent to your topic. Your server can then consume these messages by responding to HTTPS requests to a registered endpoint or by using the Cloud Pub/Sub Client Libraries. (which allow ordering).

Also to handle the flow of the rate messages the documentation suggets to using the flow control features of the subscriber to control the rate at which the subscriber receives messages and also you to increase the number of subscriber client instances.

Finally I suggest to check the Dealing with duplicates and forcing retries for more information on how to deal with duplicate information.

Related