Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Broker ¶
type Broker[T Value] interface { // Init initializes the provider itself. Init(...Option) // String returns the implementation name. String() string // Publish receives an event and sends it to its corresponding queue. Publish(*Event[T], ...PublishOption) error // Subscribe returns an event subscriber. Subscribe(...SubscribeOption) (Subscriber[T], error) }
Broker is a generic interface for asynchronous events transport.
type Event ¶
type Event[T Value] struct { // Kind names the event type. Kind Kind // Time is when this event is emitted. If zero, the current time will be used. Time time.Time // Queue is the group of watchers this event will be dispatched to. Queue string // Values curries a series of values to be consumed by subscribers. Values []T // Metadata curries optional values. Metadata metadata.MD }
Event is a generic event.
type PublishOption ¶
type PublishOption func(*PublishOptions)
func PublishContext ¶
func PublishContext(c context.Context) PublishOption
type PublishOptions ¶
type SubscribeOption ¶
type SubscribeOption func(*SubscribeOptions)
func Queue ¶
func Queue(name string) SubscribeOption
type SubscribeOptions ¶
type SubscribeOptions struct { // Queue specifies a queue to subscribe events from. Queue string }
Click to show internal directories.
Click to hide internal directories.