Documentation ¶
Overview ¶
Package nats provides a Vice implementation for NATS. Copied from the original project and modified to support broadcasting to multiple receivers, and encoded data format to avoid marshal/unmarshal error from go-nats.
Index ¶
- Constants
- type Option
- type Options
- type Transport
- func (t *Transport) Done() chan struct{}
- func (t *Transport) ErrChan() <-chan error
- func (t *Transport) Receive(name string) <-chan event.NormalizedEvent
- func (t *Transport) ReceiveBool(name string) <-chan bool
- func (t *Transport) Send(name string) chan<- event.NormalizedEvent
- func (t *Transport) SendBool(name string) chan<- bool
- func (t *Transport) Stop()
Constants ¶
const DefaultAddr = nats.DefaultURL
DefaultAddr is the NATS default TCP address.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Option ¶
type Option func(*Options)
Option is a function on the options for a nats transport.
func WithConnection ¶
func WithConnection(c *nats.Conn) Option
WithConnection is an Option to set underlying nats connection.
type Options ¶
type Options struct { Conn *nats.Conn UseEncoded bool }
Options can be used to create a customized transport.
type Transport ¶
type Transport struct { sync.Mutex // exported fields NatsAddr string NatsQueueGroup string // contains filtered or unexported fields }
Transport implement VTransport
func (*Transport) Done ¶
func (t *Transport) Done() chan struct{}
Done gets a channel which is closed when the transport has successfully stopped.
func (*Transport) Receive ¶
func (t *Transport) Receive(name string) <-chan event.NormalizedEvent
Receive gets a channel on which to receive messages
func (*Transport) ReceiveBool ¶
ReceiveBool gets a channel on which to receive messages
func (*Transport) Send ¶
func (t *Transport) Send(name string) chan<- event.NormalizedEvent
Send gets a channel on which messages with the specified name may be sent.