Implement a Queue service in NodeJS/JAVA (or your preferred language). Implement all the features that you think should be supported by a queuing service/message broker, like:
- Receive a message.
- Store messages.
- Send messages to a consumer one-by-one or in bulk when a consumer requests messages.
- Acks and Nacks: If the consumer successfully acks the message, the message should get deleted from the queue. When a message is nacked, it should appear back in the queue to be consumed by any consumer immediately.
- Visbility timeout: If a consumer gets a message, no other consumer should see that message for
Visbility timeout
seconds. If the message is nacked/acked by this time, good enough. If not, the message should again be visible. - Deadletter settings: If the message is nacked more than a specified number of times, the message is moved to a dead letter queue.
Also create a library that contains functions to interact with the queue / manage the queue.
Please create a technical design document and share that first. For implementation, time box it to 3-4 hours. Whatever you can manage with that, please share that.