[rabbitmq-discuss] STOMP Heartbeat

Alexander Goldstone alex at kinishi.com
Fri May 6 23:36:40 BST 2011


I am running RabbitMQ 2.4.1 with Erlang R13B03 and I have the management and stomp plugins installed.

I have clients connecting via STOMP over GPRS and I have noticed that if the client does not gracefully disconnect from the server then the 'channel' stays open.

The cause seems to be that the mobile network (APN) does not realise that the connection has been closed and so it stays connected to the RabbitMQ server.

The problem with this is that if a message is sent to the remote client and the client does not ACK the message before being non-gracefully disconnected then RabbitMQ does not re-deliver the message to the client the next time it connects to the server.

I assume the mobile network would time-out eventually however I have seen it hold connections for several hours during testing before I give up and restart the RabbitMQ process to kill off the erroneous connections.

I see that the new (version 1.1) STOMP protocol provides a heartbeat feature. Does RabbitMQ support this? My assumption is that RabbitMQ would see that the heartbeat frames had stopped being transmitted by the client and the RabbitMQ server would therefore close the channel even if the mobile network is holding the connection open. Is this correct?

I have not been able to get the heartbeat feature of the STOMP protocol to work however I can see the word "heartbeat" in several locations of the source code implying that it is implemented.

If I sent this to the server:

		CONNECT
		accept-version:1.1
		host:/
		login:guest
		passcode:guest
		prefetch:1
		heart-beat:1,1

Then I receive this:

		CONNECTED
		session:session-lnvfUXmXdtlVdBE7p35KZQ==
		heartbeat:0,0
		version:1.1 

Any feedback as to how I should be using the heartbeat feature of the new STOMP protocol or any other suggestions as to how I solve the underlying problem of channels incorrectly being kept open would be gratefully appreciated.

Regards,

Alex



More information about the rabbitmq-discuss mailing list