alanxz / rabbitmq-c

RabbitMQ C client
MIT License
1.76k stars 669 forks source link

RPC-timeouts Vs Heartbeats #544

Open simplyatul opened 5 years ago

simplyatul commented 5 years ago

Hi, I want to use rabbitmq_c library in my Producer application. I am confused whether should I use RPC timeouts Or Heartbeat mechanism.

I see following APIs blocks if n/w is broken

amqp_open_socket amqp_login amqp_channel_open amqp_confirm_select amqp_channel_close amqp_connection_close

I see amqp_open_socket_noblock version is available, however for rest of the APIs I need to use either RPC timeouts Or Heartbeat (If I have understood the code and various other posts on github).

I see a warning in amqp.h saying "rabbitmq-c only has partial support for hearts". Other statement on RPC is "RPC-timeouts are an advanced feature intended to be used to detect dead connections quickly when the rabbitmq-c implementation of heartbeats does not work. Do not use RPC timeouts unless you understand the implications of doing so".

My Producer application should not block on any of the APIs for more than couple of secs. Another fact is my producer publishes messages intermittently. Sometimes publishes very large number of messages (30/sec), but sometimes it may publish a single message in an half hour or so.

I am planning to use 0.9.0 release.

Can anyone guide me should I go with RPC-timeouts Or with Heartbeats?

Thank you in advance.

-- BR, Atul Thosar

simplyatul commented 5 years ago

Ok..Just seen this thread - https://github.com/alanxz/rabbitmq-c/issues/403 It looks using RPC-timeouts suit my case as well.

However can anyone help me to understand implication of using RPC-timeouts as mentioned in the documentation. What kind of care should I take while calling the APIs? Or may be something else?

-- BR, Atul Thosar