message

package
v2.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 17, 2026 License: Apache-2.0 Imports: 7 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	TypeNone         = ""
	TypeSet          = "set"
	TypeRequest      = "request"
	TypePresentation = "presentation"
	TypeAction       = "action"
)

Commands

Variables

This section is empty.

Functions

This section is empty.

Types

type DeliveryStatus

type DeliveryStatus struct {
	ID      string `json:"id" yaml:"id"`
	Success bool   `json:"success" yaml:"success"`
	Message string `json:"message" yaml:"message"`
}

DeliveryStatus definition

type Message

type Message struct {
	ID           string               `json:"id" yaml:"id"`
	GatewayID    string               `json:"gatewayId" yaml:"gatewayId"`
	NodeID       string               `json:"nodeId" yaml:"nodeId"`
	SourceID     string               `json:"sourceId" yaml:"sourceId"`
	Type         string               `json:"type" yaml:"type"`                 // Message type: set, request, ...
	Payloads     []Payload            `json:"payloads" yaml:"payloads"`         // payloads
	Labels       cmap.CustomStringMap `json:"labels" yaml:"labels"`             // these labels can be used in transport or other purpose
	IsAck        bool                 `json:"isAck" yaml:"isAck"`               // Is this acknowledgement message
	IsReceived   bool                 `json:"isReceived" yaml:"isReceived"`     // Is this received message
	IsAckEnabled bool                 `json:"isAckEnabled" yaml:"isAckEnabled"` // Is Acknowledge enabled?
	IsSleepNode  bool                 `json:"isSleepNode" yaml:"isSleepNode"`   // Is this message for active node or sleep node?
	Timestamp    time.Time            `json:"timestamp" yaml:"timestamp"`
	Validity     string               `json:"validity,omitempty" yaml:"validity,omitempty"` // if the message entered in to sleeping queue, validity duration
}

Message definition

func NewMessage

func NewMessage(isReceived bool) Message

NewMessage returns empty message

func (*Message) Clone

func (m *Message) Clone() *Message

Clone a message

func (*Message) GetID

func (m *Message) GetID() string

GetID returns unique ID for this message

type Payload

type Payload struct {
	Key        string               `json:"key" yaml:"key"`               // it is id for the the fields. for node, source key says what it is
	Value      customTY.StringData  `json:"value" yaml:"value"`           // 1, true, 99.45, started, 72.345,45.333, any...
	MetricType string               `json:"metricType" yaml:"metricType"` // none, binary, gauge, counter, geo ...
	Unit       string               `json:"unit" yaml:"unit"`             // Volt, MilliVolt, °C, °F, ⚡, etc...
	Labels     cmap.CustomStringMap `json:"labels" yaml:"labels"`         // labels for this data
	Others     cmap.CustomMap       `json:"others" yaml:"others"`         // can hold other than key, value data.
}

Payload definition

func NewPayload

func NewPayload() Payload

NewPayload returns empty payload

func (*Payload) Clone

func (p *Payload) Clone() Payload

Clone a data

func (*Payload) SetValue

func (p *Payload) SetValue(value string)

sets payload value

type RawMessage

type RawMessage struct {
	ID           string         `json:"id" yaml:"id"`
	IsReceived   bool           `json:"isReceived" yaml:"isReceived"`
	IsAckEnabled bool           `json:"isAckEnabled" yaml:"isAckEnabled"`
	Data         interface{}    `json:"data" yaml:"data"`
	Timestamp    time.Time      `json:"timestamp" yaml:"timestamp"`
	Others       cmap.CustomMap `json:"others" yaml:"others"`
}

RawMessage from/to gateway media

func NewRawMessage

func NewRawMessage(isReceived bool, data []byte) *RawMessage

NewRawMessage returns empty message

func (*RawMessage) Clone

func (rm *RawMessage) Clone() *RawMessage

Clone func

func (*RawMessage) MarshalJSON

func (rm *RawMessage) MarshalJSON() ([]byte, error)

MarshalJSON for RawMessage, Data should be printed as string on the log

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL