question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

How to open multiple connection and use in their respective modules?

See original GitHub issue

Hello, is it possible to create multiple connection and use in their respective modules? I tried like

@Module({ imports: [ RabbitMQModule.forRoot(RabbitMQModule, { exchanges: [ { name: 'exchange1', type: 'headers', }, ], uri: 'amqp://username:password@server1:5672', enableControllerDiscovery: true, }) ], controllers: [FirstController] }) export class FirstController {}

@Module({ imports: [ RabbitMQModule.forRoot(RabbitMQModule, { exchanges: [ { name: 'exchange2', type: 'headers', }, ], uri: 'amqp://username:password@server2:5672', enableControllerDiscovery: true, }), ], controllers: [SecondController], }) export class SecondController {}

it created 2 connection but same queues on both rmq server without respecting modules.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:8 (5 by maintainers)

github_iconTop GitHub Comments

4reactions
underfiskcommented, Mar 29, 2022

@andrewda The way it is working right now only contains a single connection which means that in order to support multiple you need to adapt (https://github.com/golevelup/nestjs/blob/18ca7996ca66d9681ff763658cfc5256f9d26405/packages/rabbitmq/src/rabbitmq.module.ts#L64) the factory to push new connections to an array of connections rather than a single connection object. The implementation should be something like we did for the channels if you look at the merged PR’s where you always have a default connection and we can specify named connections/URL and simply pick that

2reactions
andrewdacommented, Mar 29, 2022

Great, thanks for the details @underfisk! I’ll see what I can do.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Database Modules - Tosca - Tricentis
Open Connection ->Connection String->Driver. Specify whether you are using an SQLite, MSSQL, or generic ODBC database. To do so, select the respective value...
Read more >
How to properly reuse connection to Mongodb across NodeJs ...
You can create a mongoUtil.js module that has functions to both connect to mongo and return a mongo db instance: const MongoClient =...
Read more >
Verilog Module Instantiations - ChipVerify
A better way to connect ports is by explicitly linking ports on both the sides using their port name. The dot . indicates...
Read more >
Chapter 2. Introduction to modules Red Hat Enterprise Linux 8
A module is a set of RPM packages that represent a component and are usually installed together. A typical module contains packages with...
Read more >
Manage modules in Azure Automation - Microsoft Learn
This article tells how to use PowerShell modules to enable cmdlets in runbooks and DSC resources in DSC configurations.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found