This can be done using pika, you can read the file content and send it as a big string to RabbitMQ. And on the other side you can parse the content using ElementTree.fromstring
.
Connection details:
credentials = pika.PlainCredentials('username', 'password')
conn = pika.BlockingConnection(pika.ConnectionParameters('host', port, 'vhost', credentials))
channel = conn.channel()
Publisher:
with open('filename.xml', 'r') as fp:
lines = fp.readlines()
channel.basic_publish('exchange', 'queue', ''.join(lines))
Consumer:
def on_message(unused_channel, unused_method_frame, unused_header_frame, body):
lines = body.decode()
doc = ElementTree.fromstring(lines)
tags = doc.findall("tag")
## DO YOUR STUFF HERE
channel.basic_consume('queue', on_message)
channel.start_consuming()
Hope this helps!
RabbitMQ flow:

Reference: RabbitMQ docs