You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
You're not closing the connection. You might want to try with a connection manager to make sure the socket is closed and flushed correctly (this is only a guess).
with rabbitpy.Connection() as conn:
with conn.channel() as channel:
for message_number in range(0, 10):
...
and i get a failed for every published messge. But when it is all done, and i do a:
connection.close()
all the messages do appear in the queue. I do not understand why the publishing is failing, but they do get sent over when i close the connection.
I am using Python 3.9.5.
EDIT: it turns out that it is not closing per se. if i put in a sleep after all the publish calls, the message eventually get into the queue. So it seems like it is a timing issue.
OBS: when i run this code in shell python instead run the file with python file.py, the code works normally.
The video show the print for all loop in range, but only one or two messages is sent: https://vimeo.com/412936004
Terminal examples:
/\ i run this file 10 times.
And i get this messages:
Source code without comments:
publisher.py:
consumer.py:
The text was updated successfully, but these errors were encountered: