@lad-tech/nsc-toolkit 1.26.2 → 1.27.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +3 -3
- package/dist/StreamManager.js +20 -3
- package/dist/types/interfaces.d.ts +1 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
# [1.27.0](https://github.com/lad-tech/nsc-toolkit/compare/v1.26.2...v1.27.0) (2025-02-06)
|
|
2
2
|
|
|
3
3
|
|
|
4
|
-
###
|
|
4
|
+
### Features
|
|
5
5
|
|
|
6
|
-
*
|
|
6
|
+
* New option for consumer ackPolicy ([#144](https://github.com/lad-tech/nsc-toolkit/issues/144)) ([0426f4e](https://github.com/lad-tech/nsc-toolkit/commit/0426f4e1da4ff092354f0e175d9ad9a295dfb074))
|
package/dist/StreamManager.js
CHANGED
|
@@ -73,11 +73,20 @@ class StreamManager extends Root_1.Root {
|
|
|
73
73
|
const isPullConsumer = StreamManager.isPullConsumerOptions(setting);
|
|
74
74
|
options
|
|
75
75
|
.durable(consumerName)
|
|
76
|
-
.manualAck()
|
|
77
|
-
.ackExplicit()
|
|
78
76
|
.filterSubject(subject)
|
|
79
77
|
.maxAckPending((setting === null || setting === void 0 ? void 0 : setting.maxPending) || 10);
|
|
80
78
|
if (isPullConsumer) {
|
|
79
|
+
if (setting.ackPolicy === 'all') {
|
|
80
|
+
options.manualAck();
|
|
81
|
+
options.ackAll();
|
|
82
|
+
}
|
|
83
|
+
if (setting.ackPolicy === 'none') {
|
|
84
|
+
options.ackNone();
|
|
85
|
+
}
|
|
86
|
+
if (!setting.ackPolicy) {
|
|
87
|
+
options.manualAck();
|
|
88
|
+
options.ackExplicit();
|
|
89
|
+
}
|
|
81
90
|
if (setting.maxPullRequestExpires) {
|
|
82
91
|
options.maxPullRequestExpires(setting.maxPullRequestExpires);
|
|
83
92
|
}
|
|
@@ -85,6 +94,10 @@ class StreamManager extends Root_1.Root {
|
|
|
85
94
|
options.maxPullBatch(setting.maxPullRequestBatch);
|
|
86
95
|
}
|
|
87
96
|
}
|
|
97
|
+
else {
|
|
98
|
+
options.manualAck();
|
|
99
|
+
options.ackExplicit();
|
|
100
|
+
}
|
|
88
101
|
if (setting === null || setting === void 0 ? void 0 : setting.maxAckWaiting) {
|
|
89
102
|
options.ackWait(setting.maxAckWaiting);
|
|
90
103
|
}
|
|
@@ -114,7 +127,11 @@ class StreamManager extends Root_1.Root {
|
|
|
114
127
|
await this.jsm.consumers.add(streamName, { ...options.config, filter_subject: subject });
|
|
115
128
|
}
|
|
116
129
|
else {
|
|
117
|
-
await this.jsm.consumers.update(streamName, consumerName, {
|
|
130
|
+
await this.jsm.consumers.update(streamName, consumerName, {
|
|
131
|
+
...options.config,
|
|
132
|
+
filter_subject: subject,
|
|
133
|
+
deliver_subject: undefined,
|
|
134
|
+
});
|
|
118
135
|
}
|
|
119
136
|
}
|
|
120
137
|
const consumer = await this.broker.jetstream().consumers.get(streamName, consumerName);
|