Documentation ¶
Overview ¶
Author: Bo Maryniuk Bus connector
Index ¶
- Constants
- type NatsURL
- type WzEventMsgUtils
- type WzGenericMessage
- type WzdPubSub
- func (wzd *WzdPubSub) AddNatsServerURL(host string, port int) *WzdPubSub
- func (wzd *WzdPubSub) Disconnect()
- func (wzd *WzdPubSub) GetPublisher() *nats.Conn
- func (wzd *WzdPubSub) GetSubscriber() *nats.Conn
- func (wzd *WzdPubSub) IsConnected() bool
- func (wzd *WzdPubSub) PublishEnvelopeToChannel(channel string, envelope *WzGenericMessage)
- func (wzd *WzdPubSub) Start()
Constants ¶
const ( MSGTYPE_GENERIC = iota // Also undefined when loading MSGTYPE_REGISTRATION MSGTYPE_PING MSGTYPE_RUN_RESULT MSGTYPE_CLIENT )
const ( PAYLOAD_RSA = "rsa.pub" // cipher text in PEM PAYLOAD_RSA_SIGNATURE = "rsa.sig" // signature PAYLOAD_RSA_FINGERPRINT = "rsa.fp" // fingerprint PAYLOAD_SYSTEM_ID = "system.id" // unique string of system ID PAYLOAD_SYSTEM_FQDN = "system.fqdn" // Host FQDN or just a hostname PAYLOAD_PING_ID = "ping.id" // ID of a ping request /* Function return payload. The value is a nested string/interface mapping which can contain whatever specific. This resides one level deeper from the fixed keys. */ PAYLOAD_FUNC_RET = "function.return" /* Size of batch. If a message is way too big, it should be then splitted into a series of those. Each batch message should always contain the same JID, so they then can be rejoined on the other hand back into one message. The "batch.size" denotes N messages: "X of N". */ PAYLOAD_BATCH_SIZE = "batch.size" PAYLOAD_COMMAND = "command" // specific key of the command, still ad-hoc :-( PAYLOAD_COMMAND_PARAMS = "command.params" // command params, usually map@strings/interface )
Message keys
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type WzEventMsgUtils ¶
type WzEventMsgUtils struct {
wzlib_logger.WzLogger
}
func NewWzEventMsgUtils ¶
func NewWzEventMsgUtils() *WzEventMsgUtils
NewWzEventMsgUtils creates a constructor for message utils
func (*WzEventMsgUtils) GetMessage ¶
func (mu *WzEventMsgUtils) GetMessage(data []byte) (envelope *WzGenericMessage)
GetMessage converts message bytes into a WzGenericMessage type
type WzGenericMessage ¶
type WzGenericMessage struct { Jid string Type int Payload map[string]interface{} wzlib_utils.WzMachineIDUtilConsumer }
Console Message
func NewWzGenericMessage ¶
func NewWzGenericMessage() *WzGenericMessage
NewWzGenericMessage creates a generic type of a message with no Jid
func NewWzMessage ¶
func NewWzMessage(msgType int) *WzGenericMessage
NewWzMessage creates a message of a given type with Jid
func (*WzGenericMessage) GetSignableMessageContent ¶
func (wcb *WzGenericMessage) GetSignableMessageContent() []byte
GetSignableMessageContent as bytes Extract certain fields together with message JID, join them into one message body and sign. The same content is used to verify the message authenticity
func (*WzGenericMessage) LoadBytes ¶
func (wcm *WzGenericMessage) LoadBytes(data []byte) error
LoadBytes loads the message from bytes
func (*WzGenericMessage) Serialise ¶
func (wcm *WzGenericMessage) Serialise() ([]byte, error)
Serialise to bytes array
type WzdPubSub ¶
type WzdPubSub struct { wzlib_logger.WzLogger // contains filtered or unexported fields }
func NewWizPubSub ¶
func NewWizPubSub() *WzdPubSub
func (*WzdPubSub) AddNatsServerURL ¶
AddNatsServerURL adds NATS server URL to the cluster of servers to connect
func (*WzdPubSub) GetPublisher ¶
func (wzd *WzdPubSub) GetPublisher() *nats.Conn
func (*WzdPubSub) GetSubscriber ¶
func (wzd *WzdPubSub) GetSubscriber() *nats.Conn
func (*WzdPubSub) IsConnected ¶
IsConnected currently only indicates if the connection is initialised
func (*WzdPubSub) PublishEnvelopeToChannel ¶
func (wzd *WzdPubSub) PublishEnvelopeToChannel(channel string, envelope *WzGenericMessage)