From 17cebce5eded62360045788f86e4b940cf062455 Mon Sep 17 00:00:00 2001 From: Julian Scheid Date: Wed, 21 Oct 2015 20:18:50 +0200 Subject: [PATCH] ARTEMIS-239 disable ttl for STOMP connections Leave dead connection detection up to the heart-beating logic. --- .../core/protocol/stomp/StompConnection.java | 11 ++---- docs/user-manual/en/connection-ttl.md | 4 +++ .../en/protocols-interoperability.md | 35 +++++++------------ 3 files changed, 19 insertions(+), 31 deletions(-) diff --git a/artemis-protocols/artemis-stomp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/stomp/StompConnection.java b/artemis-protocols/artemis-stomp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/stomp/StompConnection.java index 61d565aa8cd..186cb2ccf02 100644 --- a/artemis-protocols/artemis-stomp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/stomp/StompConnection.java +++ b/artemis-protocols/artemis-stomp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/stomp/StompConnection.java @@ -77,8 +77,6 @@ public final class StompConnection implements RemotingConnection { private final Object failLock = new Object(); - private boolean dataReceived; - private final boolean enableMessageID; private StompVersions version; @@ -208,15 +206,12 @@ public void setFailureListeners(final List listeners) { } protected synchronized void setDataReceived() { - dataReceived = true; + // ignored because STOMP doesn't use connectionTtl } public synchronized boolean checkDataReceived() { - boolean res = dataReceived; - - dataReceived = false; - - return res; + // ignored because STOMP doesn't use connectionTtl + return true; } public void checkDestination(String destination) throws ActiveMQStompException { diff --git a/docs/user-manual/en/connection-ttl.md b/docs/user-manual/en/connection-ttl.md index 545e816cff3..60322177cb5 100644 --- a/docs/user-manual/en/connection-ttl.md +++ b/docs/user-manual/en/connection-ttl.md @@ -4,6 +4,10 @@ In this section we will discuss connection time-to-live (TTL) and explain how Apache ActiveMQ Artemis deals with crashed clients and clients which have exited without cleanly closing their resources. +NOTE: The settings described in this section don't apply to STOMP +connections. STOMP uses heartbeats instead to detect dead +connections. + ## Cleaning up Dead Connection Resources on the Server Before an Apache ActiveMQ Artemis client application exits it is considered good diff --git a/docs/user-manual/en/protocols-interoperability.md b/docs/user-manual/en/protocols-interoperability.md index 26e3b4db4a1..b2648694c24 100644 --- a/docs/user-manual/en/protocols-interoperability.md +++ b/docs/user-manual/en/protocols-interoperability.md @@ -263,38 +263,27 @@ specified destination is mapped to an address. When a Stomp client subscribes (or unsubscribes) for a destination (using a `SUBSCRIBE` or `UNSUBSCRIBE` frame), the destination is mapped to an Apache ActiveMQ Artemis queue. -### STOMP and connection-ttl +### STOMP and heartbeats Well behaved STOMP clients will always send a DISCONNECT frame before closing their connections. In this case the server will clear up any server side resources such as sessions and consumers synchronously. -However if STOMP clients exit without sending a DISCONNECT frame or if -they crash the server will have no way of knowing immediately whether -the client is still alive or not. STOMP connections therefore default to -a connection-ttl value of 1 minute (see chapter on -[connection-ttl](#connection-ttl) for more information. This value can -be overridden using connection-ttl-override. -If you need a specific connectionTtl for your stomp connections without -affecting the connectionTtlOverride setting, you can configure your -stomp acceptor with the "connectionTtl" property, which is used to set -the ttl for connections that are created from that acceptor. For -example: +However, if STOMP clients exit without sending a DISCONNECT frame or +if they crash, the server will have no way of knowing immediately +whether the client is still alive or not. STOMP connections therefore +will be terminated when client heartbeats aren't received in time. +More precisely, they will be terminated when no data has been received +after twice the negotiated heartbeat interval. - tcp://localhost:61613?protocols=STOMP;connectionTtl=20000 - -The above configuration will make sure that any stomp connection that is -created from that acceptor will have its connection-ttl set to 20 -seconds. +Note that [`connection-ttl`](#connection-ttl) and +`connection-ttl-override` are ignored for STOMP connections. > **Note** > -> Please note that the STOMP protocol version 1.0 does not contain any -> heartbeat frame. It is therefore the user's responsibility to make -> sure data is sent within connection-ttl or the server will assume the -> client is dead and clean up server side resources. With `Stomp 1.1` -> users can use heart-beats to maintain the life cycle of stomp -> connections. +> Please note that STOMP protocol version 1.0 doesn't support +> heartbeats and therefore dead connections won't detected with this +> protocol version. ### Stomp and JMS interoperability