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
Versions: py-amqplib 0.6.1, RabbitMQ 1.5.4, Python 2.6.4
I would like to perform the following:
chan.basic_consume(..)
heartbeat_deadline = new_deadline(...) # Compute a time instant
while 1:
next_deadline = max(0, heartbeat_deadline - time.time())
chan.wait(timeout = next_deadline)
# We get there if a message was processed,
# or if nothing was received for the specified amount of time.
# Check if we reached our deadline:
if time.time() > heartbeat_deadline:
chan.basic_publish(...)
heartbeat_deadline = new_deadline(...)
The purpose is to allow me to run a loop to receive new messages from
a queue synchronously, but that still allow me to send message back to
the server at regular interval (like heartbeat or something like that.)
Could py-ampqlib support that easily? I've not checked sources in detail,
but I think _AbstractTransport._read(self, n) could support an additionnal
parameter 'timeout', which would be used only for receiving the header
of a new frame (other uses would set timeout to None) if .wait() specified
a timeout itself, using select() before the read() operation.
But maybe I misusing the library. Is that another way to obtain the same
behavior? I thought about writing a second process (and thus opening
an additionnal TCP connection) but I'm not really happy with this idea.
I would prefer to perform all the stuff from a single process.
Original issue reported on code.google.com by [email protected] on 21 Jan 2010 at 2:37
The text was updated successfully, but these errors were encountered:
Original issue reported on code.google.com by
[email protected]
on 21 Jan 2010 at 2:37The text was updated successfully, but these errors were encountered: