qpid-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alan Conway <acon...@redhat.com>
Subject Re: Proton Python on_sendable behavior
Date Thu, 20 Oct 2016 17:18:51 GMT
On Tue, 2016-10-18 at 14:13 -0700, Justin Ross wrote:
> https://gist.github.com/ssorj/1ccf4d1499563722bc419f1e1fac11bf
> 
> In this example, there is still ample credit on the link after the
> last
> on_sendable() is printed, but on_sendable is never fired again.  Is
> that
> expected behavior?
> 
> It appears that on_link_flow is only fired when link credit is
> updated, and
> on_link_flow is the source of all on_sendable events.
> 
> https://github.com/apache/qpid-proton/blob/master/proton-c/bindings/p
> ython/proton/handlers.py#L36


There are two reasons a sender can block: running out of credit or
running out of messages to send. If you run out of messages to send but
still have credit, you need some non-proton way of being notified when
there are more available. Proton will only give you an event when
credit changes.

E.g. in the broker examples (and the real broker) empty queues track
senders that are blocked and wake them up when new messages arrive. In
a single-threaded environment you can check credit and call
sender.send() directly from queue code (the python broker does), but in
a threaded broker you need to "inject" or somehow otherwise wake up the
sender's thread context (like the C++ example does) since it will
usually not be the same as the context that received the message.



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@qpid.apache.org
For additional commands, e-mail: users-help@qpid.apache.org


Mime
View raw message