Documentation ¶
Overview ¶
Package messagebus handles emitting events to buses like NATS
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetMillisecondsTimestamp ¶
func GetMillisecondsTimestamp() int64
GetMillisecondsTimestamp calculates actual timestamp in milliseconds from epoch
Types ¶
type Config ¶
type Config struct {
// contains filtered or unexported fields
}
Config holds values needed to set-up connection with MessageBus
func (*Config) TryInitialize ¶
TryInitialize initialize connection with message bus. It may fail when bad url was given for example. It will return true on success, false otherwise. */
type DevNullBus ¶
type DevNullBus struct{}
func (*DevNullBus) Publish ¶
func (m *DevNullBus) Publish(v Message)
type Message ¶
type Message interface { }
Message interface representing event being sent to message bus
type MessageBus ¶
type MessageBus interface {
Publish(v Message)
}
MessageBus in an interface to publish events to the bus
func NewNatsMessageBus ¶
func NewNatsMessageBus(configuration Config) (MessageBus, error)
NewNatsMessageBus is constructor for nats connection wrapper
type MessageBusMock ¶
func (*MessageBusMock) Publish ¶
func (m *MessageBusMock) Publish(v Message)
type MessageFactory ¶
type MessageFactory interface {
NewServiceStatus(name string, stype string, org string, msg string) Message
}
MessageFactory easily instantiates events object
type NatsMessageBus ¶
type NatsMessageBus struct { NatsConnection *nats.EncodedConn Subject string }
NatsMessageBus is an implementation of MessageBus interface
func (*NatsMessageBus) Publish ¶
func (n *NatsMessageBus) Publish(m Message)
Publish sends given message to the bus