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

Problem with queue with max-length defined. #3440

Closed
madhur opened this issue Sep 10, 2016 · 3 comments
Closed

Problem with queue with max-length defined. #3440

madhur opened this issue Sep 10, 2016 · 3 comments

Comments

@madhur
Copy link

madhur commented Sep 10, 2016

I am using celery 3.18 and using beat scheduler to put a task in queue every minute. I have a max length defined to 1 for the queue.

CELERYBEAT_SCHEDULE = {
    'user_engagement_task': {
        'task': 'tasks.engagement_beat_task',
        'schedule': crontab(minute='*/1')
    }
}

The queue is consumed by consumer in node.js.

 amqp.connect(config.get('amqp')).then(function (conn) {
        return conn.createChannel().then(function (ch) {
            ch.prefetch(1);

            var ok = ch.assertQueue(q, {durable: true, maxLength: 1});

I get the following in celery beat logs and no message is inserted in queue

Message Error: Couldn't apply scheduled task user_engagement_task: queue.declare: server channel error 406, message: PRECONDITION_FAILED - inequivalent arg 'x-max-length' for queue 'tasks.engagement_beat_task' in vhost '/': received none but current is the value '1' of type 'byte'

This is working in docker environment on MAC OSX, but failing in Centos 6 environment. I am using rabbitmq 3.5.6

@ask
Copy link
Contributor

ask commented Sep 16, 2016

You cannot define queue x to have a max-length of 1, then declare it again as having no limit.

Make sure celery beat is using the same arguments:

from kombu import Exchange, Queue

app.conf.CELERY_QUEUES = [
    Queue('foo', Exchange('foo'),
                 routing_key='foo'
                 queue_arguments={'x-max-length': 1},
    ),
]

@ask
Copy link
Contributor

ask commented Sep 16, 2016

I guess there's no programmers left working at GitHub now that they stopped using a fixed-width font for code examples :(

@madhur madhur closed this as completed Sep 21, 2016
@madhur
Copy link
Author

madhur commented Sep 21, 2016

👍

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

No branches or pull requests

2 participants