messagelayer

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jun 26, 2019 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildResource

func BuildResource(nodeID, resourceType, resourceID string) (resource string, err error)

BuildResource return a string as "beehive/pkg/core/model".Message.Router.Resource

func GetDeviceID

func GetDeviceID(resource string) (string, error)

GetDeviceID returns the ID of the device

func GetResourceType

func GetResourceType(resource string) (string, error)

GetResourceType returns the resourceType of message received from edge

Types

type ContextMessageLayer

type ContextMessageLayer struct {
	SendModuleName     string
	ReceiveModuleName  string
	ResponseModuleName string
	Context            *context.Context
}

ContextMessageLayer build on context

func NewContextMessageLayer

func NewContextMessageLayer() (*ContextMessageLayer, error)

NewContextMessageLayer create a ContextMessageLayer

func (*ContextMessageLayer) Receive

func (cml *ContextMessageLayer) Receive() (model.Message, error)

Receive message

func (*ContextMessageLayer) Response

func (cml *ContextMessageLayer) Response(message model.Message) error

Response message

func (*ContextMessageLayer) Send

func (cml *ContextMessageLayer) Send(message model.Message) error

Send message

type MessageLayer

type MessageLayer interface {
	Send(message model.Message) error
	Receive() (model.Message, error)
	Response(message model.Message) error
}

MessageLayer define all functions that message layer must implement

func NewMessageLayer

func NewMessageLayer() (MessageLayer, error)

NewMessageLayer by config, currently only context

Jump to

Keyboard shortcuts

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