Functional requirements of this system have been described below.
- Create your own queue that will hold messages in the form of JSON(Standard library with queue implementation were not allowed).
- There can be more than one queue at any given point of time.
- There will be one publisher that can generate messages to a queue.
- There are multiple subscribers that will listen to queues for messages.
- Subscribers should not be tightly coupled to the system and can be added or removed at runtime.
- When a subscriber is added to the system, It registers a callback function which makes an API call to the given end point with the json payload, this callback function will be invoked in case some message arrives.
- Subscriber can consume the messages in batches if the queue has more than one message and it should be configurable.
Bonus: There must be a retry mechanism for handling error cases when some exception occurs in listening/processing a message, that must be retried.
- Make sure that you can execute the code and show that in a working state
- Use an in-memory store for now. No need to use any database to store data
- Make sure code functionality is correct, and edge cases are covered
- Code should be easily testable
- Exceptions are raised and handled appropriately.
- Separation of concerns is addressed.