broker

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Apr 13, 2017 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Broker

type Broker struct {
	Logger  *logrus.Logger
	N       *nats.Conn
	Version string
	Timeout time.Duration
}

func New

func New(n *nats.Conn, version string) *Broker

func (*Broker) GetTimeout

func (h *Broker) GetTimeout() time.Duration

func (*Broker) GetVersion

func (h *Broker) GetVersion() string

func (*Broker) MessageLogger

func (h *Broker) MessageLogger(f func(m *nats.Msg)) func(m *nats.Msg)

func (*Broker) Parse

func (h *Broker) Parse(m *nats.Msg, e interface{}) (*Container, error)

func (*Broker) Publish

func (h *Broker) Publish(message string, rid string, in interface{}) error

func (*Broker) RID

func (h *Broker) RID(r *http.Request) string

func (*Broker) Reply

func (h *Broker) Reply(m *nats.Msg, rid string, e interface{})

func (*Broker) Request

func (h *Broker) Request(message string, rid string, in, out interface{}) (*Container, error)

func (*Broker) WriteCode

func (h *Broker) WriteCode(message string, rid string, code int, e interface{})

func (*Broker) WriteErrorCode

func (h *Broker) WriteErrorCode(message string, rid string, code int, err error)

type Container

type Container struct {
	ID        string      `json:"i"`
	Version   string      `json:"v"`
	RequestID string      `json:"r"`
	Status    int         `json:"s"`
	Payload   interface{} `json:"p"`
}

Jump to

Keyboard shortcuts

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