I'm writing some python code using pika 0.9.13 to connect to RabbitMQ. I'm creating lots of child processes (potentially 1000s) and want each process to be able to send to RabbitMQ. Reading around, it seems the best way is to create a single connection and then create channels within that connection.
Can anyone advise how best this should be done ? Typically the code would look like :-
from multiprocessing import Process
def f(connection):
# pass the pika connection somehow ...
# create the channel ...
channel = connection.channel()
# .... rest of process code
if __name__ == '__main__':
#
# pika code here to establish the MQ connection ...
# connection = ....
p = Process(target=f, args=(connection,))
p.start()
What type of adapter should I use (BlockingConnection ?) ...
Thanks in advance !