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
I was having an issue with periodic lost messages -- I figured out how to "fix" it, but I don't understand why it fixes it. So it leaves me uneasy...
It turns out in certain cases, I wasn't calling self.q.close() nor self.connection.release(). Does it make sense that a self.q.put() might never get actually sent if these aren't explicitly called? So that I might understand Kombu+Rabbit better -- why?
(The q and connections objects below otherwise would have been left to the python GC... they are not persistent, they're actually part of a context manager, and the containing function returns promptly.)
Using RabbitMQ, the q setup code was:
self.no_ack = no_ack
self.ttl = ttl # This is set for 7 days.
self.connection = kombu.Connection(AMQP_URL)
self.q = SimpleQueue(
channel=self.connection,
name=self.qname,
no_ack=no_ack,
queue_args={"x-expires": int(self.ttl * 1000)},
serializer="msgpack",
)
self.q.consumer.qos(prefetch_count=1) # I've set this to 0 now.
self.q.consumer.accept = prepare_accept_content(["msgpack", "json"])
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
I was having an issue with periodic lost messages -- I figured out how to "fix" it, but I don't understand why it fixes it. So it leaves me uneasy...
It turns out in certain cases, I wasn't calling self.q.close() nor self.connection.release(). Does it make sense that a self.q.put() might never get actually sent if these aren't explicitly called? So that I might understand Kombu+Rabbit better -- why?
(The q and connections objects below otherwise would have been left to the python GC... they are not persistent, they're actually part of a context manager, and the containing function returns promptly.)
Using RabbitMQ, the q setup code was:
Beta Was this translation helpful? Give feedback.
All reactions