2

I have looked through the tutorials on rabbitmq and find it useful.

But I can't find a document telling how to send files via rabbitmq, using pika.

Code examples are preferred, and other libraries other than pika are acceptable.

CharlesB
  • 86,532
  • 28
  • 194
  • 218
can.
  • 2,098
  • 8
  • 29
  • 42
  • What have you tried? RabbitMQ supports binary. Can you serialize to binary and then send? – Davin Tryon Aug 31 '12 at 08:51
  • @dtryon seems pika only accepts string as the parameter. I tried using pickle, but pickle can't serialize file object – can. Aug 31 '12 at 09:14
  • Have you seen this: http://stackoverflow.com/questions/1859438/using-python-how-do-i-get-a-binary-serialization-of-my-google-protobuf-message – Davin Tryon Aug 31 '12 at 11:17

2 Answers2

0

I've done this by using base64encode.

I build a json object - example:

data = {
filname = 'myfile.txt',
b64 = 'the base64 representation of the file'
}

Then, at the consumer side

base64decode :)

Alex Hellier
  • 435
  • 1
  • 7
  • 15
-2

You can send file name as a message and on consumer side you can setup passwordless scp to fetch file from remote machine hosting the file.