I've ran into a problem with my Azure Cosmos DB trigger. Apparently some of the triggers failed and thus didn't complete sending the data to a specific service. As far as I can see, there is no easy way to 'retrigger' those events, without actually inserting the data in Cosmos again.
I read somewhere that I could insert the incoming data from the trigger into a ServiceBus queue message and handle it from there. Then I can use the deadletter queue to potentially requeue failed items. However, the messages contain a couple kB's of data. I'm not sure if that is wise..
What would be the best way to tackle this issue?
Thanks!
CodePudding user response:
You can only retrigger by
- Modifying the document (replace)
- Manually call the trigger by using the API and pass the document's content
- Put the message into a separate queue as you mentioned
- Use retries on the CosmosDB trigger for short lived transient issues.
We have been doing the ServiceBus solution for quite a bit now without any issues. The maximum message size is 256KB for standard tier, which is plenty.
If the size is really an issue for you, you could only put the documentId into ServiceBus. However this creates a solution that is more read-intensive for your CosmosDB. If you want to avoid that then the solution gets even more complex.
This is already quite opinionated, but the ServiceBus solution is in my experience very robust and not very complex. You can use the manual approach if you only need this very rarely to "fake" re-triggering of the event.