Skip to content

Commit 48fb2fc

Browse files
authored
Refactor to have one class per file (#1574)
1 parent ead0dae commit 48fb2fc

File tree

3 files changed

+98
-93
lines changed

3 files changed

+98
-93
lines changed
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
namespace NServiceBus.Transport.PostgreSql
2+
{
3+
using System;
4+
using Particular.Obsoletes;
5+
6+
/// <summary>
7+
/// Configures native delayed delivery.
8+
/// </summary>
9+
[PreObsolete("https://github.com/Particular/NServiceBus/issues/6811",
10+
ReplacementTypeOrMember = "SqlServerTransport.DelayedDelivery",
11+
Note = "Should not be converted to an ObsoleteEx until API mismatch described in issue is resolved.")]
12+
public partial class DelayedDeliverySettings
13+
{
14+
readonly DelayedDeliveryOptions options;
15+
16+
internal DelayedDeliverySettings(DelayedDeliveryOptions options) => this.options = options;
17+
18+
/// <summary>
19+
/// Sets the suffix for the table storing delayed messages.
20+
/// </summary>
21+
/// <param name="suffix"></param>
22+
[PreObsolete("https://github.com/Particular/NServiceBus/issues/6811",
23+
ReplacementTypeOrMember = "SqlServerTransport.TableSuffix",
24+
Note = "Should not be converted to an ObsoleteEx until API mismatch described in issue is resolved.")]
25+
public void TableSuffix(string suffix)
26+
{
27+
ArgumentException.ThrowIfNullOrWhiteSpace(suffix);
28+
29+
options.TableSuffix = suffix;
30+
}
31+
32+
/// <summary>
33+
/// Sets the size of the batch when moving matured timeouts to the input queue.
34+
/// </summary>
35+
[PreObsolete("https://github.com/Particular/NServiceBus/issues/6811",
36+
ReplacementTypeOrMember = "SqlServerTransport.BatchSize",
37+
Note = "Should not be converted to an ObsoleteEx until API mismatch described in issue is resolved.")]
38+
public void BatchSize(int batchSize)
39+
{
40+
if (batchSize <= 0)
41+
{
42+
throw new ArgumentException("Batch size has to be a positive number", nameof(batchSize));
43+
}
44+
45+
options.BatchSize = batchSize;
46+
}
47+
}
48+
}

src/NServiceBus.Transport.PostgreSql/Configuration/PostgreSqlTransportSettingsExtensions.cs

Lines changed: 0 additions & 93 deletions
Original file line numberDiff line numberDiff line change
@@ -219,97 +219,4 @@ public static TransportExtensions<PostgreSqlTransport> CreateMessageBodyComputed
219219
return transportExtensions;
220220
}
221221
}
222-
}
223-
224-
namespace NServiceBus.Transport.PostgreSql
225-
{
226-
using System;
227-
using Particular.Obsoletes;
228-
229-
/// <summary>
230-
/// Configures native delayed delivery.
231-
/// </summary>
232-
[PreObsolete("https://github.com/Particular/NServiceBus/issues/6811",
233-
ReplacementTypeOrMember = "SqlServerTransport.DelayedDelivery",
234-
Note = "Should not be converted to an ObsoleteEx until API mismatch described in issue is resolved.")]
235-
public partial class DelayedDeliverySettings
236-
{
237-
readonly DelayedDeliveryOptions options;
238-
239-
internal DelayedDeliverySettings(DelayedDeliveryOptions options) => this.options = options;
240-
241-
/// <summary>
242-
/// Sets the suffix for the table storing delayed messages.
243-
/// </summary>
244-
/// <param name="suffix"></param>
245-
[PreObsolete("https://github.com/Particular/NServiceBus/issues/6811",
246-
ReplacementTypeOrMember = "SqlServerTransport.TableSuffix",
247-
Note = "Should not be converted to an ObsoleteEx until API mismatch described in issue is resolved.")]
248-
public void TableSuffix(string suffix)
249-
{
250-
ArgumentException.ThrowIfNullOrWhiteSpace(suffix);
251-
252-
options.TableSuffix = suffix;
253-
}
254-
255-
/// <summary>
256-
/// Sets the size of the batch when moving matured timeouts to the input queue.
257-
/// </summary>
258-
[PreObsolete("https://github.com/Particular/NServiceBus/issues/6811",
259-
ReplacementTypeOrMember = "SqlServerTransport.BatchSize",
260-
Note = "Should not be converted to an ObsoleteEx until API mismatch described in issue is resolved.")]
261-
public void BatchSize(int batchSize)
262-
{
263-
if (batchSize <= 0)
264-
{
265-
throw new ArgumentException("Batch size has to be a positive number", nameof(batchSize));
266-
}
267-
268-
options.BatchSize = batchSize;
269-
}
270-
}
271-
272-
/// <summary>
273-
/// Configures the native pub/sub behavior
274-
/// </summary>
275-
[PreObsolete("https://github.com/Particular/NServiceBus/issues/6811",
276-
ReplacementTypeOrMember = "SqlServerTransport.Subscriptions",
277-
Note = "Should not be converted to an ObsoleteEx until API mismatch described in issue is resolved.")]
278-
public class SubscriptionSettings
279-
{
280-
readonly SubscriptionOptions options;
281-
282-
internal SubscriptionSettings(SubscriptionOptions options) => this.options = options;
283-
284-
/// <summary>
285-
/// Overrides the default name for the subscription table. All endpoints in a given system need to agree on that name in order for them to be able
286-
/// to subscribe to and publish events.
287-
/// </summary>
288-
/// <param name="tableName">Name of the table.</param>
289-
/// <param name="schemaName">Schema in which the table is defined if different from default schema configured for the transport.</param>
290-
[PreObsolete("https://github.com/Particular/NServiceBus/issues/6811",
291-
ReplacementTypeOrMember = "SubscriptionOptions.SubscriptionTableName",
292-
Note = "Should not be converted to an ObsoleteEx until API mismatch described in issue is resolved.")]
293-
public void SubscriptionTableName(string tableName, string schemaName = null) => options.SubscriptionTableName = new SubscriptionTableName(tableName, schemaName);
294-
295-
/// <summary>
296-
/// Cache subscriptions for a given <see cref="TimeSpan"/>.
297-
/// </summary>
298-
[PreObsolete("https://github.com/Particular/NServiceBus/issues/6811",
299-
ReplacementTypeOrMember = "",
300-
Note = "Should not be converted to an ObsoleteEx until API mismatch described in issue is resolved.")]
301-
public void CacheSubscriptionInformationFor(TimeSpan timeSpan)
302-
{
303-
ArgumentOutOfRangeException.ThrowIfLessThanOrEqual(timeSpan, TimeSpan.Zero);
304-
options.CacheInvalidationPeriod = timeSpan;
305-
}
306-
307-
/// <summary>
308-
/// Do not cache subscriptions.
309-
/// </summary>
310-
[PreObsolete("https://github.com/Particular/NServiceBus/issues/6811",
311-
ReplacementTypeOrMember = "SubscriptionOptions.DisableSubscriptionCache",
312-
Note = "Should not be converted to an ObsoleteEx until API mismatch described in issue is resolved.")]
313-
public void DisableSubscriptionCache() => options.DisableCaching = true;
314-
}
315222
}
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
namespace NServiceBus.Transport.PostgreSql
2+
{
3+
using System;
4+
using Particular.Obsoletes;
5+
6+
/// <summary>
7+
/// Configures the native pub/sub behavior
8+
/// </summary>
9+
[PreObsolete("https://github.com/Particular/NServiceBus/issues/6811",
10+
ReplacementTypeOrMember = "SqlServerTransport.Subscriptions",
11+
Note = "Should not be converted to an ObsoleteEx until API mismatch described in issue is resolved.")]
12+
public class SubscriptionSettings
13+
{
14+
readonly SubscriptionOptions options;
15+
16+
internal SubscriptionSettings(SubscriptionOptions options) => this.options = options;
17+
18+
/// <summary>
19+
/// Overrides the default name for the subscription table. All endpoints in a given system need to agree on that name in order for them to be able
20+
/// to subscribe to and publish events.
21+
/// </summary>
22+
/// <param name="tableName">Name of the table.</param>
23+
/// <param name="schemaName">Schema in which the table is defined if different from default schema configured for the transport.</param>
24+
[PreObsolete("https://github.com/Particular/NServiceBus/issues/6811",
25+
ReplacementTypeOrMember = "SubscriptionOptions.SubscriptionTableName",
26+
Note = "Should not be converted to an ObsoleteEx until API mismatch described in issue is resolved.")]
27+
public void SubscriptionTableName(string tableName, string schemaName = null) => options.SubscriptionTableName = new SubscriptionTableName(tableName, schemaName);
28+
29+
/// <summary>
30+
/// Cache subscriptions for a given <see cref="TimeSpan"/>.
31+
/// </summary>
32+
[PreObsolete("https://github.com/Particular/NServiceBus/issues/6811",
33+
ReplacementTypeOrMember = "",
34+
Note = "Should not be converted to an ObsoleteEx until API mismatch described in issue is resolved.")]
35+
public void CacheSubscriptionInformationFor(TimeSpan timeSpan)
36+
{
37+
ArgumentOutOfRangeException.ThrowIfLessThanOrEqual(timeSpan, TimeSpan.Zero);
38+
options.CacheInvalidationPeriod = timeSpan;
39+
}
40+
41+
/// <summary>
42+
/// Do not cache subscriptions.
43+
/// </summary>
44+
[PreObsolete("https://github.com/Particular/NServiceBus/issues/6811",
45+
ReplacementTypeOrMember = "SubscriptionOptions.DisableSubscriptionCache",
46+
Note = "Should not be converted to an ObsoleteEx until API mismatch described in issue is resolved.")]
47+
public void DisableSubscriptionCache() => options.DisableCaching = true;
48+
}
49+
}
50+

0 commit comments

Comments
 (0)