service

package module
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2018 License: BSD-3-Clause Imports: 7 Imported by: 5

README

service

build status

The robµlab service library is a convenience wrapper for easy microservice creation.


How to add to your project?

Unfortunately glide does not read ~/.gitconfig for dependency resolving. Therefore we have to specify the import paths manually and cannot use burrow get.

Add this to your glide.yaml file in your project

import:
  - package: robulab/service
    repo: ssh://git@gitlab.development.coffee:1023/PKES-EE/Backend/service
    version: ^0.1.0

and run burrow update afterwards.

And in your source code you can now import the library.

import "robulab/service"

How to view logging output

The robµlab service library uses the system logging daemon to store log files. You can use the following command under systemd machines to view a robµlab service's log messages:

$ journalctl --user -e -f -t com.robulab.<name>

Running the example

First you have to start a crossbar broker in the background.

$ docker run -p 127.0.0.1:8080:8080 --name crossbar --rm crossbario/crossbar:latest

The you can run the example service like this:

$ burrow run --example simple -- -b ws://localhost:8080/ws

You can view the logging output of the example by issuing

$ journalctl --user -e -f -t com.robulab.example.simple

Gitconfig

Make sure your ~/.gitconfig contains the following section

[url "ssh://git@gitlab.pattig.rocks:1023/robulab/backend"]
        insteadOf = git://robulab

Documentation

Index

Constants

View Source
const (
	EXIT_SUCCESS int = iota
	EXIT_ARGUMENT
	EXIT_SERVICE
	EXIT_CONNECT
	EXIT_REGISTRATION
)
View Source
const BROKER_URL_ENV string = "SERVICE_BROKER_URL"
View Source
const LOG_FORMAT_ENV string = "SERVICE_LOGFORMAT"
View Source
const PASSWORD_ENV string = "SERVICE_PASSWORD"
View Source
const USERNAME_ENV string = "SERVICE_USERNAME"

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Name          string
	Version       string
	Description   string
	Serialization turnpike.Serialization
	Url           string
	Realm         string
	User          string
	Password      string
}

type Error

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

func NewError

func NewError(kind ErrorKind) *Error

func NewErrorFrom

func NewErrorFrom(kind ErrorKind, inner error) *Error

func (*Error) Error

func (e *Error) Error() string

type ErrorKind

type ErrorKind int
const (
	ErrorBadArgument ErrorKind = iota
	ErrorNotAvailable
	ErrorNotEnoughData
	ErrorUnexpectedData
	ErrorTooMuchData
	ErrorOutOfRange
	ErrorTimedOut
	ErrorPermissionDenied
	ErrorNotFound
	ErrorUnreachableLineReached
	ErrorThisWorksOnMyMachine
	ErrorItsNotABugItsAFeature
	ErrorAKittenDies
)

type EventSubscribtion added in v0.8.0

type EventSubscribtion struct {
	Handler turnpike.EventHandler
	Options map[string]interface{}
}

type HandlerRegistration added in v0.8.0

type HandlerRegistration struct {
	Handler turnpike.MethodHandler
	Options map[string]interface{}
}

type RegistrationError added in v0.8.0

type RegistrationError struct {
	ProcedureName string
	Inner         error
}

type Service

type Service struct {
	Logger *logging.Logger
	Client *turnpike.Client
	// contains filtered or unexported fields
}

func New

func New(default_config Config) *Service

func (*Service) Connect

func (self *Service) Connect()

func (*Service) RegisterAll added in v0.8.0

func (self *Service) RegisterAll(procedures map[string]HandlerRegistration) *RegistrationError

func (*Service) Run

func (self *Service) Run()

func (*Service) SubscribeAll added in v0.8.0

func (self *Service) SubscribeAll(procedures map[string]EventSubscribtion) *SubscribtionError

type SubscribtionError added in v0.8.0

type SubscribtionError struct {
	Topic string
	Inner error
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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