11import { fromEvent } from 'rxjs' ;
22import { takeUntil } from 'rxjs/operators' ;
3- import { CANCEL_EVENT , GRPC_DEFAULT_PROTO_LOADER , GRPC_DEFAULT_URL } from '../constants' ;
3+ import {
4+ CANCEL_EVENT ,
5+ GRPC_DEFAULT_MAX_RECEIVE_MESSAGE_LENGTH ,
6+ GRPC_DEFAULT_MAX_SEND_MESSAGE_LENGTH ,
7+ GRPC_DEFAULT_PROTO_LOADER ,
8+ GRPC_DEFAULT_URL
9+ } from '../constants' ;
410import { InvalidGrpcPackageException } from '../exceptions/errors/invalid-grpc-package.exception' ;
511import { InvalidProtoDefinitionException } from '../exceptions/errors/invalid-proto-definition.exception' ;
612import { CustomTransportStrategy } from '../interfaces' ;
@@ -15,20 +21,13 @@ let grpcProtoLoaderPackage: any = {};
1521
1622export class ServerGrpc extends Server implements CustomTransportStrategy {
1723 private readonly url : string ;
18- private readonly maxSendMessageLength : number ;
19- private readonly maxReceiveMessageLength : number ;
2024 private grpcClient : any ;
2125
2226 constructor ( private readonly options : MicroserviceOptions [ 'options' ] ) {
2327 super ( ) ;
2428 this . url =
2529 this . getOptionsProp < GrpcOptions > ( options , 'url' ) || GRPC_DEFAULT_URL ;
2630
27- this . maxSendMessageLength =
28- this . getOptionsProp < GrpcOptions > ( options , 'maxSendMessageLength' ) || GRPC_DEFAULT_URL ;
29- this . maxReceiveMessageLength =
30- this . getOptionsProp < GrpcOptions > ( options , 'maxReceiveMessageLength' ) || GRPC_DEFAULT_URL ;
31-
3231 const protoLoader =
3332 this . getOptionsProp < GrpcOptions > ( options , 'protoLoader' ) || GRPC_DEFAULT_PROTO_LOADER ;
3433
@@ -145,8 +144,8 @@ export class ServerGrpc extends Server implements CustomTransportStrategy {
145144
146145 public createClient ( ) : any {
147146 const server = new grpcPackage . Server ( {
148- ... this . maxSendMessageLength ? { 'grpc.max_send_message_length' : this . maxSendMessageLength } : { } ,
149- ... this . maxReceiveMessageLength ? { 'grpc.max_receive_message_length' : this . maxReceiveMessageLength } : { }
147+ 'grpc.max_send_message_length' : this . getOptionsProp < GrpcOptions > ( this . options , ' maxSendMessageLength' , GRPC_DEFAULT_MAX_SEND_MESSAGE_LENGTH ) ,
148+ 'grpc.max_receive_message_length' : this . getOptionsProp < GrpcOptions > ( this . options , ' maxReceiveMessageLength' , GRPC_DEFAULT_MAX_RECEIVE_MESSAGE_LENGTH )
150149 } ) ;
151150 const credentials = this . getOptionsProp < GrpcOptions > (
152151 this . options ,
0 commit comments