From 5aca75e52792ee56ca01623c6bb38760c5362c28 Mon Sep 17 00:00:00 2001 From: Arnaud Simon Date: Mon, 5 May 2008 11:14:55 +0000 Subject: QPID-1005: Added a property for ignoring setClientID so we are compatible with legacy applications that don't rely on the ID being set on the connection URL. git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk@653426 13f79535-47bb-0310-9956-ffa450edef68 --- .../src/main/java/org/apache/qpid/client/AMQConnection.java | 9 ++++++++- .../org/apache/qpid/client/configuration/ClientProperties.java | 8 ++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) (limited to 'qpid/java/client/src') diff --git a/qpid/java/client/src/main/java/org/apache/qpid/client/AMQConnection.java b/qpid/java/client/src/main/java/org/apache/qpid/client/AMQConnection.java index aa402a436e..319c6c2b1a 100644 --- a/qpid/java/client/src/main/java/org/apache/qpid/client/AMQConnection.java +++ b/qpid/java/client/src/main/java/org/apache/qpid/client/AMQConnection.java @@ -822,7 +822,14 @@ public class AMQConnection extends Closeable implements Connection, QueueConnect // in AMQP it is not possible to change the client ID. If one is not specified // upon connection construction, an id is generated automatically. Therefore // we can always throw an exception. - throw new IllegalStateException("Client name cannot be changed after being set"); + if (!Boolean.getBoolean(ClientProperties.IGNORE_SET_CLIENTID_PROP_NAME)) + { + throw new IllegalStateException("Client name cannot be changed after being set"); + } + else + { + _logger.info("Operation setClientID is ignored using ID: " + getClientID()); + } } public ConnectionMetaData getMetaData() throws JMSException diff --git a/qpid/java/client/src/main/java/org/apache/qpid/client/configuration/ClientProperties.java b/qpid/java/client/src/main/java/org/apache/qpid/client/configuration/ClientProperties.java index c7fc21a121..edda18c715 100644 --- a/qpid/java/client/src/main/java/org/apache/qpid/client/configuration/ClientProperties.java +++ b/qpid/java/client/src/main/java/org/apache/qpid/client/configuration/ClientProperties.java @@ -24,6 +24,14 @@ package org.apache.qpid.client.configuration; public class ClientProperties { + /** + * Currently with Qpid it is not possible to change the client ID. + * If one is not specified upon connection construction, an id is generated automatically. + * Therefore an exception is always thrown unless this property is set to true. + * type: boolean + */ + public static final String IGNORE_SET_CLIENTID_PROP_NAME = "ignore_setclientID"; + /** * This property is currently used within the 0.10 code path only * The maximum number of pre-fetched messages per destination -- cgit v1.2.1