[
https://issues.apache.org/jira/browse/PROTON-1328?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15612182#comment-15612182
]
Alan Conway commented on PROTON-1328:
-------------------------------------
There are two reasons a sender can be "blocked": no AMQP credit so not allowed
to send, and no messages available to send.
on_sendable() only covers the credit side: it fires when a sender that had no
credit is given some (In fact it may fire for other increases to credit > 0,
but robust code should only assume it will get at least on "not blocked"
notice, since credit can jump by increments more than 1.)
Proton has no way of knowing when messages become "available" in the
application, so if a sender runs out of application messages (is "blocked' by
the application) while it still has credit then you cannot rely on
on_sendable() to send messages.
A single threaded application can simply check sender credit and call
sender.send() itself when a message becomes available - typically there will be
some collaboration or common code between this and the implementation of
on_sendable() (e.g. see the proton example python broker)
A multi-threaded application needs to take more care since the application
thread that makes a message available may not be able to directly access the
proton sender object that may be processed in another thread. The c++ example
shows how to use inject() to send a notification between connections to
acomplish the same thing in a thread-safe way.
> Sending two messages with 1 sender hangs
> ----------------------------------------
>
> Key: PROTON-1328
> URL: https://issues.apache.org/jira/browse/PROTON-1328
> Project: Qpid Proton
> Issue Type: Bug
> Components: python-binding
> Affects Versions: 0.14.0
> Environment: Fedora 24 using packages from F24 repos
> Reporter: Brian Bouterse
>
> Sending two messages using 1 sender with a delay between the two messages
> hangs for me. I do all of my message sending in on_sendable(). I thought that
> on_sendable() would periodically get called. I'm not sure why I think that.
> If I keep sending messages on_sendable() continues to be called, but after
> two calls without messages being sent on_sendable() stops being called.
> I have a periodic timer task that is checking for messages to be sent and so
> it can receive a message to send at any time. If the message is for an
> address which corresponds with an existing sender, that sender should be used.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]