Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
昆布を使って他のデータと一緒にファイルを送るにはどうすればいいですか?ブローカーとしてrabbitmqを使用しています。
例:辞書に沿ったfile.pdf {'author':'user'}
可能であれば、これを1つのメッセージで行いたいと思います。しかし、昆布の標準的なシリアライザーを使用するとしたら、個別のメッセージをどのようにバインドしますか?
いくつかの方法がありますが、次の方法はどうでしょうか。
producer.send({"author": "user", "file": file})
また:
producer.send(file, serializer=None, headers={"author": "user"})
ただし、ヘッダーは AMQP でサポートされているタイプのみにすることができます。