Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ack queue message make option in rabbitMQ microservice #1583

Closed
FedorovP777 opened this issue Feb 23, 2019 · 5 comments

Comments

@FedorovP777
Copy link

commented Feb 23, 2019

I'm submitting a...


[ ] Regression 
[ ] Bug report
[X] Feature request
[ ] Documentation issue or request
[ ] Support request => Please do not submit support request here, instead post your question on Stack Overflow.

Current behavior

RabbitMQ message in microservice at once consume with options noAsk: true https://github.com/nestjs/nest/blob/master/packages/microservices/client/client-rmq.ts#L67

Expected behavior

Pleace make parameter with this options.

    const app = await NestFactory.createMicroservice(AppModule, {
        transport: Transport.RMQ,
        options: {
            urls: [configService.get('RABBITMQ_URL')],
            queue: configService.get('RABBITMQ_QUEUE'),
            queueOptions: {
                durable: false,
            },
            noAck: false,
            prefetchCount: 1
        },
    });
@patricknazar

This comment has been minimized.

Copy link

commented Mar 25, 2019

I see this feature as super important. Frankly, I cannot see how to reliably handle messages without this feature. RabbitMQ also has the amqp protocol extension 'publisher confirms' which let the publisher know that rabbitmq has received the message.

@kamilmysliwiec

This comment has been minimized.

Copy link
Member

commented Jun 5, 2019

Published as 6.3.0

@atte-backman

This comment has been minimized.

Copy link

commented Jun 11, 2019

@kamilmysliwiec

As of 6.3.1, this does not work. E.g. with:

app.connectMicroservice({
    transport: Transport.RMQ,
    options: {
        urls: [configService.get('rabbitmq.host')],
        queue: configService.get('rabbitmq.queue'),
        queueOptions: {
            durable: true,
        },
        noAck: false,
        prefetchCount: 1,
    },
});

There comes:

src/main.ts:21:13 - error TS2326: Types of property 'options' are incompatible.
  Type '{ urls: any[]; queue: any; queueOptions: { durable: boolean; }; noAck: boolean; prefetchCount: number; }' is not assignable to type '{ urls?: string[]; queue?: string; prefetchCount?: number; isGlobalPrefetchCount?: boolean; queueOptions?: any; socketOptions?: any; }'.
Object literal may only specify known properties, and 'noAck' does not exist in type '{ urls?: string[]; queue?: string; prefetchCount?: number; isGlobalPrefetchCount?: boolean; queueOptions?: any; socketOptions?: any; }'.

21             noAck: false,
           ~~~~~~~~~~~~
@mjolk

This comment has been minimized.

Copy link

commented Aug 25, 2019

I do not understand why this is closed. Looking in ServerRMQ noAck is hard coded to true...
In the context of MessagePattern this might make sense but i'm guessing most people will use EventPattern in combination with rabbitmq -> worker queues..
Quick and dirty would be to pass the channel to the handleMessage method and ack after handleEvent completes...
Anyway i'll see if i have time for a PR later this week.

PS: i might be reading the source wrong, so forgive me, the server/client classes in the context of RabbitMQ are quite confusing. Eg the hard coded ReplyTo queue is not being created anywhere for example ?

@mlukianenko

This comment has been minimized.

Copy link

commented Sep 17, 2019

@kamilmysliwiec could you please clarify why "noAck" parameter is hardcoded to "true" in "@nestjs/microservices/server/server-rmq.js"?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
6 participants
You can’t perform that action at this time.