I need to canvass opinion. As you may or may not know, I've tried to
make Bunny easy to use. There is always room for improvement, and one
of the things that needs addressing is handling of AMQP Channel.Flow
methods.
The Channel.Flow method allows an AMQP server that is low on
resources to tell a message publishing AMQP client to stop publishing
messages in order to prevent a crash. So if you haven't been
operating at the ragged edge of server performance then you probably
haven't had to deal with Channel.Flow.
The AMQP Basic.Publish method that Bunny uses to publish messages is
asynchronous in AMQP terms. That means that it doesn't return a
confirmation of success. Therefore, in Bunny I have a problem
checking the success of a publish because the only way I know that
publish has worked, without making other calls, is by the absence of
error conditions.
What I would like to do to handle Channel.Flow is something like -
1. Make a publish call
2. Check the return value (if specified in the publish call)
3. Take appropriate action
Nope, can't do number 2 because there isn't anything to check.
However, I could try to read from the socket after making the publish
call to determine whether a Channel.Flow method has been sent from
the server. There are problems with that approach too -
1. Bunny does a blocking read. If there is nothing to read, Bunny
will wait indefinitely unless timeout.rb is used. My testing has
alerted me to the possibility that timeout.rb cannot be relied upon
in this scenario even in Ruby 1.9.
2. If I go with timeout.rb nonetheless, how long should the timeout
period be? If the timeout period is too short I might miss a
Channel.Flow message. Too long and it will slow down publishing to a
degree that could prove unacceptable.
3. I could use select() with no blocking but that would mean some re-
engineering in a fundamental part of the code.
It is possible for me to catch the Channel.Flow methods as a
consequence of other synchronous AMQP calls. I could implement this
functionality very easily.
So, I'm not going to do anything without consulting the people who
use Bunny, namely yourselves. If I don't get any feedback on this
then I will assume that it's not a major issue and ignore it. If you
want something done about it then please let me know what behaviour
you need, fork the project on GitHub and try out some solutions,
whatever floats your boat.
A couple of people have already addressed this topic with me and I
thank them for their input.
Regards,
Chris
_______________________________________________
bunny-amqp-devel mailing list
bunny-am...@rubyforge.org
http://rubyforge.org/mailman/listinfo/bunny-amqp-devel