distro

package
v0.0.0-...-9f3e423 Latest Latest
Warning

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

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

README

EdgeX Foundry Export Distro Service

license

Export Distribution Microservice receives data from core data (via Q) and then filters, transforms, formats the data per client request and finally distributes it via REST, MQTT or 0MQ. Built on the concept of EAI or pipe and filter archtitecture.

Install and Deploy Native

Prerequisites

Serveral EdgeX Foundry services depend on ZeroMQ for communications by default. The easiest way to get and install ZeroMQ is to use or follow the following setup script: https://gist.github.com/katopz/8b766a5cb0ca96c816658e9407e83d00.

Note: Setup of the ZeroMQ library is not supported on Windows plaforms.

Installation and Execution

To fetch the code and build the microservice execute the following:

cd $GOPATH/src
go get github.com/edgexfoundry/export-go
cd $GOPATH/src/github.com/edgexfoundry/export-go
# pull the 3rd party / vendor packages
make prepare
# build the microservice
make cmd/export-distro/export-distro
# get to the export distro microservice executable
cd cmd/export-distro
# run the microservice (may require other dependent services to run correctly)
./export-distro

Install and Deploy via Docker Container

This project has facilities to create and run Docker containers. A Dockerfile is included in the repo. Make sure you have already run make prepare to update the dependecies. To do a Docker build using the included Docker file, run the following:

Prerequisites

See https://docs.docker.com/install/ to learn how to obtain and install Docker.

Installation and Execution
cd $GOPATH/src
go get github.com/edgexfoundry/export-go
cd $GOPATH/src/github.com/edgexfoundry/export-go
# To create the Docker image
sudo make docker_export_distro
# To create a containter from the image
sudo docker create --name "[DOCKER_CONTAINER_NAME]" --network "[DOCKER_NETWORK]" [DOCKER_IMAGE_NAME]
# To run the container
sudo docker start [DOCKER_CONTAINER_NAME]

Note - creating and running the container above requires Docker network setup, may require dependent containers to be setup on that network, and appropriate port access configuration (among other start up parameters). For this reason, EdgeX recommends use of Docker Compose for pulling, building, and running containers. See The Getting Started Guides for more detail.

Community

License

Apache-2.0

Documentation

Overview

******************************************************************************

  • Copyright 2018 Dell Inc. *
  • Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
  • in compliance with the License. You may obtain a copy of the License at *
  • http://www.apache.org/licenses/LICENSE-2.0 *
  • Unless required by applicable law or agreed to in writing, software distributed under the License
  • is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
  • or implied. See the License for the specific language governing permissions and limitations under
  • the License. ******************************************************************************

* Read and update the configuration

Index

Constants

View Source
const (
	INIT_TOPIC         = "agentruntime/controlling/command/init"
	LOGLEVEL_TOPIC     = "agentruntime/controlling/command/loglevel"
	STOP_TOPIC         = "agentruntime/controlling/command/stop"
	CONFIGUPDATE_TOPIC = "boxmanager/monitoring/opresult/configupdate"
	OFFBOARD_TOPIC     = "boxmanager/monitoring/opresult/offboard"
	VERSION_TOPIC      = "boxmanager/monitoring/softwareinformation/version"
	UPLOADDATA_TOPIC   = "runtime/inject/data/timeseries/{protocol}/{dataSourceId}"
	UPLOADDIAG_TOPIC   = "runtime/inject/diag/timeseries/{protocol}/{dataSourceId}"
)

Publish

