[rabbitmq-discuss] Queries regarding rabbitmq-C APIs

Alan Antonuk alan.antonuk at gmail.com
Fri Nov 15 05:27:14 GMT 2013


The status codes were introduced in v0.4.0 of the library. Given you're
also using SSL which was also introduced in v0.4.0, I'm guessing you're
using that version of the library.  I would highly encourage you to upgrade
to v0.4.1 as there are some potentially serious bugs that are fixed as of
that version.

If you're using an SSL connection, then yes, if you pull the network cable,
it is possible to get an AMQP_STATUS_SSL_ERROR.  As for the
AMQP_STATUS_TIMEOUT, a possibility is that the socket times out before the
OS informs rabbitmq-c that the socket has been closed because the network
is no longer available. If you were to re-try the same call after getting
an AMQP_STATUS_TIMEOUT what error-code is returned?

-Alan


On Wed, Nov 13, 2013 at 9:54 PM, Lothe Shashank <
Shashank.Lothe at techmahindra.com> wrote:

>  Alan,
>
> For the following query I tried testing the network cable pull out
> scenario again. However I noticed that the listner API
> amqp_simple_wait_frame_noblock returns AMQP_STATUS_SSL_ERROR or
> AMQP_STATUS_TIMEOUT and not the AMQP_STATUS_SOCKET_CLOSED or
> AMQP_STATUS_SOCKET_ERROR as mentioned by you. I am using 0.3.0 of
> rabbitmq-c library and AMQP_STATUS_SOCKET_CLOSED macro is not present in
> amqp.h.
>
> Could you kindly confirm the return code of amqp_simple_wait_frame_noblock
> when network cable is pulled out? How can I handle network cable pull out
> scenario in my listner program?
>
> I have also noticed that if two listner threads with different amqp
> connections are running and network cable is pulled out one listner is
> receiving AMQP_STATUS_SSL_ERROR and another is receiving AMQP_STATUS_TIMEOUT
> as a return value.
>
> *Older post for your reference:*
>
> [Shashank Query] Is there is a way to check from rabbitmq-c library
> function, if the network cable is pulled out?
>
>
>  [Alan Reply] As far as I know, there isn't a portable socket API for
> detecting a network cable from being pulled. The best we can do is to
> detect when the TCP connection has been closed. All rabbitmq-c functions
> that cause a read or write to the socket check the return from these
> functions to detect the socket being closed unexpectedly. If the socket is
> closed the client will receive an AMQP_STATUS_SOCKET_CLOSED or
> AMQP_STATUS_SOCKET_ERROR as a return value.
>
> Thanks and regards,
> Shashank
>
> ------------------------------
>
> DISCLAIMER:
> This email (including any attachments) is intended for the sole use of the
> intended recipient/s and may contain material that is CONFIDENTIAL AND
> PRIVATE COMPANY INFORMATION. Any review or reliance by others or copying or
> distribution or forwarding of any or all of the contents in this message is
> STRICTLY PROHIBITED. If you are not the intended recipient, please contact
> the sender by email and delete all copies; your cooperation in this regard
> is appreciated.
>
> _______________________________________________
> rabbitmq-discuss mailing list
> rabbitmq-discuss at lists.rabbitmq.com
> https://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rabbitmq.com/pipermail/rabbitmq-discuss/attachments/20131114/252dc122/attachment.htm>


More information about the rabbitmq-discuss mailing list