I need to write a new API which serviceFoo needs to trigger. This is an asynchronous call, so serviceFoo does not care about the response from my API.
Please help me assess the pros and cons of the two approaches below. (If there are more options, please feel free to add)
- Make the API a fire n forget call. serviceFoo will call the new API. The API will blindly return a 2xx, and AFTER that will proceed with the business logic. serviceFoo does not care about the actual response as long as it gets a 2xx.
- Use a message broker like Kafka or SQS. serviceFoo will write the payload in the broker and the broker will ensure that the message reaches my API.
Some points:
- My new API will be >99% available, plus the expected scale is minimal <5 requests per second.
- Kafka might give the advantage of retry, but I can also configure retries in my fire and forget API, since latency is not an issue.
- Using a broker means more maintenance effort. Plus infra costs.
Aucun commentaire:
Enregistrer un commentaire