Versions in this module Expand all Collapse all v0 v0.0.1 Aug 25, 2020 Changes in this version + func DefaultLogger() *zerolog.Logger + type Collector interface + Collect func() error + CollectError func(subject string) + CollectLatency func(subject string, latency time.Duration) + CollectReply func(subject string) + CollectSubjectReceived func(subject string) + type Context struct + ByteReplyPayload []byte + Err error + JSONReplyPayload interface{} + Keys map[string]interface{} + Msg *nats.Msg + NatsConnection *nats.Conn + NatsEncodedConnection *nats.EncodedConn + func (c *Context) Get(k string) interface{} + func (c *Context) GetByteReplyPayload() ([]byte, bool) + func (c *Context) Next() + func (c *Context) NextWithLatencyDuration() time.Duration + func (c *Context) Set(k string, v interface{}) + type DefaultObserver struct + func NewDefaultObserver(c Collector) *DefaultObserver + func (o *DefaultObserver) Observe() error + func (o *DefaultObserver) ObserveError(c *Context) + func (o *DefaultObserver) ObserveLatency(c *Context, latency time.Duration) + func (o *DefaultObserver) ObserveReply(c *Context) + func (o *DefaultObserver) ObserveSubjectReceived(c *Context) + type Engine struct + ErrWriter io.ReadWriter + NatsConnection *nats.Conn + NatsEncodedConnection *nats.EncodedConn + OutWriter io.ReadWriter + QueueGroup string + func New(nc *nats.Conn, options ...func(*Engine) error) (*Engine, error) + func (e *Engine) Run(callbacks ...func()) error + func (e *Engine) Shutdown() + func (e *Engine) Subscribe(subject string, handlers ...HandlerFunc) + func (e *Engine) Use(middleware ...HandlerFunc) + type HandlerFunc func(*Context) + func WithByteReply() HandlerFunc + func WithCustomRecovery(handle RecoveryFunc) HandlerFunc + func WithJSONReply() HandlerFunc + func WithLogger(logger *zerolog.Logger) HandlerFunc + func WithMetrics(o Observer) HandlerFunc + func WithRecovery() HandlerFunc + type HandlersChain []HandlerFunc + type Observer interface + Observe func() error + ObserveError func(c *Context) + ObserveLatency func(c *Context, latency time.Duration) + ObserveReply func(c *Context) + ObserveSubjectReceived func(c *Context) + type PrometheusCollector struct + func NewPrometheusCollector(port string) *PrometheusCollector + func (p *PrometheusCollector) Collect() error + func (p *PrometheusCollector) CollectError(subject string) + func (p *PrometheusCollector) CollectLatency(subject string, latency time.Duration) + func (p *PrometheusCollector) CollectReply(subject string) + func (p *PrometheusCollector) CollectSubjectReceived(subject string) + type RecoveryFunc func(c *Context, err interface{}) + type Subscriber struct + Handlers HandlersChain + Subject string