0

I need some advice on the architecture for a background job. I am using Azure Service Bus with at least once gurantee(peek-lock) feature but question is in general for any message queue. Below is the flow:

  1. Producer sends a message in the service bus.
  2. Consumer peeks and locks the message so that other consumers don't pick it up.
  3. Consumer then processes the message and do two things - REST API call to get some work done and checks status and if its 202 it then sends message to another service bus queue.
  4. Consumer then deletes the message from the queue.
  5. If the API call fails or message is not queued to the second service bus or in case the consumer dies after making the API call but before enqueuing the message, the consumer will not delete the message from the service bus so that some other consumer can retry after the lock expires. This will handle retry scenarios imo.
  • Assuming that the API is idempotent, does this sound a reasonable approach?
  • Should I just save the message in a DB and delete it from the service bus first and create another service to do API call and enqueuing it to second service bus?
  • Which approach will be better for high volume messages?
1
  • Could you please share with us more information about the V3s (volume, variety and velocity)? Commented Feb 27, 2023 at 11:33

1 Answer 1

0

Wonderful approach, I would just add the "circuit breaker" design pattern to be able to check if the message has been correctly deleted from the queue.

In AWS I would create a step function which checks if the execution was successful, if it was not then I can handle this scenario.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.