propagate context and SuccessAutoAck option other brokers

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
This commit is contained in:
2019-01-26 13:37:58 +03:00
parent 504bebc2e7
commit ae10eb2ab8
3 changed files with 45 additions and 10 deletions

View File

@@ -3,13 +3,14 @@ package nats
import (
"context"
"errors"
"strings"
"sync"
"github.com/micro/go-micro/broker"
"github.com/micro/go-micro/cmd"
"github.com/micro/go-micro/codec/json"
"github.com/nats-io/go-nats"
nats "github.com/nats-io/go-nats"
)
type nbroker struct {
@@ -144,6 +145,10 @@ func (n *nbroker) Publish(topic string, msg *broker.Message, opts ...broker.Publ
}
func (n *nbroker) Subscribe(topic string, handler broker.Handler, opts ...broker.SubscribeOption) (broker.Subscriber, error) {
if n.conn == nil {
return nil, errors.New("not connected")
}
opt := broker.SubscribeOptions{
AutoAck: true,
}