0

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?

joshua
  • 1
  • 1

1 Answers1

0

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.

asksol
  • 19,129
  • 5
  • 61
  • 68