Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type PubSub ¶
type PubSub interface { // Publish publishes the object to the channel by name Publish(channel string, obj interface{}) error // PublishN publishes the object to the channel by name to the first N subscribers of the channel PublishN(channel string, obj interface{}, n int) error // Subscribe subscribes to the given channel until the context is cancelled Subscribe(ctx context.Context, channel string, handler func(obj interface{})) error // Subscribe subscribes to the given channel until it receives N messages or the context is cancelled SubscribeN(ctx context.Context, channel string, n int, handler func(msg interface{})) error // SubscribeUntil subscribes to the given channel until the decider returns false for the first time. The subscription breaks when the routine's context is cancelled or the decider returns false. SubscribeUntil(ctx context.Context, channel string, decider func() bool, handler func(msg interface{})) error // SubscribeWhile subscribes to the given channel while the decider returns true. The subscription breaks when the routine's context is cancelled. SubscribeWhile(ctx context.Context, channel string, decider func() bool, handler func(msg interface{})) error Close() }
PubSub is used to asynchronously pass messages between routines.
Click to show internal directories.
Click to hide internal directories.