So there will always be two queues in this pattern. With this pattern, the consumer pops from the queue and immediately pushes it to a "processing" queue. This is where the reliable queue comes in. Some examples of this would be if there is a network blip when the consumer is pulling a message from the queue, or if the consumer crashes after it's popped the message from the queue, but has yet to process it / do the work. This works great, but it is not reliable - meaning messages can be lost. A normal queue is one where a producer pushes a message/work item to the queue, and a consumer pops it off the queue and does the work. What is the reliable queue pattern?įirst, let's describe a "normal" queue. In this post we'll be going over the architecture for how a queue works (using the reliable queue pattern) so you can achieve exactly these things. You've built API's before.īut a queue? You might feel like you're flying blind.Īnd if you're using Redis to implement your queue, you might be wondering how Redis even works as the underlying system for a queue.īut if you understood the design patterns involved and could leverage Redis to build a production-quality queue?Īrmed with this knowledge, you could add an architectural pattern to your toolbelt beyond building basic REST API's.Īside from making your application responses faster for whatever is calling your API, being able to work at the architecture-level is often what makes a developer a senior developer. You knew how to build the REST API, that was within your realm of experience and knowledge. The only problem is, working out how a queue actually works is confusing. A new scenario you might not have faced before: you have a long running task (like saving to a bunch of different databases, or processing video) that takes a while to process and it's currently causing your REST API response times to be way too slow for the end user.Īfter some research, you've realized adding a queue to your architecture would solve your problem.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |