简体   繁体   English

如何使用pika通过Rabbitmq发送文件?

[英]How to use pika to send a file via rabbitmq?

I have looked through the tutorials on rabbitmq and find it useful. 我浏览了Rabbitmq上的教程,发现它很有用。

But I can't find a document telling how to send files via rabbitmq, using pika. 但是我找不到文档说明如何使用pika通过Rabbitmq发送文件。

Code examples are preferred, and other libraries other than pika are acceptable. 最好使用代码示例,并且可以接受除pika之外的其他库。

I've done this by using base64encode. 我已经通过使用base64encode做到了。

I build a json object - example: 我建立一个JSON对象-示例:

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

Then, at the consumer side 然后,在消费者端

base64decode :) base64decode :)

您可以将文件名作为消息发送,在用户方面,您可以设置无密码的scp来从托管该文件的远程计算机上获取文件。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM