Documentation
¶
Overview ¶
Package bus contains service bus plugin definitions.
Index ¶
- Constants
- Variables
- type ChannelName
- func (i ChannelName) IsAChannelName() bool
- func (i ChannelName) MarshalJSON() ([]byte, error)
- func (i ChannelName) MarshalText() ([]byte, error)
- func (i ChannelName) MarshalYAML() (interface{}, error)
- func (i ChannelName) String() string
- func (i *ChannelName) UnmarshalJSON(data []byte) error
- func (i *ChannelName) UnmarshalText(text []byte) error
- func (i *ChannelName) UnmarshalYAML(unmarshal func(interface{}) error) error
- type IServiceBus
- type InitDataServiceBus
- type MessageType
- func (i MessageType) IsAMessageType() bool
- func (i MessageType) MarshalJSON() ([]byte, error)
- func (i MessageType) MarshalText() ([]byte, error)
- func (i MessageType) MarshalYAML() (interface{}, error)
- func (i MessageType) String() string
- func (i *MessageType) UnmarshalJSON(data []byte) error
- func (i *MessageType) UnmarshalText(text []byte) error
- func (i *MessageType) UnmarshalYAML(unmarshal func(interface{}) error) error
- type RawMessage
Constants ¶
const ( // MsgTTLSeconds describes maximum valid message age. // Message will be discarded if it was send earlier than now()-MsgTTLSeconds. MsgTTLSeconds = 10 // ChWorkerFormat describes formatter for worker messages channel. ChWorkerFormat = "worker-%s" // ChExtendedAPIFormat describes formatter for master <-> worker // extended API plugin. ChExtendedAPIFormat = "api-%s%s" )
Variables ¶
var TypeServiceBus = reflect.TypeOf((*IServiceBus)(nil)).Elem()
TypeServiceBus is a syntax sugar around IServiceBus type.
Functions ¶
This section is empty.
Types ¶
type ChannelName ¶
type ChannelName int
ChannelName describes enum with known service bus channels.
const ( // ChDiscovery describes discovery messages channel. ChDiscovery ChannelName = iota // ChDeviceUpdates describes devices updates channel. ChDeviceUpdates )
func ChannelNameString ¶
func ChannelNameString(s string) (ChannelName, error)
ChannelNameString retrieves an enum value from the enum constants string name. Throws an error if the param is not part of the enum.
func ChannelNameValues ¶
func ChannelNameValues() []ChannelName
ChannelNameValues returns all values of the enum
func (ChannelName) IsAChannelName ¶
func (i ChannelName) IsAChannelName() bool
IsAChannelName returns "true" if the value is listed in the enum definition. "false" otherwise
func (ChannelName) MarshalJSON ¶
func (i ChannelName) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaler interface for ChannelName
func (ChannelName) MarshalText ¶
func (i ChannelName) MarshalText() ([]byte, error)
MarshalText implements the encoding.TextMarshaler interface for ChannelName
func (ChannelName) MarshalYAML ¶
func (i ChannelName) MarshalYAML() (interface{}, error)
MarshalYAML implements a YAML Marshaler for ChannelName
func (ChannelName) String ¶
func (i ChannelName) String() string
func (*ChannelName) UnmarshalJSON ¶
func (i *ChannelName) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaler interface for ChannelName
func (*ChannelName) UnmarshalText ¶
func (i *ChannelName) UnmarshalText(text []byte) error
UnmarshalText implements the encoding.TextUnmarshaler interface for ChannelName
func (*ChannelName) UnmarshalYAML ¶
func (i *ChannelName) UnmarshalYAML(unmarshal func(interface{}) error) error
UnmarshalYAML implements a YAML Unmarshaler for ChannelName
type IServiceBus ¶
type IServiceBus interface { Init(*InitDataServiceBus) error Subscribe(channel string, queue chan RawMessage) error Unsubscribe(channel string) Publish(channel string, messages ...interface{}) Ping() error }
IServiceBus defines service bus plugin interface.
type InitDataServiceBus ¶
type InitDataServiceBus struct { Logger common.ILoggerProvider NodeID string Secret common.ISecretProvider }
InitDataServiceBus has data required for initializing service bus plugin.
type MessageType ¶
type MessageType int
MessageType describes enum with known service bus messages.
const ( // MsgPing describes ping/discovery message sent by worker. MsgPing MessageType = iota // MsgDeviceAssignment describes new devices assignment sent by master. MsgDeviceAssignment // MsgDeviceUpdate describes devices' state update sent by worker. MsgDeviceUpdate // MsgDeviceCommand describes device command sent by master. MsgDeviceCommand // MsgEntityLoadStatus describes status of a config entity. MsgEntityLoadStatus )
func MessageTypeString ¶
func MessageTypeString(s string) (MessageType, error)
MessageTypeString retrieves an enum value from the enum constants string name. Throws an error if the param is not part of the enum.
func MessageTypeValues ¶
func MessageTypeValues() []MessageType
MessageTypeValues returns all values of the enum
func (MessageType) IsAMessageType ¶
func (i MessageType) IsAMessageType() bool
IsAMessageType returns "true" if the value is listed in the enum definition. "false" otherwise
func (MessageType) MarshalJSON ¶
func (i MessageType) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaler interface for MessageType
func (MessageType) MarshalText ¶
func (i MessageType) MarshalText() ([]byte, error)
MarshalText implements the encoding.TextMarshaler interface for MessageType
func (MessageType) MarshalYAML ¶
func (i MessageType) MarshalYAML() (interface{}, error)
MarshalYAML implements a YAML Marshaler for MessageType
func (MessageType) String ¶
func (i MessageType) String() string
func (*MessageType) UnmarshalJSON ¶
func (i *MessageType) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaler interface for MessageType
func (*MessageType) UnmarshalText ¶
func (i *MessageType) UnmarshalText(text []byte) error
UnmarshalText implements the encoding.TextUnmarshaler interface for MessageType
func (*MessageType) UnmarshalYAML ¶
func (i *MessageType) UnmarshalYAML(unmarshal func(interface{}) error) error
UnmarshalYAML implements a YAML Unmarshaler for MessageType
type RawMessage ¶
type RawMessage struct {
Body []byte
}
RawMessage has un-parsed data from the service bus.