Broker

Event-Handling Middleware

In Streamer, the event broker is a pub/sub-based middleware that mediates the communication of event messages between producer actor and consumer actor. Its role is to manage the publication and subscription of events, allowing different components or services to communicate with each other without direct coupling.

The Event Broker acts as a centralized hub that receives events from event producers and distributes them to event consumers. The producer and consumer actors are not directly aware of each other. They interact mostly through the event broker, although synchronous communication among actors is permitted in some cases. Each Streamer instance may own an arbitrary number of actors, but each actor can only belong to one Streamer instance at a time.

The event broker only manages intra-process event handling. For inter-process event communication, it requires assistance from some specifically designed actors.

Responsibilities

In Streamer, the responsibilities of an event broker in include:

  • Consumer Registry: Maintaining a registry of active subscribers/consumers and ensuring that events are delivered to their destinations.

  • Subscription Management: Managing the process of subscription for event consumers.

  • Event Routing: Routing the flow of events from publishers to subscribers.

Definition

type StatefulBroker struct {
	producers []Producer
	consumers []Consumer
	buffers   map[string]streamBuffer
}

Last updated