m2mpmsg

package
v0.0.0-...-af70fd6 Latest Latest
Warning

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

Go to latest
Published: Sep 13, 2015 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	FIELD_FROM = "_from"
	FIELD_TO   = "_to"
	FIELD_CALL = "_call"
	FIELD_TIME = "_time"
)
View Source
const (
	TOPIC_GENERAL_EVENTS = "events"
	TOPIC_STORAGE        = "storage"
	TOPIC_ALERTS         = "alerts"
	TOPIC_RECEIVERS      = "receivers"
)

Variables

View Source
var MANDATORY_FIELDS []string

Functions

func HostnameSimple

func HostnameSimple() string

func UUIDFromTime

func UUIDFromTime(time time.Time) string

Types

type Client

type Client struct {
	Recv chan *JsonWrapper
	// contains filtered or unexported fields
}

func NewClient

func NewClient(topic, channel string) (clt *Client, err error)

func NewClientAddingHost

func NewClientAddingHost(topic, channel string) (clt *Client, err error)

func NewClientGlobal

func NewClientGlobal(topic string) (clt *Client, err error)

func NewClientUsingHost

func NewClientUsingHost(topic string) (clt *Client, err error)

func NewClientUsingHostTemp

func NewClientUsingHostTemp(topic string) (clt *Client, err error)

func (*Client) HandleMessage

func (c *Client) HandleMessage(m *nsq.Message) error

func (*Client) Publish

func (c *Client) Publish(msg *JsonWrapper) error

func (*Client) Start

func (c *Client) Start(addr string) (err error)

func (*Client) StartLookup

func (c *Client) StartLookup(addr string) error

func (*Client) StartNSQ

func (c *Client) StartNSQ(addr string) error

func (*Client) Stop

func (c *Client) Stop()

type JsonWrapper

type JsonWrapper struct {
	*simple.Json
}

func NewJsonWrapper

func NewJsonWrapper() *JsonWrapper

func NewJsonWrapperFromJson

func NewJsonWrapperFromJson(json *simple.Json) *JsonWrapper

func NewMessage

func NewMessage(to, call string) *JsonWrapper

func (*JsonWrapper) Call

func (jw *JsonWrapper) Call() (out string)

func (*JsonWrapper) Check

func (jw *JsonWrapper) Check() error

func (*JsonWrapper) From

func (jw *JsonWrapper) From() (out string)

func (*JsonWrapper) SetCall

func (jw *JsonWrapper) SetCall(call string)

func (*JsonWrapper) SetFrom

func (jw *JsonWrapper) SetFrom(from string)

func (*JsonWrapper) SetTime

func (jw *JsonWrapper) SetTime()

func (*JsonWrapper) SetTo

func (jw *JsonWrapper) SetTo(to string)

The target of a message should be something like: * server ie: receivers * server:device ie: receivers:bc86fb50-ce5d-11e3-9c1a-0800200c9a66 * server:device:connection ie: receivers/xps:bc86fb50-ce5d-11e3-9c1a-0800200c9a66:100

The only actual rule through is that the first part is the NSQ topic or topic/channel (later).

func (*JsonWrapper) SetVS

func (jw *JsonWrapper) SetVS(key string, value string)

func (*JsonWrapper) String

func (jw *JsonWrapper) String() string

func (*JsonWrapper) Time

func (jw *JsonWrapper) Time() time.Time

func (*JsonWrapper) To

func (jw *JsonWrapper) To() (out string)

Jump to

Keyboard shortcuts

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