Skip to content

Commit 8d367c4

Browse files
Merge branch 'underfin-rmq-options-noack'
2 parents 4de5400 + 1981830 commit 8d367c4

File tree

3 files changed

+8
-1
lines changed

3 files changed

+8
-1
lines changed

packages/microservices/client/client-rmq.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import {
99
DISCONNECT_EVENT,
1010
ERROR_EVENT,
1111
RQM_DEFAULT_IS_GLOBAL_PREFETCH_COUNT,
12+
RQM_DEFAULT_NOACK,
1213
RQM_DEFAULT_PREFETCH_COUNT,
1314
RQM_DEFAULT_QUEUE,
1415
RQM_DEFAULT_QUEUE_OPTIONS,
@@ -52,12 +53,16 @@ export class ClientRMQ extends ClientProxy {
5253
}
5354

5455
public consumeChannel() {
56+
const noAck =
57+
this.getOptionsProp(this.options, 'noAck') || RQM_DEFAULT_NOACK;
5558
this.channel.addSetup((channel: any) =>
5659
channel.consume(
5760
REPLY_QUEUE,
5861
(msg: any) =>
5962
this.responseEmitter.emit(msg.properties.correlationId, msg),
60-
{ noAck: true },
63+
{
64+
noAck,
65+
},
6166
),
6267
);
6368
}

packages/microservices/constants.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ export const RQM_DEFAULT_QUEUE = 'default';
2424
export const RQM_DEFAULT_PREFETCH_COUNT = 0;
2525
export const RQM_DEFAULT_IS_GLOBAL_PREFETCH_COUNT = false;
2626
export const RQM_DEFAULT_QUEUE_OPTIONS = {};
27+
export const RQM_DEFAULT_NOACK = true;
2728
export const GRPC_DEFAULT_PROTO_LOADER = '@grpc/proto-loader';
2829

2930
export const NO_MESSAGE_HANDLER = `There is no matching message handler defined in the remote service.`;

packages/microservices/interfaces/microservice-configuration.interface.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,5 +94,6 @@ export interface RmqOptions {
9494
isGlobalPrefetchCount?: boolean;
9595
queueOptions?: any;
9696
socketOptions?: any;
97+
noAck?: boolean;
9798
};
9899
}

0 commit comments

Comments
 (0)