Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type PollingConfig ¶
type PollingConfig struct { // MaxBufferSize defines the maximum number of events // per subscription before the oldest events are expired. MaxBufferSize int // DeleteEventAfterRetrieval defines if the event should be // deleted after it is retreived. DeleteAfter bool }
PollingConfig is used to configure the polling manager
type PollingServer ¶
type PollingServer struct { Config *PollingConfig // contains filtered or unexported fields }
PollingServer contains the eventHandler and polling manager that should be passed around to each package. Once the polling server is started via Start(), a package can begin publishing messages via Publish(), or fetch all messages in the queue via GetAll()
func New ¶
func New(cfg *PollingConfig) *PollingServer
New returns a PollingServer struct used to managed the polling server
func (*PollingServer) GetAll ¶
func (p *PollingServer) GetAll() []*Event
GetAll returns and purges all events in the queue
func (*PollingServer) Publish ¶
func (p *PollingServer) Publish(event interface{}) error
Publish will publish an event to the polling queue
func (*PollingServer) ReadAll ¶
func (p *PollingServer) ReadAll() []*Event
ReadAll returns all events in the queue without purging
func (*PollingServer) Start ¶
func (s *PollingServer) Start() *PollingServer
Start will create a new polling server and queue
func (*PollingServer) Stop ¶
func (s *PollingServer) Stop()
Stop shuts down the polling server gracefully