corvus-ch / rabbitmq-cli-consumer

Consume RabbitMQ messages into any cli program
MIT License
236 stars 36 forks source link

Messages are not beging re-queued after an exit(1) #89

Open kwadx opened 2 years ago

kwadx commented 2 years ago

Hello,

I created a very simple PHP test script which writes the content of a the message in a file and ends with an exit(1) instruction. The messages are being processed and not re-queued. I am confused and I do not see what I am missing ><

Here is the command : ./rabbitmq_cli_consumer --configuration rabbitmq_cli_consumer.conf --verbose --no-declare --executable '/var/www/html/demo.php'

And the script : #!/usr/bin/env php <?php

// This contains first argument $message = $argv[1];

// Decode to get compressed value $original = base64_decode($message);

$myfile = fopen("/tmp/file.txt", "a") or die("Unable to open file!"); fwrite($myfile, $original); fclose($myfile);

exit(1);

I can see in the logs that it catches the error, but the message is processed anyway : 2022/01/29 08:43:34 Failed. Check error log for details. 2022/01/29 08:43:34 Error: exit status 1 2022/01/29 08:43:34 Failed: 2022/01/29 08:43:34 Processed!

If you see something that I don't...

Thanks =)

fchris82 commented 1 year ago

Read the documentation, especially this part: Allowed exit codes