You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is there a way to register RabbitMQModule twice for communication with two different vhosts at the same time?
I tried to register twice with different names and uris but it seems this does not work.
When running the application it looks as the event handler gets registered in both modules which will fail as exchange1 does not exist on instanceB.
LOG [NestFactory] Starting Nest application...
LOG [AmqpConnection] Trying to connect to RabbitMQ broker (InstanceA)
LOG [AmqpConnection] Trying to connect to RabbitMQ broker (InstanceB)
LOG [InstanceLoader] AppModule dependencies initialized +29ms
LOG [InstanceLoader] DiscoveryModule dependencies initialized +0ms
LOG [AmqpConnection] Successfully connected to RabbitMQ broker (InstanceA)
LOG [AmqpConnection] Successfully connected to RabbitMQ broker (InstanceB)
LOG [RabbitMQModule] Successfully connected to RabbitMQ
LOG [AmqpConnection] Successfully connected a RabbitMQ channel "AmqpConnection"
LOG [InstanceLoader] RabbitMQModule dependencies initialized +1ms
LOG [RabbitMQModule] Successfully connected to RabbitMQ
LOG [AmqpConnection] Successfully connected a RabbitMQ channel "AmqpConnection"
LOG [InstanceLoader] RabbitMQModule dependencies initialized +0ms
LOG [RabbitMQModule] Initializing RabbitMQ Handlers
LOG [RabbitMQModule] Registering rabbitmq handlers from AppService
LOG [RabbitMQModule] AppService.getEvent {subscribe} -> exchange1::*::event-collector
LOG [RabbitMQModule] Initializing RabbitMQ Handlers
LOG [RabbitMQModule] Registering rabbitmq handlers from AppService
LOG [RabbitMQModule] AppService.getEvent {subscribe} -> exchange1::*::event-collector
ERROR [AmqpConnection] Disconnected from RabbitMQ broker (InstanceB)
Error: Channel closed by server: 404 (NOT-FOUND) with message "NOT_FOUND - no exchange 'exchange1' in vhost 'instanceB'"
Is there a way to specify in handler registration which instance should be used?
The use case is to read events from instanceA and forward them to instanceB. So my handler should only listen to events on instanceA. InstanceB should be injected in the class containing the handler and when received a new message it should be sent to instanceB via the injected instance.
I think it's because that when it trys to register rabbitmq from @RabbitSubscribe, it merges the config from modlue and the config inside rabbitSubscrible, so you have exchange1 inside @RabbitSubscribel which override the config in module. Remove exchange1 inside rabbitsubscirble might help you.
Is there a way to register RabbitMQModule twice for communication with two different vhosts at the same time?
I tried to register twice with different names and uris but it seems this does not work.
When running the application it looks as the event handler gets registered in both modules which will fail as exchange1 does not exist on instanceB.
Is there a way to specify in handler registration which instance should be used?
The use case is to read events from instanceA and forward them to instanceB. So my handler should only listen to events on instanceA. InstanceB should be injected in the class containing the handler and when received a new message it should be sent to instanceB via the injected instance.
Something like this:
Any ideas how to solve this?
The text was updated successfully, but these errors were encountered: