Publisher facade changes for SB Failure logging
Introduction
Flow
PUT call to ingest record-->Record ingested in Cosmos db-->notification published to the Service bus---> Used by indexer services to make the record searchable.
Problem statement:
The record get ingested in cosmos but the notification publish to service bus fails and hence record not searchable.
The approach to handle this case is described below.
Solution approaches:
1st: Add retries logic to Service bus publishing and if it still fails after retry then raise the exception and fail the API with 500 Internal Server Error and keep the record in cosmos as it is. Drawback: The notification for the record ingested in cosmos is lost forever.If you repeat the PUT call again it will create a new version for that record and generate notification for that new version.
2nd: If Service bus publish fails, throw exception and fail the API with 500 internal server error and rollback the record ingested in cosmos.
Drawback: Adding a lot to the latency due to the additional cosmos rollback.
In this MR we have finalized the 1st approach.