Documentation ¶
Index ¶
- func FmtByte2RefVal(t reflect.Type, data []byte) (reflect.Value, error)
- func FmtData2Byte(args interface{}) ([]byte, error)
- func New(nc *nats.Conn) gobus.Bus
- func NewNatsBus(nc *nats.Conn) gobus.Bus
- type Message
- type NatsAdapter
- func (bus *NatsAdapter) Conn() interface{}
- func (bus *NatsAdapter) Name() string
- func (bus *NatsAdapter) Publish(topic string, data []byte) error
- func (bus *NatsAdapter) Request(topic string, data []byte, timeout time.Duration) (gobus.Message, error)
- func (bus *NatsAdapter) Subscribe(topic, group string, fn func(gobus.Message)) (sub interface{}, err error)
- func (bus *NatsAdapter) Unsubscribe(sub interface{}) error
- func (bus *NatsAdapter) Valid() error
- type NatsBus
- func (bus *NatsBus) Publish(topic string, args interface{}) error
- func (bus *NatsBus) Request(topic string, timeout time.Duration, args interface{}, result interface{}) error
- func (bus *NatsBus) RequestB(topic string, timeout time.Duration, args interface{}) ([]byte, error)
- func (bus *NatsBus) Subscribe(topic string, fn interface{}) error
- func (bus *NatsBus) SubscribeAsync(topic string, fn interface{}) error
- func (bus *NatsBus) SubscribeOnce(topic string, fn interface{}) error
- func (bus *NatsBus) SubscribeOnceAsync(topic string, fn interface{}) error
- func (bus *NatsBus) Unsubscribe(topic string, handler interface{}) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FmtData2Byte ¶
func NewNatsBus ¶
New returns new QueueBus with empty handlers.
Types ¶
type NatsAdapter ¶
type NatsAdapter struct {
// contains filtered or unexported fields
}
NatsAdapter - nats adapter
func (*NatsAdapter) Conn ¶
func (bus *NatsAdapter) Conn() interface{}
func (*NatsAdapter) Name ¶
func (bus *NatsAdapter) Name() string
func (*NatsAdapter) Subscribe ¶
func (bus *NatsAdapter) Subscribe(topic, group string, fn func(gobus.Message)) (sub interface{}, err error)
func (*NatsAdapter) Unsubscribe ¶
func (bus *NatsAdapter) Unsubscribe(sub interface{}) error
func (*NatsAdapter) Valid ¶
func (bus *NatsAdapter) Valid() error
type NatsBus ¶
type NatsBus struct {
// contains filtered or unexported fields
}
NatsBus - box for handlers and callbacks.
func (*NatsBus) Publish ¶
Publish executes callback defined for a topic. Any additional argument will be transferred to the callback.
func (*NatsBus) Request ¶
func (bus *NatsBus) Request(topic string, timeout time.Duration, args interface{}, result interface{}) error
Publish executes callback defined for a topic. Any additional argument will be transferred to the callback.
func (*NatsBus) SubscribeAsync ¶
func (?) (result, (error)), 异步订阅忽略 ">>",即无论任何情况下都是异步订阅
func (*NatsBus) SubscribeOnce ¶
func (?) (result, (error))
func (*NatsBus) SubscribeOnceAsync ¶
func (?) (result, (error))
func (*NatsBus) Unsubscribe ¶
Unsubscribe removes callback defined for a topic. Returns error if there are no callbacks subscribed to the topic.
Click to show internal directories.
Click to hide internal directories.