How can I set TTL for a RabbitMQ queue from MATLAB?

33 views Asked by At

I have been trying to get this to work but I am stuck. I have two systems and one runs python in which I declare the queue as following:

channel_task = pika.BlockingConnection(pika.ConnectionParameters(host='localhost', heartbeat=30)).channel()
task_queue = channel_task.queue_declare(queue='task-queue', durable=True,arguments = {'x-message-ttl' : 1000})

channel_job.basic_consume(queue=queue.method.queue,
                          auto_ack=True,
                          on_message_callback=lambda ch, method, properties, body: 

on_job_received(ch, method,
                                                                                               properties, body,
                                                                                                   channel_task))

On the other system I have MATLAB program where I need to send tasks to the task-queue and I do that as following:

task_queue = rabbitmq.QueueProperties("name", "task-queue", "durable", true);
config = rabbitmq.ConnectorProperties("host", obj.hostname, "port", 5672, "queue", task_queue, "routingkey", "tasks");
            obj.task_producer = rabbitmq.Producer(config);

But I get the following error in MATLAB:

Caused by: com.rabbitmq.client.ShutdownSignalException: channel error; protocol method: #method<channel.close>(reply-code=406, reply-text=PRECONDITION_FAILED - inequivalent arg
'x-message-ttl' for queue 'task-queue' in vhost '/': received none but current is the value '1000' of type 'signedint', class-id=50, method-id=10)

Can someone please help me how to input TTL arguments to QueueProperties in RabbitMQ MATLAB class ?

Thanks.

0

There are 0 answers