Skip to content

Commit cd24609

Browse files
Align MigrateFromNamedSingleTopic obsolete version range (#1209)
* Align MigrateFromNamedSingleTopic obsolete version range with the other obsoletes since that is an oversight from a bumping PR. Introduces also constants for the version range with comments to better indicate the intent. * Use constants in MigrationTopology class also --------- Co-authored-by: Daniel Marbach <[email protected]> Co-authored-by: Brandon Ording <[email protected]>
1 parent 209a7b1 commit cd24609

File tree

5 files changed

+18
-7
lines changed

5 files changed

+18
-7
lines changed

src/Tests/ApprovalFiles/APIApprovals.Approve.approved.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ namespace NServiceBus
121121
public static NServiceBus.Transport.AzureServiceBus.MigrationTopology MigrateFromNamedSingleTopic(string topicName) { }
122122
[System.Obsolete(@"The migration topology is intended to be used during a transitional period, facilitating the migration from the single-topic topology to the topic-per-event topology. The migration topology will eventually be phased out over subsequent releases. Should you face challenges during migration, please reach out to |https://github.com/Particular/NServiceBus.Transport.AzureServiceBus/issues/1170|. Will be treated as an error from version 7.0.0. Will be removed in version 8.0.0.", false)]
123123
public static NServiceBus.Transport.AzureServiceBus.MigrationTopology MigrateFromSingleDefaultTopic() { }
124-
[System.Obsolete(@"The migration topology is intended to be used during a transitional period, facilitating the migration from the single-topic topology to the topic-per-event topology. The migration topology will eventually be phased out over subsequent releases. Should you face challenges during migration, please reach out to |https://github.com/Particular/NServiceBus.Transport.AzureServiceBus/issues/1170|. Will be treated as an error from version 6.0.0. Will be removed in version 7.0.0.", false)]
124+
[System.Obsolete(@"The migration topology is intended to be used during a transitional period, facilitating the migration from the single-topic topology to the topic-per-event topology. The migration topology will eventually be phased out over subsequent releases. Should you face challenges during migration, please reach out to |https://github.com/Particular/NServiceBus.Transport.AzureServiceBus/issues/1170|. Will be treated as an error from version 7.0.0. Will be removed in version 8.0.0.", false)]
125125
public static NServiceBus.Transport.AzureServiceBus.MigrationTopology MigrateFromTopicHierarchy(string topicToPublishTo, string topicToSubscribeOn) { }
126126
[System.Obsolete("Use `TopicTopology.MigrateFromNamedSingleTopic(string topicName)` instead. The me" +
127127
"mber currently throws a NotImplementedException. Will be removed in version 6.0." +

src/Transport/EventRouting/MigrationTopology.cs

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ namespace NServiceBus.Transport.AzureServiceBus;
66
/// <summary>
77
/// Topology that allows mixing of single-topic and topic-per-event approaches in order to allow gradual migration to the topic-per-event topology.
88
/// </summary>
9-
[ObsoleteEx(Message = ObsoleteMessage, TreatAsErrorFromVersion = "7", RemoveInVersion = "8")]
9+
[ObsoleteEx(Message = ObsoleteMessage, TreatAsErrorFromVersion = TreatAsErrorFromVersion, RemoveInVersion = RemoveInVersion)]
1010
public sealed class MigrationTopology : TopicTopology
1111
{
1212
internal MigrationTopology(MigrationTopologyOptions options) : base(options,
@@ -187,6 +187,17 @@ protected override string GetPublishDestinationCore(string eventTypeFullName)
187187

188188
internal override SubscriptionManager CreateSubscriptionManager(SubscriptionManagerCreationOptions creationOptions) => new MigrationTopologySubscriptionManager(creationOptions, Options);
189189

190+
/*
191+
* The idea behind obsoleting the migration topology is to make it clear in the user's code base that eventually the migration topology will be removed.
192+
* The intent was to give users at least two major versions that are aligned with .NET LTS versions time, which should be roughly 2 years to migrate away
193+
* from the migration topology to the new topic-per-event topology. Should an out-of-band major release be required, consider bumping the `TreatAsErrorFromVersion`
194+
* and `RemoveInVersion` values to make sure more or least two years have passed after the release v5.0.0 of the transport. It might also be worthwhile
195+
* checking the linked issue in the obsolete message to see if there are any signals that warrant moving this even further.
196+
*/
197+
internal const string TreatAsErrorFromVersion = "7";
198+
199+
internal const string RemoveInVersion = "8";
200+
190201
internal const string ObsoleteMessage =
191202
"The migration topology is intended to be used during a transitional period, facilitating the migration from the single-topic topology to the topic-per-event topology. The migration topology will eventually be phased out over subsequent releases. Should you face challenges during migration, please reach out to |https://github.com/Particular/NServiceBus.Transport.AzureServiceBus/issues/1170|.";
192203

src/Transport/EventRouting/MigrationTopologyOptions.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ namespace NServiceBus.Transport.AzureServiceBus;
66
/// <summary>
77
/// Serializable object that defines the migration topology
88
/// </summary>
9-
[ObsoleteEx(Message = MigrationTopology.ObsoleteMessage, TreatAsErrorFromVersion = "7", RemoveInVersion = "8")]
9+
[ObsoleteEx(Message = MigrationTopology.ObsoleteMessage, TreatAsErrorFromVersion = MigrationTopology.TreatAsErrorFromVersion, RemoveInVersion = MigrationTopology.RemoveInVersion)]
1010
public sealed class MigrationTopologyOptions : TopologyOptions
1111
{
1212
/// <summary>

src/Transport/EventRouting/MigrationTopologyOptionsValidator.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,6 @@ namespace NServiceBus.Transport.AzureServiceBus;
55
/// <summary>
66
/// Validates the <see cref="MigrationTopologyOptions"/>.
77
/// </summary>
8-
[ObsoleteEx(Message = MigrationTopology.ObsoleteMessage, TreatAsErrorFromVersion = "7", RemoveInVersion = "8")]
8+
[ObsoleteEx(Message = MigrationTopology.ObsoleteMessage, TreatAsErrorFromVersion = MigrationTopology.TreatAsErrorFromVersion, RemoveInVersion = MigrationTopology.RemoveInVersion)]
99
[OptionsValidator]
1010
public partial class MigrationTopologyOptionsValidator : IValidateOptions<MigrationTopologyOptions>;

src/Transport/EventRouting/TopicTopology.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,14 +46,14 @@ public static TopicTopology FromOptions(TopologyOptions options) =>
4646
/// <summary>
4747
/// Returns a migration topology using a single topic named <c>bundle-1</c> for <see cref="MigrationTopology.TopicToPublishTo"/> and <see cref="MigrationTopology.TopicToSubscribeOn"/>
4848
/// </summary>
49-
[ObsoleteEx(Message = MigrationTopology.ObsoleteMessage, TreatAsErrorFromVersion = "7", RemoveInVersion = "8")]
49+
[ObsoleteEx(Message = MigrationTopology.ObsoleteMessage, TreatAsErrorFromVersion = MigrationTopology.TreatAsErrorFromVersion, RemoveInVersion = MigrationTopology.RemoveInVersion)]
5050
public static MigrationTopology MigrateFromSingleDefaultTopic() => MigrateFromNamedSingleTopic("bundle-1");
5151

5252
/// <summary>
5353
/// Returns a migration topology using a single topic with the <paramref name="topicName"/> for <see cref="MigrationTopology.TopicToPublishTo"/> and <see cref="MigrationTopology.TopicToSubscribeOn"/>
5454
/// </summary>
5555
/// <param name="topicName">The topic name.</param>
56-
[ObsoleteEx(Message = MigrationTopology.ObsoleteMessage, TreatAsErrorFromVersion = "7", RemoveInVersion = "8")]
56+
[ObsoleteEx(Message = MigrationTopology.ObsoleteMessage, TreatAsErrorFromVersion = MigrationTopology.TreatAsErrorFromVersion, RemoveInVersion = MigrationTopology.RemoveInVersion)]
5757
public static MigrationTopology MigrateFromNamedSingleTopic(string topicName) => new(new MigrationTopologyOptions
5858
{
5959
TopicToPublishTo = topicName,
@@ -67,7 +67,7 @@ public static TopicTopology FromOptions(TopologyOptions options) =>
6767
/// <param name="topicToSubscribeOn">The topic name to subscribe to.</param>
6868
/// <returns></returns>
6969
/// <exception cref="ArgumentException">Thrown when <paramref name="topicToPublishTo"/> is equal to <paramref name="topicToSubscribeOn"/>.</exception>
70-
[ObsoleteEx(Message = MigrationTopology.ObsoleteMessage, TreatAsErrorFromVersion = "6", RemoveInVersion = "7")]
70+
[ObsoleteEx(Message = MigrationTopology.ObsoleteMessage, TreatAsErrorFromVersion = MigrationTopology.TreatAsErrorFromVersion, RemoveInVersion = MigrationTopology.RemoveInVersion)]
7171
public static MigrationTopology MigrateFromTopicHierarchy(string topicToPublishTo, string topicToSubscribeOn)
7272
{
7373
var hierarchy = new MigrationTopology(new MigrationTopologyOptions

0 commit comments

Comments
 (0)