Skip to content

Commit

Permalink
Merge pull request #89 from christian-thiele/master
Browse files Browse the repository at this point in the history
added connectionName in ConnectionSettings
  • Loading branch information
achilleasa committed Nov 25, 2022
2 parents 63827f4 + 46781da commit beddad2
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
1 change: 1 addition & 0 deletions API.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
4 changes: 4 additions & 0 deletions lib/src/client/connection_settings.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -42,5 +45,6 @@ class ConnectionSettings {
TuningSettings? tuningSettings,
this.tlsContext,
this.onBadCertificate,
this.connectionName,
}) : tuningSettings = tuningSettings ?? TuningSettings();
}
4 changes: 3 additions & 1 deletion lib/src/client/impl/channel_impl.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit beddad2

Please sign in to comment.