Overview: The Producer-Consumer Pattern

Take a look at what you’ll learn in this chapter.

We'll cover the following

When deciding on a communication pattern for an application, it is normal to look at the circumstances under which components might communicate with one another. Typical web applications follow a request/response pattern, where a request is made to the server, and a response is returned to the client and handled appropriately. For applications looking to handle high throughput in those communication channels, a standard request/response pattern is not ideal.

Objective

With hundreds or thousands of requests being sent per second, the application would be slowed to a halt as every request is met with a corresponding response. Another example is that of a long-running process. There might be an operation that gets kicked off by one event but doesn’t complete until several hours later. Blocking the thread running that process would limit execution ability, and ultimately, the system only needs to know when the process completes. Scenarios such as this call for a more resilient and asynchronous messaging pattern.

Get hands-on with 1400+ tech skills courses.