View Source
const (
	CONNECTION_TOPIC    = "agentruntime/monitoring/diagnostic/connection"
	ONBOARDING_TOPIC    = "agentruntime/monitoring/diagnostic/onboarding"
	BUFFER_TOPIC        = "agentruntime/monitoring/diagnostic/buffer"
	DATA_TOPIC          = "agentruntime/monitoring/diagnostic/data"
	CLOCKSKEW_TOPIC     = "agentruntime/monitoring/clockskew"
	INITINFO_TOPIC      = "agentruntime/monitoring/opresult/init"
	STOPINFO_TOPIC      = "agentruntime/monitoring/opresult/stop"
	CONFIGINFO_TOPIC    = "cloud/monitoring/update/configuration"
	CONFIGPROINFO_TOPIC = "cloud/monitoring/update/configuration/{protocol}"
	CONFIGAPPINFO_TOPIC = "cloud/monitoring/update/configuration/{app_id}"
	STOPUPLOAD_TOPIC    = "runtime/data/timeseries/stop/{protocol}/{dataSourceId}"
)

Subscribe

Variables

View Source
var LoggingClient logger.LoggingClient

Functions

func Destruct

func Destruct()

func Init

func Init(useConsul bool) bool

func LoadConfigFromFile

func LoadConfigFromFile() (*configuration, error)

LoadConfigFromFile use to load toml configuration

func Loop

func Loop(errChan chan error, eventCh chan *models.Event)

Loop - registration loop

func RefreshRegistrations

func RefreshRegistrations(update models.NotifyUpdate)

func Retry

func Retry(useConsul bool, useProfile string, timeout int, wait *sync.WaitGroup, ch chan error)

func UpdateConfigFromFile

func UpdateConfigFromFile(config *configuration) error

UpdateConfigFromFile use to store toml configuration

func ZeroMQReceiver

func ZeroMQReceiver(eventCh chan *models.Event)

Types

type AzureMessage

type AzureMessage struct {
	ID             string            `json:"id"`
	SequenceNumber int64             `json:"sequenceNumber"`
	To             string            `json:"To"`
	Created        time.Time         `json:"CreationTimeUtc"`
	Expire         time.Time         `json:"ExpiryTimeUtc"`
	Enqueued       time.Time         `json:"EnqueuedTime"`
	CorrelationID  string            `json:"CorrelationId"`
	UserID         string            `json:"userId"`
	Ack            feedbackCode      `json:"ack"`
	ConnDevID      string            `json:"connectionDeviceId"`
	ConnDevGenID   string            `json:"connectionDeviceGenerationId"`
	ConnAuthMethod connAuthMethod    `json:"connectionAuthMethod,omitempty"`
	Body           []byte            `json:"body"`
	Properties     map[string]string `json:"properties"`
}

AzureMessage represents Azure IoT Hub message.

func (*AzureMessage) AddProperty

func (am *AzureMessage) AddProperty(key, value string) error

AddProperty method ads property performing key check.

type BIoTMessage

type BIoTMessage struct {
	Version    string `json:"version"`
	MsgType    string `json:"msgType"`
	FuncType   string `json:"funcType"`
	SId        string `json:"sId"`
	TpId       string `json:"tpId"`
	TId        string `json:"tId"`
	MsgCode    string `json:"msgCode"`
	MsgId      string `json:"msgId"`
	MsgDate    int64  `json:"msgDate"`
	ResCode    string `json:"resCode"`
	ResMsg     string `json:"resMsg"`
	Severity   string `json:"severity"`
	Dataformat string `json:"dataformat"`
	EncType    string `json:"encType"`
	AuthToken  string `json:"authToken"`
	Data       []byte `json:"data"`
}

BIoTMessage represents Brightics IoT(Samsung SDS IoT platform) messages.

type CertificateInfo

type CertificateInfo struct {
	Cert string
	Key  string
}

type ConfigurationStruct

type ConfigurationStruct struct {
	Certificates   map[string]CertificateInfo
	Clients        map[string]config.ClientInfo
	Logging        config.LoggingInfo
	MessageQueue   config.MessageQueueInfo
	AnalyticsQueue config.MessageQueueInfo
	Registry       config.RegistryInfo
	Service        config.ServiceInfo
	MarkPushed     bool
}
var Configuration *ConfigurationStruct

Jump to

Keyboard shortcuts

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