From b68e4dbe4aaa5eef1d78fc2172be7c72642508e8 Mon Sep 17 00:00:00 2001 From: Christian Thiele Date: Tue, 21 Jun 2022 16:28:15 +0200 Subject: [PATCH 1/2] added connectionName in ConnectionSettings --- lib/src/client/connection_settings.dart | 4 ++++ lib/src/client/impl/channel_impl.dart | 4 +++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/src/client/connection_settings.dart b/lib/src/client/connection_settings.dart index b90cca6..45c6ee1 100644 --- a/lib/src/client/connection_settings.dart +++ b/lib/src/client/connection_settings.dart @@ -32,6 +32,9 @@ class ConnectionSettings { SecurityContext? tlsContext; bool Function(X509Certificate)? onBadCertificate; + // Connection identifier + String? connectionName; + ConnectionSettings({ this.host = "127.0.0.1", this.port = 5672, @@ -42,5 +45,6 @@ class ConnectionSettings { TuningSettings? tuningSettings, this.tlsContext, this.onBadCertificate, + this.connectionName, }) : tuningSettings = tuningSettings ?? TuningSettings(); } diff --git a/lib/src/client/impl/channel_impl.dart b/lib/src/client/impl/channel_impl.dart index 56d915c..ffa6429 100644 --- a/lib/src/client/impl/channel_impl.dart +++ b/lib/src/client/impl/channel_impl.dart @@ -130,7 +130,9 @@ class _ChannelImpl implements Channel { ..clientProperties = { "product": "Dart AMQP client", "version": "0.2.3", - "platform": "Dart/${Platform.operatingSystem}" + "platform": "Dart/${Platform.operatingSystem}", + if (_client.settings.connectionName != null) + "connection_name": _client.settings.connectionName!, } ..locale = 'en_US' ..mechanism = _client.settings.authProvider.saslType From 46781dadc7066aa8d769a394449fcf8a38a9c480 Mon Sep 17 00:00:00 2001 From: Christian Thiele Date: Fri, 25 Nov 2022 12:52:50 +0100 Subject: [PATCH 2/2] added "connectionName" connection parameter in docs --- API.md | 1 + 1 file changed, 1 insertion(+) diff --git a/API.md b/API.md index fab7bba..32d3da3 100644 --- a/API.md +++ b/API.md @@ -17,6 +17,7 @@ The class constructor support the following named parameters: | maxConnectionAttempts | The number of connection attempts till a connection error is reported. Defaults to 1. | reconnectWaitTime | A [Duration](https://api.dartlang.org/apidocs/channels/stable/dartdoc-viewer/dart:core.Duration) specifying the time between reconnection attempts. Defaults to 1500 ms. | tuningSettings | A [TuningSettings](https://github.com/achilleasa/dart_amqp/blob/master/lib/src/protocol/io/tuning_settings.dart) instance to use. If not specified, the [default](#tuning-settings) tuning settings will be used. +| connectionName | A client-provided connection name which can help to identify this connection in server logs. ### Authentication providers