rabbitmq-c and network problems

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

rabbitmq-c and network problems

Haster
Hi there!
Does rabbitmq-c library have any method to check correctness of connection?

For example I call basic.consume and start reading loop from Server... And server fall down, or network cord was cut by something... As I understand I won't be  give noticed about this situations... (my loop is constructed on waiting socket in select function)?

So is it any way to know about such problems?
Reply | Threaded
Open this post in threaded view
|

Re: rabbitmq-c and network problems

Tim Watson-5
What you want to do is turn on AMQP heartbeats. IIRC the c client requires that you manage the send/recv of these by hand though.

On 19 Aug 2013, at 09:32, Haster <[hidden email]> wrote:

> Hi there!
> Does rabbitmq-c library have any method to check correctness of connection?
>
> For example I call basic.consume and start reading loop from Server... And
> server fall down, or network cord was cut by something... As I understand I
> won't be  give noticed about this situations... (my loop is constructed on
> waiting socket in select function)?
>
> So is it any way to know about such problems?
>
>
>
> --
> View this message in context: http://rabbitmq.1065348.n5.nabble.com/rabbitmq-c-and-network-problems-tp28910.html
> Sent from the RabbitMQ mailing list archive at Nabble.com.
> _______________________________________________
> rabbitmq-discuss mailing list
> [hidden email]
> https://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss
_______________________________________________
rabbitmq-discuss mailing list
[hidden email]
https://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss
Reply | Threaded
Open this post in threaded view
|

Re: rabbitmq-c and network problems

Haster
Tim, thanks for reply.
I will read about hearbeats.
But what is IIRC client? Google doesn't get me any links...
I use rabbitmq-c client in my application,
Reply | Threaded
Open this post in threaded view
|

Re: rabbitmq-c and network problems

Tim Watson-6
On 19 Aug 2013, at 10:52, Haster wrote:
> Tim, thanks for reply.
> I will read about hearbeats.
> But what is IIRC client? Google doesn't get me any links...
> I use rabbitmq-c client in my application,
>
>

IIRC == If I Remember Correctly.

_______________________________________________
rabbitmq-discuss mailing list
[hidden email]
https://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss
Reply | Threaded
Open this post in threaded view
|

Re: rabbitmq-c and network problems

alan.antonuk
In reply to this post by Tim Watson-5
The library will return a library error of AMQP_STATUS_CONNECTION_CLOSED if the underling connection to the broker has been severed.

As of rabbitmq-c v0.4.0 the library will send and receive heartbeats when doing long-running calls into the library (e.g., calling amqp_consume_message()) after they've been enabled by specifying a non-zero heartbeat parameter in amqp_login(). Note that if a heartbeat timeout occurs a library error of AMQP_STATUS_HEARTBEAT_TIMEOUT will be returned.



On Mon, Aug 19, 2013 at 2:23 AM, Tim Watson <[hidden email]> wrote:
What you want to do is turn on AMQP heartbeats. IIRC the c client requires that you manage the send/recv of these by hand though.

On 19 Aug 2013, at 09:32, Haster <[hidden email]> wrote:

> Hi there!
> Does rabbitmq-c library have any method to check correctness of connection?
>
> For example I call basic.consume and start reading loop from Server... And
> server fall down, or network cord was cut by something... As I understand I
> won't be  give noticed about this situations... (my loop is constructed on
> waiting socket in select function)?
>
> So is it any way to know about such problems?
>
>
>
> --
> View this message in context: http://rabbitmq.1065348.n5.nabble.com/rabbitmq-c-and-network-problems-tp28910.html
> Sent from the RabbitMQ mailing list archive at Nabble.com.
> _______________________________________________
> rabbitmq-discuss mailing list
> [hidden email]
> https://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss
_______________________________________________
rabbitmq-discuss mailing list
[hidden email]
https://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss


_______________________________________________
rabbitmq-discuss mailing list
[hidden email]
https://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss
Reply | Threaded
Open this post in threaded view
|

Re: rabbitmq-c and network problems

Haster
Alan, thanks for reply!

I use rabbitmq 0.3.0, and there is no yet method amqp_login_with_parameters.. Is there any simple method to add this functionality? And if not how can I realize it by myself? Should I use some thread that will periodicaly send some specific method to server and get anser from it or?

And now I check below usage case:
1) start server (I use old version version 2.8.6)
2) start consumer and start reading loop (befor this I have called basic.consume method)
3) kill rabbitmq server
As a result I don't receive any errrors and my reading thread works as befor.
Reply | Threaded
Open this post in threaded view
|

Re: rabbitmq-c and network problems

alan.antonuk

On Mon, Aug 19, 2013 at 12:31 PM, Haster <[hidden email]> wrote:

I use rabbitmq 0.3.0, and there is no yet method
amqp_login_with_parameters.. Is there any simple method to add this
functionality? And if not how can I realize it by myself? Should I use some
thread that will periodicaly send some specific method to server and get
anser from it or?

My recommendation is to upgrade rabbitmq-c to v0.4.0. While it is possible to implement AMQP heartbeats from a client program, it requires in-depth knowledge of the AMQP protocol, the innards of rabbitmq-c, and likely will break when you get to the point of upgrading to v0.4.0.


And now I check below usage case:
1) start server (I use old version version 2.8.6)
2) start consumer and start reading loop (befor this I have called
basic.consume method)
3) kill rabbitmq server
As a result I don't receive any errrors and my reading thread works as
befor.

Even without heartbeat support, the library should eventually error-out in amqp_simple_wait_frame() when the socket is closed. There might be a few messages in the client-side network buffer that will end up being consumed by rabbitmq-c before it detects that socket has been closed.

-Alan

_______________________________________________
rabbitmq-discuss mailing list
[hidden email]
https://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss