Closed stanfilip0v closed 8 months ago
So in my case I want to connect my app to 2 different NATS JetStream servers and I register 2 different connections. However I don't see how to utilize them in the service and I can't seem to find any documentation on the matter
import { Module } from '@nestjs/common'; import { AppController } from './app.controller'; import { AppService } from './app.service'; import { NatsJetStreamTransport } from '@nestjs-plugins/nestjs-nats-jetstream-transport'; @Module({ imports: [ NatsJetStreamTransport.register({ connectionOptions: { servers: 'localhost:4222', name: 'myservice-publisher', }, }), NatsJetStreamTransport.register({ connectionOptions: { servers: 'localhost:6222', name: 'myservice-publisher-2', }, }), ], controllers: [AppController], providers: [AppService], }) export class AppModule {}
I would imagine something like this?
constructor( private client: NatsJetStreamClientProxy, private client_2: NatsJetStreamClientProxy ) {}
with some sort of Inject to specify the connection?
So in my case I want to connect my app to 2 different NATS JetStream servers and I register 2 different connections. However I don't see how to utilize them in the service and I can't seem to find any documentation on the matter
I would imagine something like this?
with some sort of Inject to specify the connection?