'rabbitmq.conf consumer_timeout not working in docker
I'm trying to execute a longer task with celery, so to test I made a sample task sleep for 5 minutes and set the rabbitmq.conf file with a single line containing consumer_timeout = 10000 expecting the task to fail with precondition error after 10seconds(or at least after 60 seconds as per this answer), but it never did. The task completes after 5mins.
I can see the rabbitmq.conf file shows up on top of logs(which I think it means it loaded the file successfully??)
main_rabbitmq | Config file(s): /etc/rabbitmq/rabbitmq.conf
main_rabbitmq | /etc/rabbitmq/conf.d/10-default-guest-user.conf
My Dockerfile:
FROM rabbitmq:3.9.13-management
# Define environment variables.
ENV RABBITMQ_USER user
ENV RABBITMQ_PASSWORD password
ENV RABBITMQ_PID_FILE /var/lib/rabbitmq/mnesia/rabbitmq
COPY ./myrabbit.conf /etc/rabbitmq/rabbitmq.conf
ADD init.sh /init.sh
RUN chmod +x /init.sh
# Define default command
CMD ["/init.sh"]
The init.sh file is similar to this.
Solution 1:[1]
Please see this repository which you can use to see the consumer timeout happen:
https://github.com/lukebakken/stackoverflow-72318314-1466825
Note that I made some improvements to your custom entrypoint script.
I do see that the consumer_timeout setting is applied correctly. However, there is another setting that comes into play, the channel_tick_timeout which is the interval at which periodic operations happen on a channel (like checking for stale consumers). This is set to 60 seconds by default.
https://stackoverflow.com/a/70958499/1466825
Without knowing how you use Celery I can't say why you're not seeing the same timeout.
NOTE: the RabbitMQ team monitors the rabbitmq-users mailing list and only sometimes answers questions on StackOverflow.
Solution 2:[2]
Using value "attachment" for response header "Content-Disposition" will download the PDF . Instead of displaying it in new tab.
Value "inline" for response header "Content-Disposition" will open the PDF in new tab in browser.
For example:
v1
headers.add("Content-Disposition", "inline;filename=PDF.pdf");
v2
headers.add(HttpHeaders.CONTENT_DISPOSITION, "inline;filename=PDF.pdf");
You can review: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Disposition
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | |
| Solution 2 |
