message-bus
message-bus copied to clipboard
When is it used?
Your code is great, but I don't know how to use it. Is there a real application scenario?
The most simple example that comes to my mind would be using message-bus as an event bus with event sourcing patter.
Imagine having a large scale application containing a lot of components interacting with each other, and you want a way to make your components communicate while maintaining loose coupling and separation of concerns principles, the Event Bus pattern can be a good solution for your problem. https://dzone.com/articles/design-patterns-event-bus
This is also how i use it https://github.com/vardius/go-api-boilerplate/tree/master/pkg/eventbus for my api boilerplate
another example would be implementing pubsub service.
Let me know if this answers your question.