@@ -150,28 +150,27 @@ public class ConnectionFactory : ConnectionFactoryBase, IConnectionFactory
150
150
/// <summary>
151
151
/// SASL auth mechanisms to use.
152
152
/// </summary>
153
- public IList < AuthMechanismFactory > AuthMechanisms = DefaultAuthMechanisms ;
153
+ public IList < AuthMechanismFactory > AuthMechanisms { get ; set ; } = DefaultAuthMechanisms ;
154
154
155
155
/// <summary>
156
156
/// Set to true to enable automatic connection recovery.
157
157
/// </summary>
158
- public bool AutomaticRecoveryEnabled ;
158
+ public bool AutomaticRecoveryEnabled { get ; set ; }
159
159
160
160
/// <summary>
161
161
/// Used to select next hostname to try when performing
162
162
/// connection recovery (re-connecting). Is not used for
163
163
/// non-recovering connections.
164
164
/// </summary>
165
- public IHostnameSelector HostnameSelector = new RandomHostnameSelector ( ) ;
165
+ public IHostnameSelector HostnameSelector { get ; set ; } = new RandomHostnameSelector ( ) ;
166
166
167
167
/// <summary>The host to connect to.</summary>
168
- public String HostName = "localhost" ;
168
+ public string HostName { get ; set ; } = "localhost" ;
169
169
170
170
/// <summary>
171
171
/// Amount of time client will wait for before re-trying to recover connection.
172
172
/// </summary>
173
- public TimeSpan NetworkRecoveryInterval = TimeSpan . FromSeconds ( 5 ) ;
174
-
173
+ public TimeSpan NetworkRecoveryInterval { get ; set ; } = TimeSpan . FromSeconds ( 5 ) ;
175
174
private TimeSpan m_handshakeContinuationTimeout = TimeSpan . FromSeconds ( 10 ) ;
176
175
private TimeSpan m_continuationTimeout = TimeSpan . FromSeconds ( 20 ) ;
177
176
@@ -199,58 +198,50 @@ public TimeSpan ContinuationTimeout
199
198
/// The port to connect on. <see cref="AmqpTcpEndpoint.UseDefaultPort"/>
200
199
/// indicates the default for the protocol should be used.
201
200
/// </summary>
202
- public int Port = AmqpTcpEndpoint . UseDefaultPort ;
201
+ public int Port { get ; set ; } = AmqpTcpEndpoint . UseDefaultPort ;
203
202
204
203
/// <summary>
205
204
/// Protocol used, only AMQP 0-9-1 is supported in modern versions.
206
205
/// </summary>
207
- public IProtocol Protocol = Protocols . DefaultProtocol ;
206
+ public IProtocol Protocol { get ; set ; } = Protocols . DefaultProtocol ;
208
207
209
208
/// <summary>
210
209
/// Timeout setting for connection attempts (in milliseconds).
211
210
/// </summary>
212
- public int RequestedConnectionTimeout = DefaultConnectionTimeout ;
211
+ public int RequestedConnectionTimeout { get ; set ; } = DefaultConnectionTimeout ;
213
212
214
213
/// <summary>
215
214
/// Timeout setting for socket read operations (in milliseconds).
216
215
/// </summary>
217
- public int SocketReadTimeout = DefaultConnectionTimeout ;
216
+ public int SocketReadTimeout { get ; set ; } = DefaultConnectionTimeout ;
218
217
219
218
/// <summary>
220
219
/// Timeout setting for socket write operations (in milliseconds).
221
220
/// </summary>
222
- public int SocketWriteTimeout = DefaultConnectionTimeout ;
221
+ public int SocketWriteTimeout { get ; set ; } = DefaultConnectionTimeout ;
223
222
224
223
/// <summary>
225
224
/// Ssl options setting.
226
225
/// </summary>
227
- public SslOption Ssl = new SslOption ( ) ;
226
+ public SslOption Ssl { get ; set ; } = new SslOption ( ) ;
228
227
229
228
/// <summary>
230
229
/// Set to true to make automatic connection recovery also recover topology (exchanges, queues, bindings, etc).
231
230
/// </summary>
232
- public bool TopologyRecoveryEnabled = true ;
231
+ public bool TopologyRecoveryEnabled { get ; set ; } = true ;
233
232
234
233
/// <summary>
235
234
/// Task scheduler connections created by this factory will use when
236
235
/// dispatching consumer operations, such as message deliveries.
237
236
/// </summary>
238
- public TaskScheduler TaskScheduler { get ; set ; }
237
+ public TaskScheduler TaskScheduler { get ; set ; } = TaskScheduler . Default ;
239
238
240
239
/// <summary>
241
240
/// Construct a fresh instance, with all fields set to their respective defaults.
242
241
/// </summary>
243
242
public ConnectionFactory ( )
244
243
{
245
- this . TaskScheduler = TaskScheduler . Default ;
246
- VirtualHost = DefaultVHost ;
247
- UserName = DefaultUser ;
248
- RequestedHeartbeat = DefaultHeartbeat ;
249
- RequestedFrameMax = DefaultFrameMax ;
250
- RequestedChannelMax = DefaultChannelMax ;
251
- Password = DefaultPass ;
252
244
ClientProperties = Connection . DefaultClientProperties ( ) ;
253
- UseBackgroundThreadsForIO = false ;
254
245
}
255
246
256
247
/// <summary>
@@ -291,22 +282,22 @@ public Uri uri
291
282
/// <summary>
292
283
/// Password to use when authenticating to the server.
293
284
/// </summary>
294
- public string Password { get ; set ; }
285
+ public string Password { get ; set ; } = DefaultPass ;
295
286
296
287
/// <summary>
297
288
/// Maximum channel number to ask for.
298
289
/// </summary>
299
- public ushort RequestedChannelMax { get ; set ; }
290
+ public ushort RequestedChannelMax { get ; set ; } = DefaultChannelMax ;
300
291
301
292
/// <summary>
302
293
/// Frame-max parameter to ask for (in bytes).
303
294
/// </summary>
304
- public uint RequestedFrameMax { get ; set ; }
295
+ public uint RequestedFrameMax { get ; set ; } = DefaultFrameMax ;
305
296
306
297
/// <summary>
307
298
/// Heartbeat timeout to use when negotiating with the server (in seconds).
308
299
/// </summary>
309
- public ushort RequestedHeartbeat { get ; set ; }
300
+ public ushort RequestedHeartbeat { get ; set ; } = DefaultHeartbeat ;
310
301
311
302
/// <summary>
312
303
/// When set to true, background thread will be used for the I/O loop.
@@ -316,12 +307,12 @@ public Uri uri
316
307
/// <summary>
317
308
/// Username to use when authenticating to the server.
318
309
/// </summary>
319
- public string UserName { get ; set ; }
310
+ public string UserName { get ; set ; } = DefaultUser ;
320
311
321
312
/// <summary>
322
313
/// Virtual host to access during this connection.
323
314
/// </summary>
324
- public string VirtualHost { get ; set ; }
315
+ public string VirtualHost { get ; set ; } = DefaultVHost ;
325
316
326
317
/// <summary>
327
318
/// Given a list of mechanism names supported by the server, select a preferred mechanism,
0 commit comments