@nestjs-plugins/nestjs-nats-jetstream-transport
Advanced tools
Comparing version 1.3.9 to 1.3.11
@@ -0,1 +1,2 @@ | ||
export declare const NATS_JETSTREAM_TRANSPORT: unique symbol; | ||
export declare const NATS_JETSTREAM_OPTIONS = "NATS_JETSTREAM_OPTIONS"; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.NATS_JETSTREAM_OPTIONS = void 0; | ||
exports.NATS_JETSTREAM_OPTIONS = exports.NATS_JETSTREAM_TRANSPORT = void 0; | ||
exports.NATS_JETSTREAM_TRANSPORT = Symbol('NATS_JETSTREAM_TRANSPORT'); | ||
exports.NATS_JETSTREAM_OPTIONS = 'NATS_JETSTREAM_OPTIONS'; | ||
//# sourceMappingURL=constants.js.map |
export * from './server'; | ||
export * from './client'; | ||
export * from './constants'; | ||
export * from './nats-jetstream-transport.module'; | ||
@@ -4,0 +5,0 @@ export * from './interfaces/nats-connection-options.interface'; |
@@ -19,2 +19,3 @@ "use strict"; | ||
__exportStar(require("./client"), exports); | ||
__exportStar(require("./constants"), exports); | ||
__exportStar(require("./nats-jetstream-transport.module"), exports); | ||
@@ -21,0 +22,0 @@ __exportStar(require("./interfaces/nats-connection-options.interface"), exports); |
@@ -5,2 +5,3 @@ import { CustomTransportStrategy, Server } from '@nestjs/microservices'; | ||
private options; | ||
readonly transportId: symbol; | ||
private nc; | ||
@@ -7,0 +8,0 @@ private codec; |
@@ -6,5 +6,6 @@ "use strict"; | ||
const nats_1 = require("nats"); | ||
const rxjs_1 = require("rxjs"); | ||
const constants_1 = require("./constants"); | ||
const nats_jetstream_context_1 = require("./nats-jetstream.context"); | ||
const server_consumer_options_builder_1 = require("./utils/server-consumer-options-builder"); | ||
const rxjs_1 = require("rxjs"); | ||
class NatsJetStreamServer extends microservices_1.Server { | ||
@@ -14,2 +15,3 @@ constructor(options) { | ||
this.options = options; | ||
this.transportId = constants_1.NATS_JETSTREAM_TRANSPORT; | ||
this.codec = (0, nats_1.JSONCodec)(); | ||
@@ -87,5 +89,7 @@ } | ||
if (stream) { | ||
const streamSubjects = new Set([...stream.config.subjects, ...streamConfig.subjects]); | ||
const streamInfo = await this.jsm.streams.update(stream.config.name, { | ||
...stream.config, | ||
...streamConfig, | ||
subjects: [...streamSubjects.keys()], | ||
}); | ||
@@ -92,0 +96,0 @@ this.logger.log(`Stream ${streamInfo.config.name} updated`); |
{ | ||
"name": "@nestjs-plugins/nestjs-nats-jetstream-transport", | ||
"version": "1.3.9", | ||
"version": "1.3.11", | ||
"description": "Nats JetStream Transport for NestJS", | ||
@@ -35,3 +35,3 @@ "main": "dist/index.js", | ||
"dependencies": { | ||
"@nestjs-plugins/nestjs-nats-jetstream-transport": "^1.3.9", | ||
"@nestjs-plugins/nestjs-nats-jetstream-transport": "^1.3.11", | ||
"nats": "^2.6.1", | ||
@@ -52,3 +52,3 @@ "reflect-metadata": "^0.1.13", | ||
}, | ||
"gitHead": "3ad731b9592e992e154208e8844dc9187fa599c0" | ||
"gitHead": "d8c0587021cc89754ceb81adc06804361c2e56c1" | ||
} |
# 🚀 Nats JetStream Transport Module for NestJS | ||
> Breakable changes in v1.3..x | ||
> | ||
> Replace NatsJetStreamClientProxy with NatsJetStreamClient | ||
Build Event Driven Microservices Architecture with Nats JetStream Server and NestJS. | ||
@@ -155,3 +151,3 @@ | ||
- **max_msg_size?**: number (default: -1) - The largest message that will be accepted by the Stream. | ||
- **max_age?**: number (default: 0) - Maximum age of any message in the stream, expressed in microseconds. | ||
- **max_age?**: number (default: 0) - Maximum age of any message in the stream, expressed in nanoseconds. | ||
- **duplicate_window?**: number (default: 120000000000) - The window within which to track duplicate messages. | ||
@@ -244,5 +240,5 @@ - **num_replicas?**: number (default:1) - How many replicas to keep for each message in a clustered JetStream, maximum 5 | ||
// request - response | ||
accumulate(payload: number[]): Observable<number> { | ||
accumulate(payload: number[]): Observable<PubAck> { | ||
const pattern = { cmd: 'sum' }; | ||
return this.client.send<number>(pattern, payload); | ||
return this.client.send<number[]>(pattern, payload); | ||
} | ||
@@ -249,0 +245,0 @@ } |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
151193
482
362