@@ -8,7 +8,12 @@ import {
88 NO_MESSAGE_HANDLER ,
99} from '../constants' ;
1010import { MqttClient } from '../external/mqtt-client.interface' ;
11- import { CustomTransportStrategy , PacketId , ReadPacket } from '../interfaces' ;
11+ import {
12+ CustomTransportStrategy ,
13+ IncomingRequest ,
14+ PacketId ,
15+ ReadPacket ,
16+ } from '../interfaces' ;
1217import { MqttOptions } from '../interfaces/microservice-configuration.interface' ;
1318import { Server } from './server' ;
1419
@@ -72,18 +77,22 @@ export class ServerMqtt extends Server implements CustomTransportStrategy {
7277 pub : MqttClient ,
7378 ) : Promise < any > {
7479 const rawPacket = this . parseMessage ( buffer . toString ( ) ) ;
75- const packet = this . deserializer . deserialize ( rawPacket ) ;
76- if ( isUndefined ( packet . id ) ) {
80+ const packet = this . deserializer . deserialize ( rawPacket , { channel } ) ;
81+ if ( isUndefined ( ( packet as IncomingRequest ) . id ) ) {
7782 return this . handleEvent ( channel , packet ) ;
7883 }
7984 const pattern = channel . replace ( / _ a c k $ / , '' ) ;
80- const publish = this . getPublisher ( pub , pattern , packet . id ) ;
85+ const publish = this . getPublisher (
86+ pub ,
87+ pattern ,
88+ ( packet as IncomingRequest ) . id ,
89+ ) ;
8190 const handler = this . getHandlerByPattern ( pattern ) ;
8291
8392 if ( ! handler ) {
8493 const status = 'error' ;
8594 const noHandlerPacket = {
86- id : packet . id ,
95+ id : ( packet as IncomingRequest ) . id ,
8796 status,
8897 err : NO_MESSAGE_HANDLER ,
8998 } ;
0 commit comments