network

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Apr 22, 2020 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Amqp

type Amqp struct {
	// contains filtered or unexported fields
}

Amqp handles the connection, queues and exchanges declared

func NewAmqp

func NewAmqp(url string, logger logging.Logger) *Amqp

NewAmqp constructs the AMQP connection handler

func (*Amqp) OnMessage

func (a *Amqp) OnMessage(msgChan chan InMsg, queueName, exchangeName, key string) error

OnMessage receive messages and put them on channel

func (*Amqp) PublishPersistentMessage

func (a *Amqp) PublishPersistentMessage(exchange, key string, body []byte) error

PublishPersistentMessage sends a persistent message to RabbitMQ

func (*Amqp) Start

func (a *Amqp) Start(started chan bool)

Start starts the handler

func (*Amqp) Stop

func (a *Amqp) Stop()

Stop closes the connection started

type DataPublish

type DataPublish struct {
	ID   string          `json:"id"`
	Data []entities.Data `json:"data"`
}

DataPublish represents the incoming publish data command

type DataRequest

type DataRequest struct {
	ID        string `json:"id"`
	SensorIds []int  `json:"sensorIds"`
}

DataRequest represents the incoming request data command

type DataUpdate

type DataUpdate struct {
	ID   string          `json:"id"`
	Data []entities.Data `json:"data"`
}

DataUpdate represents the incoming update data command

type DeviceAuthRequest

type DeviceAuthRequest struct {
	ID    string `json:"id"`
	Token string `json:"token"`
}

DeviceAuthRequest represents the incoming auth device command

type DeviceAuthResponse

type DeviceAuthResponse struct {
	ID    string  `json:"id"`
	Error *string `json:"error"`
}

DeviceAuthResponse represents the outgoing auth device command response

type DeviceListResponse

type DeviceListResponse struct {
	Things []*entities.Thing `json:"devices"`
	Error  *string           `json:"error"`
}

DeviceListResponse represents the outgoing list devices command response

type DeviceRegisterRequest

type DeviceRegisterRequest struct {
	ID   string `json:"id"`
	Name string `json:"name"`
}

DeviceRegisterRequest represents the incoming register device request message

type DeviceRegisteredResponse

type DeviceRegisteredResponse struct {
	ID    string  `json:"id"`
	Token string  `json:"token"`
	Error *string `json:"error"`
}

DeviceRegisteredResponse represents the outgoing register device response message

type DeviceUnregisterRequest

type DeviceUnregisterRequest struct {
	ID string `json:"id"`
}

DeviceUnregisterRequest represents the incoming unregister device request message

type DeviceUnregisteredResponse

type DeviceUnregisteredResponse struct {
	ID    string  `json:"id"`
	Error *string `json:"error"`
}

DeviceUnregisteredResponse represents the outgoing unregister device response message

type InMsg

type InMsg struct {
	Exchange   string
	RoutingKey string
	Headers    map[string]interface{}
	Body       []byte
}

InMsg represents the message received from the AMQP broker

type SchemaUpdateRequest

type SchemaUpdateRequest struct {
	ID     string            `json:"id"`
	Schema []entities.Schema `json:"schema,omitempty"`
}

SchemaUpdateRequest represents the incoming update schema request message

type SchemaUpdatedResponse

type SchemaUpdatedResponse struct {
	ID    string  `json:"id"`
	Error *string `json:"error"`
}

SchemaUpdatedResponse represents the outgoing update schema response message

Jump to

Keyboard shortcuts

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