1616namespace RabbitMQ . AMQP . Client . Impl
1717{
1818 /// <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.
2121 /// </summary>
2222 public class AmqpConnection : AbstractLifeCycle , IConnection
2323 {
@@ -62,45 +62,21 @@ public class AmqpConnection : AbstractLifeCycle, IConnection
6262 // TODO this is coupled with publishers and consumers
6363 internal readonly AmqpSessionManagement _nativePubSubSessions ;
6464
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-
9165 /// <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>
10480 /// </summary>
10581 /// <param name="connectionSettings"></param>
10682 /// <param name="metricsReporter"></param>
@@ -110,29 +86,84 @@ public IEnumerable<IConsumer> Consumers
11086 public static async Task < IConnection > CreateAsync ( ConnectionSettings connectionSettings ,
11187 IMetricsReporter ? metricsReporter = default )
11288 {
113- var connection = new AmqpConnection ( connectionSettings , metricsReporter ) ;
89+ AmqpConnection connection = new ( connectionSettings , metricsReporter ) ;
11490 await connection . OpenAsync ( )
11591 . ConfigureAwait ( false ) ;
11692 return connection ;
11793 }
11894
95+ /// <summary>
96+ /// The <see cref="IManagement"/> instance for this connection.
97+ /// </summary>
98+ /// <returns><see cref="IManagement"/> instance for this connection.</returns>
11999 public IManagement Management ( )
120100 {
121101 return _management ;
122102 }
123103
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>
124119 public IConsumerBuilder ConsumerBuilder ( )
125120 {
126121 return new AmqpConsumerBuilder ( this , _metricsReporter ) ;
127122 }
128123
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 ( )
130129 {
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 ) ;
134140 }
135141
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+
136167 // TODO cancellation token
137168 public override async Task OpenAsync ( )
138169 {
0 commit comments