Sending other data along with a file using Kombu (carrot)

352 views Asked by At

How can I send a file along with other data using Kombu? I'm using rabbitmq as the broker.

e.g. file.pdf along a dictionary {'author': 'user'}

I'd like to do this in a single message if possible. But if you reckon using standard serializers of Kombu, how would you bind the separate messages?

1

There are 1 answers

1
asksol On

There are several ways, but how about:

producer.send({"author": "user", "file": file})

or:

producer.send(file, serializer=None, headers={"author": "user"})

Headers can only be of types supported by AMQP though.