Skip to content

Commit

Permalink
[FEAT] allow mirror_direct option on StreamConfig
Browse files Browse the repository at this point in the history
  • Loading branch information
aricart committed Sep 6, 2022
1 parent 9314029 commit abc2560
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 0 deletions.
4 changes: 4 additions & 0 deletions nats-base-client/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1785,6 +1785,10 @@ export interface StreamUpdateConfig {
* Allow higher performance, direct access to get individual messages via the $JS.DS.GET API
*/
"allow_direct": boolean;
/**
* Allow higher performance, direct access to get individual messages via the $JS.DS.GET API
*/
"mirror_direct": boolean;
/**
* Rules for republishing messages from a stream with subject mapping
* onto new subjects for partitioning and more
Expand Down
33 changes: 33 additions & 0 deletions tests/jsm_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1377,3 +1377,36 @@ Deno.test("jsm - consumer name apis are not used on old servers", async () => {

await cleanup(ns, nc);
});

Deno.test("jsm - mirror_direct options", async () => {
const { ns, nc } = await setup(
jetstreamServerConf({}, true),
);

if (await notCompatible(ns, nc, "2.9.0")) {
return;
}

const jsm = await nc.jetstreamManager();
let si = await jsm.streams.add({
name: "A",
allow_direct: true,
subjects: ["a.*"],
max_msgs_per_subject: 1,
});
assertEquals(si.config.allow_direct, true);

si = await jsm.streams.add({
name: "B",
allow_direct: true,
mirror_direct: true,
mirror: {
name: "A",
},
max_msgs_per_subject: 1,
});
assertEquals(si.config.allow_direct, true);
assertEquals(si.config.mirror_direct, true);

await cleanup(ns, nc);
});

0 comments on commit abc2560

Please sign in to comment.