This comment by one of the Pika's maintainers sums it up. Essentially, Pika is not thread-safe. Messages should not be published from a different thread than the one running Pika's I/O loop. Hence, the method publishing messages should use the add_callback_threadsafe method on the connection to schedule a function (that would publish a message) to execute on the correct thread.
Coverage increased (+0.0006%) to 63.902% when pulling 95e6c55490c3bcc2af9b25d61ad8d972d9007bc3 on joao-conde:master into 5f5f41b1d43084f815c8c3b8511f556f2a34c78d on hivesolutions:master.
This comment by one of the Pika's maintainers sums it up. Essentially, Pika is not thread-safe. Messages should not be published from a different thread than the one running Pika's I/O loop. Hence, the method publishing messages should use the
add_callback_threadsafe
method on the connection to schedule a function (that would publish a message) to execute on the correct thread.Documentation on the method: BlockingConnection.add_callback_threadsafe
@joamag