Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func OnMeowCreated ¶
func OnMeowCreated(f func(MeowCreatedMessage)) error
OnMeowCreated executes a function when MeowCreated
func PublishMeowCreated ¶
PublishMeowCreated send an event to all subscribers
func SubscribeMeowCreated ¶
func SubscribeMeowCreated() (<-chan MeowCreatedMessage, error)
SubscribeMeowCreated adds a new subscriber for the event
Types ¶
type EventStore ¶
type EventStore interface { Close() PublishMeowCreated(meow schema.Meow) error SubscribeMeowCreated() (<-chan MeowCreatedMessage, error) OnMeowCreated(f func(MeowCreatedMessage)) error }
EventStore is an interface for store events
type MeowCreatedMessage ¶
MeowCreatedMessage is the event created when the Meow is created
func (*MeowCreatedMessage) Key ¶
func (m *MeowCreatedMessage) Key() string
Key returns the key of event created
type NatsEventStore ¶
type NatsEventStore struct {
// contains filtered or unexported fields
}
NatsEventStore represents the EventStore that will be used into nats
func NewNats ¶
func NewNats(url string) (*NatsEventStore, error)
NewNats creates a new connections to Nats server
func (*NatsEventStore) Close ¶
func (e *NatsEventStore) Close()
Close closes the connection, unsubscribes the subscription and closes the channel
func (*NatsEventStore) OnMeowCreated ¶
func (e *NatsEventStore) OnMeowCreated(f func(MeowCreatedMessage)) (err error)
OnMeowCreated executes a function on after Event MeoewCreatedMessage was fired
func (*NatsEventStore) PublishMeowCreated ¶
func (e *NatsEventStore) PublishMeowCreated(meow schema.Meow) error
PublishMeowCreated publishes the Event to nats Subscribers
func (*NatsEventStore) SubscribeMeowCreated ¶
func (e *NatsEventStore) SubscribeMeowCreated() (<-chan MeowCreatedMessage, error)
SubscribeMeowCreated creates a subscriber for the event