Merge pull request 'add queue subscribe' (#47) from add-queue-subscribe into master
Reviewed-on: #47
This commit is contained in:
commit
c2887223c7
|
@ -40,6 +40,16 @@ func (sv Server) Subscribe(subject string, cb nats.MsgHandler) (*nats.Subscripti
|
||||||
return sub, nil
|
return sub, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// QueueSubscribe ...
|
||||||
|
func (sv Server) QueueSubscribe(subject, queue string, cb nats.MsgHandler) (*nats.Subscription, error) {
|
||||||
|
sub, err := sv.instance.QueueSubscribe(subject, queue, cb)
|
||||||
|
if err != nil {
|
||||||
|
msg := fmt.Sprintf("[NATS SERVER] - queue subscribe subject %s, queue %s error: %s", subject, queue, err.Error())
|
||||||
|
return nil, errors.New(msg)
|
||||||
|
}
|
||||||
|
return sub, nil
|
||||||
|
}
|
||||||
|
|
||||||
// NewJSONEncodedConn ...
|
// NewJSONEncodedConn ...
|
||||||
func (sv Server) NewJSONEncodedConn() (*JSONEncoder, error) {
|
func (sv Server) NewJSONEncodedConn() (*JSONEncoder, error) {
|
||||||
enc, err := nats.NewEncodedConn(sv.instance, nats.JSON_ENCODER)
|
enc, err := nats.NewEncodedConn(sv.instance, nats.JSON_ENCODER)
|
||||||
|
|
Loading…
Reference in New Issue