Nest: [discussion] With multiple microservices transports in single app all patterns from MessagePattern using by all transports

Created on 10 May 2020  路  3Comments  路  Source: nestjs/nest

Bug Report

Current behavior

Use multiple microservices transports in single app, for example combine gRPC and Kafka, now I got issue with decorators in controllers, Kafka trying connect by arguments from '@GrpcMethod', but decorator GrpcMethod generate JSON object for pattern which invalid as name os Kafka topic.

[ServerKafka] ERROR [Connection] Response Metadata(key: 3, version: 5) {"timestamp":"2020-05-08T19:58:06.967Z","logger":"kafkajs","broker":"localhost:9092","clientId":"events-api-server","error":"The request attempted to perform an operation on an invalid topic","correlationId":1,"size":145} +73ms (node:53226) UnhandledPromiseRejectionWarning: KafkaJSProtocolError: The request attempted to perform an operation on an invalid topic @nestjs/microservices/server/server-kafka.js:65:9

In general all MessagePattern result processed by all microservices transports.

Input Code

https://gist.github.com/barbarosh/a73eb0aecda5c70c0d9341f05b4bd849

Expected behavior

I expected what data from GrpcMethod should read only by ServerGrpc.

Possible Solution

Pass type of transport for each MessagePattern for separate

Environment


Nest version: 7.0.9


For Tooling issues:
- Node version: 12
- Platform:  Mac

Others:

microservices wip 鈿★笍 type

All 3 comments

I am facing similar issues. Seems like Nest message pattern is designed only for one type of the transport.

@paul-ihnatolia

Seems like Nest message pattern is designed only for one type of the transport.

It happens only if you combine gRPC with other transporters.

@barbarosh thanks for reporting. I'll review your PR shortly.

Added in 7.1.0. Thanks!

Was this page helpful?
0 / 5 - 0 ratings