16
16
namespace RabbitMQ . AMQP . Client . Impl
17
17
{
18
18
/// <summary>
19
- /// AmqpConnection is the concrete implementation of <see cref="IConnection"/>
20
- /// It is a wrapper around the Microsoft AMQP.Net Lite <see cref="Connection"/> class
19
+ /// <see cref=" AmqpConnection"/> is the concrete implementation of <see cref="IConnection"/>.
20
+ /// It is a wrapper around the Microsoft AMQP.Net Lite <see cref="Amqp. Connection"/> class.
21
21
/// </summary>
22
22
public class AmqpConnection : AbstractLifeCycle , IConnection
23
23
{
@@ -62,45 +62,21 @@ public class AmqpConnection : AbstractLifeCycle, IConnection
62
62
// TODO this is coupled with publishers and consumers
63
63
internal readonly AmqpSessionManagement _nativePubSubSessions ;
64
64
65
- public IRpcServerBuilder RpcServerBuilder ( )
66
- {
67
- return new AmqpRpcServerBuilder ( this ) ;
68
- }
69
-
70
- public IRpcClientBuilder RpcClientBuilder ( )
71
- {
72
- return new AmqpRpcClientBuilder ( this ) ;
73
- }
74
-
75
- /// <summary>
76
- /// Read-only collection of publishers.
77
- /// See <see cref="IPublisher"/>
78
- /// </summary>
79
- /// <returns> All the active Publishers </returns>
80
- public IEnumerable < IPublisher > Publishers
81
- => _publishersDict . Values . ToArray ( ) ;
82
-
83
- /// <summary>
84
- /// Read-only collection of consumers.
85
- /// See <see cref="IConsumer"/>
86
- /// </summary>
87
- /// <returns> All the active Consumers </returns>
88
- public IEnumerable < IConsumer > Consumers
89
- => _consumersDict . Values . ToArray ( ) ;
90
-
91
65
/// <summary>
92
- /// Read-only dictionary of connection properties.
93
- /// </summary>
94
- /// <returns><see cref="IReadOnlyDictionary{TKey, TValue}"/> of connection properties</returns>
95
- public IReadOnlyDictionary < string , object > Properties => _connectionProperties ;
96
-
97
- public long Id { get ; set ; }
98
-
99
- /// <summary>
100
- /// Creates a new instance of <see cref="AmqpConnection"/>
101
- /// Through the Connection is possible to create:
102
- /// - Management. See <see cref="AmqpManagement"/>
103
- /// - Publishers and Consumers: See <see cref="AmqpPublisherBuilder"/> and <see cref="AmqpConsumerBuilder"/>
66
+ /// <para>
67
+ /// Creates a new instance of <see cref="AmqpConnection"/>
68
+ /// </para>
69
+ /// <para>
70
+ /// Through this <see cref="IConnection"/> instance it is possible to create:
71
+ /// <list type="bullet">
72
+ /// <item>
73
+ /// <see cref="IManagement"/>: See <see cref="AmqpManagement"/>.
74
+ /// </item>
75
+ /// <item>
76
+ /// <see cref="IPublisher"/> and <see cref="IConsumer"/>. See <see cref="AmqpPublisherBuilder"/> and <see cref="AmqpConsumerBuilder"/>.
77
+ /// </item>
78
+ /// </list>
79
+ /// </para>
104
80
/// </summary>
105
81
/// <param name="connectionSettings"></param>
106
82
/// <param name="metricsReporter"></param>
@@ -110,29 +86,84 @@ public IEnumerable<IConsumer> Consumers
110
86
public static async Task < IConnection > CreateAsync ( ConnectionSettings connectionSettings ,
111
87
IMetricsReporter ? metricsReporter = default )
112
88
{
113
- var connection = new AmqpConnection ( connectionSettings , metricsReporter ) ;
89
+ AmqpConnection connection = new ( connectionSettings , metricsReporter ) ;
114
90
await connection . OpenAsync ( )
115
91
. ConfigureAwait ( false ) ;
116
92
return connection ;
117
93
}
118
94
95
+ /// <summary>
96
+ /// The <see cref="IManagement"/> instance for this connection.
97
+ /// </summary>
98
+ /// <returns><see cref="IManagement"/> instance for this connection.</returns>
119
99
public IManagement Management ( )
120
100
{
121
101
return _management ;
122
102
}
123
103
104
+ /// <summary>
105
+ /// Create an <see cref="IPublisherBuilder"/> instance for this connection.
106
+ /// </summary>
107
+ /// <returns><see cref="IPublisherBuilder"/> instance for this connection.</returns>
108
+ public IPublisherBuilder PublisherBuilder ( )
109
+ {
110
+ ThrowIfClosed ( ) ;
111
+ var publisherBuilder = new AmqpPublisherBuilder ( this , _metricsReporter ) ;
112
+ return publisherBuilder ;
113
+ }
114
+
115
+ /// <summary>
116
+ /// Create an <see cref="IConsumerBuilder"/> instance for this connection.
117
+ /// </summary>
118
+ /// <returns><see cref="IConsumerBuilder"/> instance for this connection.</returns>
124
119
public IConsumerBuilder ConsumerBuilder ( )
125
120
{
126
121
return new AmqpConsumerBuilder ( this , _metricsReporter ) ;
127
122
}
128
123
129
- public IPublisherBuilder PublisherBuilder ( )
124
+ /// <summary>
125
+ /// Create an <see cref="IRpcServerBuilder"/> instance for this connection.
126
+ /// </summary>
127
+ /// <returns><see cref="IRpcServerBuilder"/> instance for this connection.</returns>
128
+ public IRpcServerBuilder RpcServerBuilder ( )
130
129
{
131
- ThrowIfClosed ( ) ;
132
- var publisherBuilder = new AmqpPublisherBuilder ( this , _metricsReporter ) ;
133
- return publisherBuilder ;
130
+ return new AmqpRpcServerBuilder ( this ) ;
131
+ }
132
+
133
+ /// <summary>
134
+ /// Create an <see cref="IRpcClientBuilder"/> instance for this connection.
135
+ /// </summary>
136
+ /// <returns><see cref="IRpcClientBuilder"/> instance for this connection.</returns>
137
+ public IRpcClientBuilder RpcClientBuilder ( )
138
+ {
139
+ return new AmqpRpcClientBuilder ( this ) ;
134
140
}
135
141
142
+ /// <summary>
143
+ /// Get the properties for this connection.
144
+ /// </summary>
145
+ /// <returns><see cref="IReadOnlyDictionary{TKey, TValue}"/> of connection properties.</returns>
146
+ public IReadOnlyDictionary < string , object > Properties => _connectionProperties ;
147
+
148
+ /// <summary>
149
+ /// Get the <see cref="IPublisher"/> instances associated with this connection.
150
+ /// </summary>
151
+ /// <returns><see cref="IEnumerable{T}"/> of <see cref="IPublisher"/> instances.</returns>
152
+ public IEnumerable < IPublisher > Publishers
153
+ => _publishersDict . Values . ToArray ( ) ;
154
+
155
+ /// <summary>
156
+ /// Get the <see cref="IConsumer"/> instances associated with this connection.
157
+ /// </summary>
158
+ /// <returns><see cref="IEnumerable{T}"/> of <see cref="IConsumer"/> instances.</returns>
159
+ public IEnumerable < IConsumer > Consumers
160
+ => _consumersDict . Values . ToArray ( ) ;
161
+
162
+ /// <summary>
163
+ /// Get or set the Connection ID. Used by <see cref="AmqpEnvironment"/>
164
+ /// </summary>
165
+ public long Id { get ; set ; }
166
+
136
167
// TODO cancellation token
137
168
public override async Task OpenAsync ( )
138
169
{
0 commit comments