Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct { // EventProvider is the event provider to replay events from. EventProvider publisher.EventProvider // Interval specifies the interval at which the event cache is checked for // events that need to be replayed. Interval time.Duration // ReplayAfter is a list of time durations after which events should be // replayed. ReplayAfter []time.Duration }
Config is the configuration for EventProvider.
type EventProvider ¶
type EventProvider struct {
// contains filtered or unexported fields
}
EventProvider replays events from the event provider at configurable time periods. It is used to guarantee that events are eventually delivered to subscribers even if they are not online at the time the event was published.
It wraps another event provider and forwards all events from that provider, at the same time all received events are cached. The cache is checked at the configured interval, and events that are older than the configured playback periods are replayed. Events are removed from the cache when they are older than the oldest playback period.
func New ¶
func New(cfg Config) (*EventProvider, error)
New returns a new instance of the EventProvider struct.
func (*EventProvider) Events ¶
func (r *EventProvider) Events() chan *messages.Event
Events implements the publisher.EventPublisher interface.