Documentation
¶
Index ¶
- Variables
- func OnOverflowPileUpOrClose(pileSize uint, timeout time.Duration) onOverflowPileUpOrClose
- func OptionOnOverflow(v OnOverflow) optionOnOverflowT
- func Unsubscribe[E any](ctx context.Context, bus *EventBus, sub *Subscription[E, E]) bool
- func UnsubscribeWithCustomTopic[T, E any](ctx context.Context, bus *EventBus, topic T, sub *Subscription[T, E]) bool
- type EventBus
- type OnOverflow
- type OnOverflowClose
- type OnOverflowDrop
- type OnOverflowWait
- type OnOverflowWaitOrClose
- type Option
- type OptionBeforeSubscribed
- type OptionOnSubscribed
- type OptionOnUnsubscribe
- type OptionQueueSize
- type Options
- type SendEventResult
- type Subscription
- func (sub *Subscription[T, E]) Cancel()
- func (sub *Subscription[T, E]) Done() <-chan struct{}
- func (sub *Subscription[T, E]) EventChan() chan E
- func (sub *Subscription[T, E]) Finish(ctx context.Context) bool
- func (sub *Subscription[T, E]) Ready() <-chan struct{}
- func (sub *Subscription[T, E]) SetReady()
- type SubscriptionCallback
Constants ¶
This section is empty.
Variables ¶
View Source
var LoggingEnabled = false
Functions ¶
func OnOverflowPileUpOrClose ¶
func OptionOnOverflow ¶
func OptionOnOverflow(v OnOverflow) optionOnOverflowT
func Unsubscribe ¶
Types ¶
type OnOverflow ¶
type OnOverflow interface {
// contains filtered or unexported methods
}
OnOverflow defines a behavior if unable to immediately send an event to an subscriber due to the queue being already full.
type OnOverflowClose ¶
type OnOverflowClose struct{}
OnOverflowClose is an OnOverflow that closes the subscription.
type OnOverflowDrop ¶
type OnOverflowDrop struct{}
OnOverflowDrop is an OnOverflow that drops the event.
type OnOverflowWait ¶
OnOverflowWait is an OnOverflow that waits for the given duration (which is infinite if value is <= 0), and drops the event if ultimately was unable to send it.
type OnOverflowWaitOrClose ¶
OnOverflowWaitOrClose is an OnOverflow that waits for the given duration (which is infinite if value is <= 0), and closes the subscription if ultimately was unable to send the event.
type OptionBeforeSubscribed ¶
type OptionBeforeSubscribed[T, E any] SubscriptionCallback[T, E]
type OptionOnSubscribed ¶
type OptionOnSubscribed[T, E any] SubscriptionCallback[T, E]
type OptionOnUnsubscribe ¶
type OptionOnUnsubscribe[T, E any] SubscriptionCallback[T, E]
type OptionQueueSize ¶
type OptionQueueSize uint
type SendEventResult ¶
type SendEventResult struct {
SentCountImmediate uint
SentCountDeferred uint
PiledCount uint
DropCountImmediate uint
DropCountDeferred uint
}
func SendEvent ¶
func SendEvent[E any]( ctx context.Context, bus *EventBus, event E, ) (result SendEventResult)
func SendEventWithCustomTopic ¶
func SendEventWithCustomTopic[T, E any]( ctx context.Context, bus *EventBus, topic T, event E, ) (result SendEventResult)
type Subscription ¶
type Subscription[T, E any] struct { // contains filtered or unexported fields }
func (*Subscription[T, E]) Cancel ¶
func (sub *Subscription[T, E]) Cancel()
func (*Subscription[T, E]) Done ¶
func (sub *Subscription[T, E]) Done() <-chan struct{}
func (*Subscription[T, E]) EventChan ¶
func (sub *Subscription[T, E]) EventChan() chan E
func (*Subscription[T, E]) Ready ¶
func (sub *Subscription[T, E]) Ready() <-chan struct{}
func (*Subscription[T, E]) SetReady ¶
func (sub *Subscription[T, E]) SetReady()
type SubscriptionCallback ¶
type SubscriptionCallback[T, E any] func(context.Context, *Subscription[T, E])
Click to show internal directories.
Click to hide internal directories.