Skip to content

Instantly share code, notes, and snippets.

@ankitwww
Last active May 20, 2020 23:30
Show Gist options
  • Save ankitwww/38bb53aa960d0de47e808851000fc0d7 to your computer and use it in GitHub Desktop.
Save ankitwww/38bb53aa960d0de47e808851000fc0d7 to your computer and use it in GitHub Desktop.

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:

  1. Receive a message.
  2. Store messages.
  3. Send messages to a consumer one-by-one or in bulk when a consumer requests messages.
  4. 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.
  5. 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.
  6. 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment