Skip to content

Commit

Permalink
Use BindStream for watcher so it works with mirrors.
Browse files Browse the repository at this point in the history
Signed-off-by: Derek Collison <[email protected]>
  • Loading branch information
derekcollison committed Nov 1, 2022
1 parent 48285d7 commit 416c895
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion kv.go
Original file line number Diff line number Diff line change
Expand Up @@ -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())
}
Expand Down
5 changes: 5 additions & 0 deletions test/kv_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 416c895

Please sign in to comment.