Is Pub/Sub events gets ordered?

Is Pub/Sub events gets ordered?

Exp131
Tourist
7 0 2

Hi everyone.

I got into trouble with classic HTTP webhooks, because sometimes when I call a bulk delete variant API method, I get a product/update hook where deleted variants still exist before an updated one. So my question is if I will switch to the Pub/Sub method of getting events will they come with consistent data?

Thanks.

Replies 3 (3)

Luke_K
Shopify Staff
402 66 102

Hey @Exp131 

The bulk delete action can take time to complete. I would compare the timestamps of the Variant ID's to ensure integrity. To answer regarding Pub/Sub(docs), yea I don't see why the data wouldn't be referentially sound. You might like to check out our EventBridge integration too, particularly the Amazon SQS part.

| Shopify |
- Was my reply helpful? Click Like to let me know!
- Was your question answered? Mark it as an Accepted Solution!
Exp131
Tourist
7 0 2

Thank you for your answer. 

But I saw that Pub/Sub messages sometimes contain obsolete data as regular webhooks have. 

For example, when changing a product inventory quantity from 5 to 10, I got two product/update messages. The first one contains inventoryQuantity: 5, and the second: 10. Does it happened because of Shopify's internal logic, and can it be avoided?

Thanks.

Luke_K
Shopify Staff
402 66 102

Hey @Exp131 

So, only one hook should be fired. When I change the quantity only once from the products/inventory page and also changing it only once at products/{product_id}/variants/{product_variant_id} , then I've only the one products/update hook that fires from Shopify, and only product/update hook is received at my local server.

If you'd like to send me through the store name via DM with a product that has happened to (within the past 14 days) I can take a look to see if there's anything I can find. Thanks!

| Shopify |
- Was my reply helpful? Click Like to let me know!
- Was your question answered? Mark it as an Accepted Solution!