Documentation ¶
Index ¶
- type Connector
- type FakeConnector
- func (f *FakeConnector) Close()
- func (f *FakeConnector) Publish(subj string, data []byte) error
- func (f *FakeConnector) QueueSubscribe(subj string, queue string, cb nats.MsgHandler) (*nats.Subscription, error)
- func (f *FakeConnector) Request(subj string, data []byte, timeout time.Duration) (*nats.Msg, error)
- func (f *FakeConnector) Reset()
- func (f *FakeConnector) ResetEvents()
- func (f *FakeConnector) ResetHandlers()
- func (f *FakeConnector) Subscribe(subj string, cb nats.MsgHandler) (*nats.Subscription, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Connector ¶
type Connector interface { Close() Request(subj string, data []byte, timeout time.Duration) (*nats.Msg, error) Publish(subj string, data []byte) error Subscribe(subj string, cb nats.MsgHandler) (*nats.Subscription, error) QueueSubscribe(subj string, queue string, cb nats.MsgHandler) (*nats.Subscription, error) }
Connector provides an interface to NATS. This allows the service to be mocked so an actual NATS instance isn't required for unit testing.
func NewFakeConnector ¶
func NewFakeConnector() Connector
NewFakeConnector : Returns a new fake connector
type FakeConnector ¶
type FakeConnector struct { Events map[string][]*nats.Msg Handlers map[string]nats.MsgHandler // contains filtered or unexported fields }
FakeConnector : A fake nats connector for testing nats handlers
func (*FakeConnector) Close ¶
func (f *FakeConnector) Close()
Close : Resets all handlers and events
func (*FakeConnector) Publish ¶
func (f *FakeConnector) Publish(subj string, data []byte) error
Publish : Publish an event
func (*FakeConnector) QueueSubscribe ¶
func (f *FakeConnector) QueueSubscribe(subj string, queue string, cb nats.MsgHandler) (*nats.Subscription, error)
QueueSubscribe : Subscribe to an event stream
func (*FakeConnector) Reset ¶
func (f *FakeConnector) Reset()
Reset : resets all handlers and events
func (*FakeConnector) ResetEvents ¶
func (f *FakeConnector) ResetEvents()
ResetEvents : Resets cache of collected events
func (*FakeConnector) ResetHandlers ¶
func (f *FakeConnector) ResetHandlers()
ResetHandlers : Resets all handlers
func (*FakeConnector) Subscribe ¶
func (f *FakeConnector) Subscribe(subj string, cb nats.MsgHandler) (*nats.Subscription, error)
Subscribe : Subscribe to an event stream
Click to show internal directories.
Click to hide internal directories.