Skip to content

Allow to specify that the implementer of ConsumerInterface will handle ACKs #519

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

Merged
merged 2 commits into from
Jan 18, 2018

Conversation

goetas
Copy link
Contributor

@goetas goetas commented Jan 17, 2018

In some case (long running consumers) I would like to "ACK" a message and then start the processing.

Did not manage to find a way to disable the ACK feature at rabbitmq level, so for now I'm just sending in the consumer the ACK before the processing as:

public function execute(AMQPMessage $msg)
{
    // manually ACK!
    $msg->delivery_info['channel']->basic_ack($msg->delivery_info['delivery_tag']);

    // do the processing here

    return ConsumerInterface::MSG_ACK_SENT;
   // this instructs the class to not send other ACKs since was already sent manually
}

@stloyd stloyd merged commit f8670ca into php-amqplib:master Jan 18, 2018
@stloyd
Copy link
Collaborator

stloyd commented Jan 18, 2018

Sounds reasonable too me. Thanks @goetas !

@goetas goetas deleted the consumer-no-send-ack branch January 18, 2018 10:59
@goetas
Copy link
Contributor Author

goetas commented Jan 18, 2018

😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants