Examining Producers and Consumers
Explore the producer-consumer pattern, its benefits in event-driven systems, and understand its adoption curve for effective application development.
We'll cover the following
The producer-consumer pattern might be more familiar under a different moniker— Publish-Subscribe or pub-sub. While the terminology might differ, the intent behind the messaging pattern is the same. There are components that produce (or publish) events, and there are components that consume (or subscribe to) events. As mentioned in The Sample Application, different mechanisms can support event-based messaging patterns.
Note: We’ve already established that we’ll be using Kafka as the primary mechanism for sourcing events, but if you’ve never used streaming technology before, it might be challenging to understand how streaming is relevant to communication patterns.
Let’s look at a couple of real-world examples, one of which happens to be the core use case for the sample application.
Relating to real-world examples
Developers understand the concept of communication patterns between components, as they enable those patterns while writing a particular application. An extremely popular pattern, which has been employed for decades, is that of request/response. Most people understand this pattern naturally, as it follows a similar pattern to how we, as humans, communicate. If we’re speaking with someone and ask a question, we can generally expect a response from them. While that response might not be exactly what we expect or anticipate, we’ll still receive a response to our query.
Get hands-on with 1200+ tech skills courses.