diff --git a/kv.go b/kv.go index 477a8b39d..3761a33eb 100644 --- a/kv.go +++ b/kv.go @@ -926,7 +926,7 @@ func (kv *kvs) Watch(keys string, opts ...WatchOpt) (KeyWatcher, error) { } // Used ordered consumer to deliver results. - subOpts := []SubOpt{OrderedConsumer()} + subOpts := []SubOpt{BindStream(kv.stream), OrderedConsumer()} if !o.includeHistory { subOpts = append(subOpts, DeliverLastPerSubject()) } diff --git a/test/kv_test.go b/test/kv_test.go index f916ff7e1..c668e6f12 100644 --- a/test/kv_test.go +++ b/test/kv_test.go @@ -968,6 +968,11 @@ func TestKeyValueMirrorCrossDomains(t *testing.T) { t.Fatalf("Got wrong value: %q vs %q", e.Value(), "rip") } + // Also make sure we can create a watcher on the mirror KV. + watcher, err := mkv.WatchAll() + expectOk(t, err) + defer watcher.Stop() + // Bind through leafnode connection but to origin KV. rjs, err := lnc.JetStream(nats.Domain("HUB")) expectOk(t, err)