Skip to content

Commit

Permalink
feat(@nestjs/microservices): ack queue message make option in rabbitM…
Browse files Browse the repository at this point in the history
…Q microservice nestjs#1583
  • Loading branch information
underfin committed Apr 20, 2019
1 parent ec14c92 commit 102a345
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 5 deletions.
6 changes: 5 additions & 1 deletion packages/microservices/client/client-rmq.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import {
RQM_DEFAULT_QUEUE,
RQM_DEFAULT_QUEUE_OPTIONS,
RQM_DEFAULT_URL,
RQM_DEFAULT_NOACK
} from './../constants';
import { WritePacket } from './../interfaces';
import { ClientProxy } from './client-proxy';
Expand Down Expand Up @@ -60,7 +61,10 @@ export class ClientRMQ extends ClientProxy {
REPLY_QUEUE,
(msg: any) =>
this.responseEmitter.emit(msg.properties.correlationId, msg),
{ noAck: true },
{
noAck: this.getOptionsProp<RmqOptions>(this.options, 'noAck') ||
RQM_DEFAULT_NOACK
}
),
);
}
Expand Down
1 change: 1 addition & 0 deletions packages/microservices/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ export const RQM_DEFAULT_QUEUE = 'default';
export const RQM_DEFAULT_PREFETCH_COUNT = 0;
export const RQM_DEFAULT_IS_GLOBAL_PREFETCH_COUNT = false;
export const RQM_DEFAULT_QUEUE_OPTIONS = {};
export const RQM_DEFAULT_NOACK = true;
export const GRPC_DEFAULT_PROTO_LOADER = '@grpc/proto-loader';

export const NO_MESSAGE_HANDLER = `There is no matching message handler defined in the remote service.`;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { MqttClientOptions } from '@nestjs/common/interfaces/external/mqtt-options.interface';
import { Transport } from '../enums/transport.enum';
import { Server } from './../server/server';
import { CustomTransportStrategy } from './custom-transport-strategy.interface';
import {MqttClientOptions} from '@nestjs/common/interfaces/external/mqtt-options.interface';
import {Transport} from '../enums/transport.enum';
import {Server} from './../server/server';
import {CustomTransportStrategy} from './custom-transport-strategy.interface';

export type MicroserviceOptions =
| GrpcOptions
Expand Down Expand Up @@ -94,5 +94,6 @@ export interface RmqOptions {
isGlobalPrefetchCount?: boolean;
queueOptions?: any;
socketOptions?: any;
noAck?: boolean;
};
}

0 comments on commit 102a345

Please sign in to comment.