Thanks, I think I understand the issue now, I'm using BlockingConnection and maybe block for a very long time. so pika does not get a chance to process heartbeats. Under your inspiration(blocking pika), google took me to this issue
https://github.com/pika/pika/issues/196, and I tried to fixed my code accordingly.
My full code is too long, so I took the crucial part of problem Code
```
conn = pika.BlockingConnection()
channel = conn.channel()
while True:
message = poll_message() # this is a problem, if it takes too long, pika does not get to send heartbeats
if not message:
time.sleep(1) # this is a problem, when no message for a while, pika does not get a change to send heartbeats
continue
channel.basic_publish(message...)
```
my solution is one of the following:
1. make sure poll_message does not take too long and use conn.sleep
2. just use a heartbeat thread with conn.process_data_events. (but can I call conn.process_data_events in another thread?)
3. increase or just turn off the heartbeat
So which one is the best solution? or are these solutions correct?
Cheers