-
-
Notifications
You must be signed in to change notification settings - Fork 8k
Open
Labels
priority: low (4)Low-priority issue that needs to be resolvedLow-priority issue that needs to be resolvedscope: microservicestype: enhancement 🐺
Description
Is there an existing issue that is already proposing this?
- I have searched the existing issues
Is your feature request related to a problem? Please describe it
Hello,
We have case to always keep connections to multiple NATS servers in the same time but each of them are specific service and there could be same subject across from producers. I can see that @MessagePattern
have argument with type of Transport | symbol
.
Describe the solution you'd like
So this approach will provide a better flexibility for the developers.
ClientsModule.register([
{
name: FIRST_SERVICE_CLIENT, // Symbol
transport: Transport.NATS,
options: {
url: `nats://${process.env.FIRST_NATS_HOST}`,
name: 'FIRST_SERVICE_LISTENER',
headers: { 'x-version': '1.0.0' },
serializer: new OutboundResponseExternalSerializer(),
deserializer: new InboundMessageExternalDeserializer(),
}
},
{
name: SECOND_SERVICE_CLIENT, // typeof Symbol
transport: Transport.NATS,
options: {
url: `nats://${process.env.SECOND_NATS_HOST}`,
name: 'SECOND_SERVICE_LISTENER',
headers: { 'x-version': '1.0.0' },
serializer: new OutboundResponseExternalSerializer(),
deserializer: new InboundMessageExternalDeserializer(),
}
},
]),
async onApplicationBootstrap() {
await this.first_client.connect()
await this.second_client.connect()
}
@MesssagePattern('message_title', FIRST_SERVICE_CLIENT) // Symbol is passed here
async act_on_message_from_first_service(){}
@MesssagePattern('message_title', SECOND_SERVICE_CLIENT) //Symbol is passed here
async act_on_message_from_second_service(){}
Teachability, documentation, adoption, migration strategy
No migration steps
What is the motivation / use case for changing the behavior?
Better flexibility for microservices
petergledhillinclusive, binh-truong-tpv-mti, 95gabor, jochongs, intradeus and 3 more
Metadata
Metadata
Assignees
Labels
priority: low (4)Low-priority issue that needs to be resolvedLow-priority issue that needs to be resolvedscope: microservicestype: enhancement 🐺