We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
all this request was sent without restart server or rabbitmq server
not have
main.ts producer
const app = await NestFactory.create<NestExpressApplication>(MainModule); app.connectMicroservice<MicroserviceOptions>({ transport: Transport.RMQ, options: { urls: ['amqp://' + process.env.RABBIT_HOST + ':5672'], queue: 'my_queue', queueOptions: { durable: false, }, consumerTag: 'Service1', }, }); await app.startAllMicroservices(); ... await app.listen(3000);
MainModule
ClientsModule.register([ { name: 'MY_SERVICE', transport: Transport.RMQ, options: { urls: ['amqp://' + process.env.RABBIT_HOST + ':5672'], queue: 'tenant_queue', queueOptions: { durable: false, }, }, }, ]),
MainService
constructor( ... @Inject('MY_SERVICE') private readonly client: ClientProxy, ) {} @Post() endpoint(...) { ... switchMap((result) => forkJoin({ result: of(result), db: this.client.send('my-event', result), }), ), }), );
main.ts
const app = await NestFactory.createMicroservice(MainModule, { transport: Transport.RMQ, options: { urls: ['amqp://' + process.env.RABBIT_HOST + ':5672'], queue: 'my_queue', queueOptions: { durable: false, }, consumerTag: 'consumerService', }, }); await app.listen();
consumerController:
@Controller() export class ConsumerController { constructor( ...., private readonly connection: PrismaClientManager, ) {} @MessagePattern('my-event') async notify( @Payload() { ... }: { ... : ... }, @Ctx() context: RmqContext, ) { return ...; } }
consumer answer to all events sent from rabbitmq provider
@nestjs/common
@nestjs/core
@nestjs/microservices
@nestjs/platform-express
@nestjs/platform-fastify
@nestjs/platform-socket.io
@nestjs/platform-ws
@nestjs/testing
@nestjs/websockets
No response
10.0.0
_ _ _ ___ _____ _____ _ _____ | \ | | | | |_ |/ ___|/ __ \| | |_ _| | \| | ___ ___ | |_ | |\ `--. | / \/| | | | | . ` | / _ \/ __|| __| | | `--. \| | | | | | | |\ || __/\__ \| |_ /\__/ //\__/ /| \__/\| |_____| |_ \_| \_/ \___||___/ \__|\____/ \____/ \____/\_____/\___/ [System Information] OS Version : Windows 10.0.22631 NodeJS Version : v18.20.2 NPM Version : 10.5.0 [Nest CLI] Nest CLI Version : 10.3.2 [Nest Platform Information] platform-express version : 10.3.3 microservices version : 10.3.3 schematics version : 10.1.1 passport version : 10.0.3 swagger version : 7.3.0 testing version : 10.3.3 common version : 10.3.3 config version : 3.2.0 core version : 10.3.3 jwt version : 10.2.0 cli version : 10.3.2 ### Node.js version 18.20.2 ### In which operating systems have you tested? - [ ] macOS - [X] Windows - [ ] Linux ### Other _No response_
The text was updated successfully, but these errors were encountered:
Please provide a minimum reproduction repository (Git repository/StackBlitz/CodeSandbox project).
Sorry, something went wrong.
No branches or pull requests
Is there an existing issue for this?
Current behavior
all this request was sent without restart server or rabbitmq server
Minimum reproduction code
not have
Steps to reproduce
Producer
main.ts producer
MainModule
MainService
Consumer
main.ts
consumerController:
Expected behavior
consumer answer to all events sent from rabbitmq provider
Package
@nestjs/common
@nestjs/core
@nestjs/microservices
@nestjs/platform-express
@nestjs/platform-fastify
@nestjs/platform-socket.io
@nestjs/platform-ws
@nestjs/testing
@nestjs/websockets
Other package
No response
NestJS version
10.0.0
Packages versions
The text was updated successfully, but these errors were encountered: