Documentation ¶
Index ¶
- Constants
- func BroadcastEvent(ctx context.Context, event EventInterface) error
- func BroadcastNonStreamingEvent(ctx context.Context, event EventInterface) error
- func ListenForBroadcast(serviceName string, eventType string, channel string) (chan []byte, func(), error)
- func ListenForBroadcastOnNC(nc *nats.Conn, serviceName string, eventType, channel string) (chan []byte, func(), error)
- type AuthenticateEvent
- type Event
- func (e *Event) GetChannel() string
- func (e *Event) GetMetadata() map[string]interface{}
- func (e *Event) GetType() string
- func (e *Event) SetChannel(channel string)
- func (e *Event) SetID()
- func (e *Event) SetMetadata(md map[string]interface{})
- func (e *Event) SetSource(source string)
- func (e *Event) SetTime(eventTime time.Time)
- type EventInterface
Constants ¶
View Source
const ( //InternalPrefix prefix to all internal channels InternalPrefix = "_INTERNAL." //InternalChannelPrefix Default channel prefix InternalChannelPrefix = "io.evntsrc." )
Variables ¶
This section is empty.
Functions ¶
func BroadcastEvent ¶
func BroadcastEvent(ctx context.Context, event EventInterface) error
BroadcastEvent attempts to connect to nats server to pub any event and saves to stream
func BroadcastNonStreamingEvent ¶
func BroadcastNonStreamingEvent(ctx context.Context, event EventInterface) error
BroadcastNonStreamingEvent broadcasts an event like BroadcastEvent but uses the non-streaming engine
Types ¶
type AuthenticateEvent ¶
type AuthenticateEvent struct { *Event AuthType string `json:"authType"` Success bool `json:"success"` User string `json:"user"` IP string `json:"ip"` Err string `json:"error,omitempty"` }
AuthenticateEvent publishes to events.auth.auth
type Event ¶
type Event struct { Channel string Type string CEVersion string Source string ID string Time time.Time Metadata map[string]interface{} }
Event is the basic structure all events should include
func (*Event) GetMetadata ¶
GetMetadata returns the current metadata
func (*Event) SetChannel ¶
SetChannel overwrites the event channel
func (*Event) SetMetadata ¶
SetMetadata overrides the existing metadata string map
type EventInterface ¶
type EventInterface interface { GetType() string SetSource(string) SetTime(time.Time) SetID() SetMetadata(map[string]interface{}) GetMetadata() map[string]interface{} GetChannel() string SetChannel(string) }
EventInterface provides required funcs to identify common structured events
Click to show internal directories.
Click to hide internal directories.