Documentation ¶
Index ¶
- type Dispatcher
- func (d *Dispatcher) DispatchChannel() <-chan interface{}
- func (d *Dispatcher) IngressChannel() chan<- *ScheduledMessage
- func (d *Dispatcher) Pause() error
- func (d *Dispatcher) Resume() error
- func (d *Dispatcher) Shutdown(ctx context.Context, drainImmediately bool) error
- func (d *Dispatcher) Start() error
- type DispatcherConfig
- type ScheduledMessage
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Dispatcher ¶
type Dispatcher struct {
// contains filtered or unexported fields
}
Dispatcher processes the ingress and dispatching of scheduled messages.
func NewDispatcher ¶
func NewDispatcher(config *DispatcherConfig) (*Dispatcher, error)
NewDispatcher creates a new instance of a Dispatcher.
func (*Dispatcher) DispatchChannel ¶
func (d *Dispatcher) DispatchChannel() <-chan interface{}
DispatchChannel returns a receive-only channel of type `interface{}`.
func (*Dispatcher) IngressChannel ¶
func (d *Dispatcher) IngressChannel() chan<- *ScheduledMessage
IngressChannel returns the send-only channel of type `ScheduledMessage`.
func (*Dispatcher) Pause ¶
func (d *Dispatcher) Pause() error
Pause updates the state of the Dispatcher to stop processing messages and will close the main process loop.
func (*Dispatcher) Resume ¶
func (d *Dispatcher) Resume() error
Resume updates the state of the Dispatcher to start processing messages and starts the timer for the last message being processed and blocks.
func (*Dispatcher) Shutdown ¶
func (d *Dispatcher) Shutdown(ctx context.Context, drainImmediately bool) error
Shutdown will attempt to shutdown the Dispatcher within the context deadline, otherwise terminating the process ungracefully.
If drainImmediately is true, then all messages will be dispatched immediately regardless of the schedule set. Order can be lost if new messages are still being ingested.
func (*Dispatcher) Start ¶
func (d *Dispatcher) Start() error
Start initializes the processing of scheduled messages and blocks.
type DispatcherConfig ¶
type DispatcherConfig struct { IngressChannelSize int DispatchChannelSize int MaxMessages int GuaranteeOrder bool }
DispatcherConfig config for creating an instance of a Dispatcher
type ScheduledMessage ¶
ScheduledMessage is a message to schedule with the Dispatchers ingest channel `At` is when the message will dispatched `Message` is the content of the message