add queue subscribe json encoder
This commit is contained in:
parent
77276b0ae6
commit
dac9add5fb
|
@ -22,6 +22,17 @@ func (e JSONEncoder) Subscribe(subject string, cb nats.Handler) (*nats.Subscript
|
||||||
return sub, err
|
return sub, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// QueueSubscribe ...
|
||||||
|
func (e JSONEncoder) QueueSubscribe(subject, queue string, cb nats.Handler) (*nats.Subscription, error) {
|
||||||
|
sub, err := e.encConn.QueueSubscribe(subject, queue, cb)
|
||||||
|
if err != nil {
|
||||||
|
log.Printf("natsio.JSONEncoder.QueueSubscribe err: %v\n", err)
|
||||||
|
} else {
|
||||||
|
log.Printf("natsio.JSONEncoder.QueueSubscribe - subscribed to subject %s successfully\n", subject)
|
||||||
|
}
|
||||||
|
return sub, err
|
||||||
|
}
|
||||||
|
|
||||||
// Publish ...
|
// Publish ...
|
||||||
func (e JSONEncoder) Publish(reply string, data interface{}) error {
|
func (e JSONEncoder) Publish(reply string, data interface{}) error {
|
||||||
return e.encConn.Publish(reply, data)
|
return e.encConn.Publish(reply, data)
|
||||||
|
|
Loading…
Reference in New Issue