@@ -107,7 +107,7 @@ export class QueueManager {
107107 dispatcher,
108108 options,
109109 defaultDispatch
110- } ) {
110+ } ) : Observable < Replies . Consume > {
111111 const consumerChannel = this . _ch . getChannel ( ) ;
112112 return Observable . fromPromise (
113113 this . _ch . getChannel ( ) . consume ( this . getName ( ) , message => {
@@ -150,6 +150,8 @@ export class QueueManager {
150150 )
151151 . do ( res => MessageStore . addConsumer ( consumerChannel , res . consumerTag ) )
152152 . do ( res => {
153+ // If channel is closed, has en error or is reconnected the consumerTag is not valid
154+ // and needs to be removed
153155 [ 'close' , 'error' , 'reconnected' ] . forEach ( event => this . _ch . once ( event , ( ) => {
154156 debug ( 'removing consumer' , res . consumerTag ) ;
155157 MessageStore . removeConsumer ( res . consumerTag ) ;
@@ -161,8 +163,7 @@ export class QueueManager {
161163 message : RabbitMessage ,
162164 { storeMessage, options, err, consumerChannel } :
163165 { storeMessage : StoreMessage ,
164- // options: { errorHandler: (err: Error, message: RabbitMessage, ch: ChannelInterface) => {} },
165- options : any ,
166+ options : { errorHandler : ( err : Error , message : RabbitMessage , ch : ChannelInterface ) => { } } ,
166167 err : Error , consumerChannel : ChannelInterface }
167168 ) {
168169 if ( MessageStore . isShutdownRunning ( ) ) {
0 commit comments