From the course: Building Event-Driven Applications In Go

Unlock this course with a free trial

Join today to access over 24,500 courses taught by industry experts.

Publish-subscribe pattern in Go

Publish-subscribe pattern in Go

- [Instructor] The publish-subscribe pattern is a well-established messaging paradigm used in event-driven architectures. You can also call it pub-sub pattern. Now, this pattern decouples the producers of messages, what we call publishers, from the consumers, which is called subscribers, by utilizing an intermediary, usually a message broker, to manage message routing. In this video, we'll explore how to implement the pub-sub pattern in Go using Kafka. Let's head it over to the coding screen. So, here we are in the code example we're using for this video. I have, first of all, let me show you the events that we are going to work with. The events we're working with, I have the event metadata, which just contains basic information about the event: ID, Timestamp, and EventType. The actual event looks like this, with a reference to the metadata and the actual event payload, Body. And the payload has references to PaymentID, OrderId OccuredAt, Amount, Status, and Currency. I then have two…

Contents