Skip to content

Commit

Permalink
Merge pull request #248 from Particular/obsolete-timeouts-persistence
Browse files Browse the repository at this point in the history
Obsolete timeouts persistence
  • Loading branch information
SeanFeldman authored Feb 25, 2020
2 parents 808dcfb + 6420c36 commit 804f46a
Show file tree
Hide file tree
Showing 6 changed files with 48 additions and 3 deletions.
2 changes: 2 additions & 0 deletions src/AcceptanceTests/ConfigureAzureStoragePersistence.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@ public Task Configure(string endpointName, EndpointConfiguration configuration,
{
configuration.UsePersistence<AzureStoragePersistence, StorageType.Subscriptions>().ConnectionString(ConnectionString);
configuration.UsePersistence<AzureStoragePersistence, StorageType.Sagas>().ConnectionString(ConnectionString);
#pragma warning disable 0618
configuration.UsePersistence<AzureStoragePersistence, StorageType.Timeouts>().ConnectionString(ConnectionString);
#pragma warning restore 0618

var recoverabilitySettings = configuration.Recoverability();

Expand Down
2 changes: 1 addition & 1 deletion src/NServiceBus.Persistence.AzureStorage/FodyWeavers.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<Weavers>
<Weavers GenerateXsd="false">
<Obsolete />
</Weavers>
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ namespace NServiceBus
using Persistence.AzureStorage.Config;

/// <summary></summary>
[ObsoleteEx(Message = "Azure Storage Queues supports timeouts natively and does not require timeout persistence.",
TreatAsErrorFromVersion = "3",
RemoveInVersion = "4")]
public class AzureStorageTimeoutPersistence : Feature
{
internal AzureStorageTimeoutPersistence()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,16 @@
/// </summary>
public static class ConfigureAzureTimeoutStorage
{
const string ObsoleteMessage = "Azure Storage Queues transport supports timeouts natively and does not require timeout persistence. Refer to the delayed delivery API.";
const string ReplacementTypeOrMember = "EndpointConfiguration.UseTransport<AzureStorageQueueTransport>().DelayedDelivery()";

/// <summary>
/// Connection string to use for timeouts storage.
/// </summary>
[ObsoleteEx(Message = ObsoleteMessage,
ReplacementTypeOrMember = ReplacementTypeOrMember,
TreatAsErrorFromVersion = "3",
RemoveInVersion = "4")]
public static PersistenceExtensions<AzureStoragePersistence, StorageType.Timeouts> ConnectionString(this PersistenceExtensions<AzureStoragePersistence, StorageType.Timeouts> config, string connectionString)
{
AzureTimeoutStorageGuard.CheckConnectionString(connectionString);
Expand All @@ -21,6 +28,10 @@ public static class ConfigureAzureTimeoutStorage
}

/// <summary></summary>
[ObsoleteEx(Message = ObsoleteMessage,
ReplacementTypeOrMember = ReplacementTypeOrMember,
TreatAsErrorFromVersion = "3",
RemoveInVersion = "4")]
public static PersistenceExtensions<AzureStoragePersistence, StorageType.Timeouts> TimeoutStateContainerName(this PersistenceExtensions<AzureStoragePersistence, StorageType.Timeouts> config, string blobName)
{
config.GetSettings().Set(TimeoutStorageTimeoutStateContainerName, blobName);
Expand All @@ -31,6 +42,10 @@ public static class ConfigureAzureTimeoutStorage
/// Should an attempt at startup be made to verify if storage tables for timeouts exist or not and if not create those.
/// <remarks>Operation will fail if connection string does not allow access to create storage tables</remarks>
/// </summary>
[ObsoleteEx(Message = ObsoleteMessage,
ReplacementTypeOrMember = ReplacementTypeOrMember,
TreatAsErrorFromVersion = "3",
RemoveInVersion = "4")]
public static PersistenceExtensions<AzureStoragePersistence, StorageType.Timeouts> CreateSchema(this PersistenceExtensions<AzureStoragePersistence, StorageType.Timeouts> config, bool createSchema)
{
config.GetSettings().Set(TimeoutStorageCreateSchema, createSchema);
Expand All @@ -40,6 +55,10 @@ public static class ConfigureAzureTimeoutStorage
/// <summary>
/// Set the name of the table where the timeout manager stores it's internal state.
/// </summary>
[ObsoleteEx(Message = ObsoleteMessage,
ReplacementTypeOrMember = ReplacementTypeOrMember,
TreatAsErrorFromVersion = "3",
RemoveInVersion = "4")]
public static PersistenceExtensions<AzureStoragePersistence, StorageType.Timeouts> TimeoutManagerDataTableName(this PersistenceExtensions<AzureStoragePersistence, StorageType.Timeouts> config, string tableName)
{
AzureTimeoutStorageGuard.CheckTableName(tableName);
Expand All @@ -51,6 +70,10 @@ public static class ConfigureAzureTimeoutStorage
/// <summary>
/// Set the name of the table where the timeouts themselves are stored.
/// </summary>
[ObsoleteEx(Message = ObsoleteMessage,
ReplacementTypeOrMember = ReplacementTypeOrMember,
TreatAsErrorFromVersion = "3",
RemoveInVersion = "4")]
public static PersistenceExtensions<AzureStoragePersistence, StorageType.Timeouts> TimeoutDataTableName(this PersistenceExtensions<AzureStoragePersistence, StorageType.Timeouts> config, string tableName)
{
AzureTimeoutStorageGuard.CheckTableName(tableName);
Expand All @@ -64,6 +87,10 @@ public static class ConfigureAzureTimeoutStorage
/// </summary>
/// <param name="catchUpInterval">Catch up interval in seconds</param>
/// <param name="config"></param>
[ObsoleteEx(Message = ObsoleteMessage,
ReplacementTypeOrMember = ReplacementTypeOrMember,
TreatAsErrorFromVersion = "3",
RemoveInVersion = "4")]
public static PersistenceExtensions<AzureStoragePersistence, StorageType.Timeouts> CatchUpInterval(this PersistenceExtensions<AzureStoragePersistence, StorageType.Timeouts> config, int catchUpInterval)
{
AzureTimeoutStorageGuard.CheckCatchUpInterval(catchUpInterval);
Expand All @@ -78,6 +105,10 @@ public static class ConfigureAzureTimeoutStorage
/// <param name="partitionKeyScope">Partition key DateTime format string.</param>
/// <param name="config"></param>
/// <remarks>For optimal performance, this should be in line with the CatchUpInterval.</remarks>
[ObsoleteEx(Message = ObsoleteMessage,
ReplacementTypeOrMember = ReplacementTypeOrMember,
TreatAsErrorFromVersion = "3",
RemoveInVersion = "4")]
public static PersistenceExtensions<AzureStoragePersistence, StorageType.Timeouts> PartitionKeyScope(this PersistenceExtensions<AzureStoragePersistence, StorageType.Timeouts> config, string partitionKeyScope)
{
AzureTimeoutStorageGuard.CheckPartitionKeyScope(partitionKeyScope);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ namespace NServiceBus
{
protected override void Setup(NServiceBus.Features.FeatureConfigurationContext context) { }
}
[System.ObsoleteAttribute("Azure Storage Queues supports timeouts natively and does not require timeout pers" +
"istence. Will be treated as an error from version 3.0.0. Will be removed in vers" +
"ion 4.0.0.", false)]
public class AzureStorageTimeoutPersistence : NServiceBus.Features.Feature
{
protected override void Setup(NServiceBus.Features.FeatureConfigurationContext context) { }
Expand All @@ -33,12 +36,19 @@ namespace NServiceBus
}
public class static ConfigureAzureTimeoutStorage
{
[System.ObsoleteAttribute(@"Azure Storage Queues transport supports timeouts natively and does not require timeout persistence. Refer to the delayed delivery API. Use `EndpointConfiguration.UseTransport<AzureStorageQueueTransport>().DelayedDelivery()` instead. Will be treated as an error from version 3.0.0. Will be removed in version 4.0.0.", false)]
public static NServiceBus.PersistenceExtensions<NServiceBus.AzureStoragePersistence, NServiceBus.StorageType.Timeouts> CatchUpInterval(this NServiceBus.PersistenceExtensions<NServiceBus.AzureStoragePersistence, NServiceBus.StorageType.Timeouts> config, int catchUpInterval) { }
[System.ObsoleteAttribute(@"Azure Storage Queues transport supports timeouts natively and does not require timeout persistence. Refer to the delayed delivery API. Use `EndpointConfiguration.UseTransport<AzureStorageQueueTransport>().DelayedDelivery()` instead. Will be treated as an error from version 3.0.0. Will be removed in version 4.0.0.", false)]
public static NServiceBus.PersistenceExtensions<NServiceBus.AzureStoragePersistence, NServiceBus.StorageType.Timeouts> ConnectionString(this NServiceBus.PersistenceExtensions<NServiceBus.AzureStoragePersistence, NServiceBus.StorageType.Timeouts> config, string connectionString) { }
[System.ObsoleteAttribute(@"Azure Storage Queues transport supports timeouts natively and does not require timeout persistence. Refer to the delayed delivery API. Use `EndpointConfiguration.UseTransport<AzureStorageQueueTransport>().DelayedDelivery()` instead. Will be treated as an error from version 3.0.0. Will be removed in version 4.0.0.", false)]
public static NServiceBus.PersistenceExtensions<NServiceBus.AzureStoragePersistence, NServiceBus.StorageType.Timeouts> CreateSchema(this NServiceBus.PersistenceExtensions<NServiceBus.AzureStoragePersistence, NServiceBus.StorageType.Timeouts> config, bool createSchema) { }
[System.ObsoleteAttribute(@"Azure Storage Queues transport supports timeouts natively and does not require timeout persistence. Refer to the delayed delivery API. Use `EndpointConfiguration.UseTransport<AzureStorageQueueTransport>().DelayedDelivery()` instead. Will be treated as an error from version 3.0.0. Will be removed in version 4.0.0.", false)]
public static NServiceBus.PersistenceExtensions<NServiceBus.AzureStoragePersistence, NServiceBus.StorageType.Timeouts> PartitionKeyScope(this NServiceBus.PersistenceExtensions<NServiceBus.AzureStoragePersistence, NServiceBus.StorageType.Timeouts> config, string partitionKeyScope) { }
[System.ObsoleteAttribute(@"Azure Storage Queues transport supports timeouts natively and does not require timeout persistence. Refer to the delayed delivery API. Use `EndpointConfiguration.UseTransport<AzureStorageQueueTransport>().DelayedDelivery()` instead. Will be treated as an error from version 3.0.0. Will be removed in version 4.0.0.", false)]
public static NServiceBus.PersistenceExtensions<NServiceBus.AzureStoragePersistence, NServiceBus.StorageType.Timeouts> TimeoutDataTableName(this NServiceBus.PersistenceExtensions<NServiceBus.AzureStoragePersistence, NServiceBus.StorageType.Timeouts> config, string tableName) { }
[System.ObsoleteAttribute(@"Azure Storage Queues transport supports timeouts natively and does not require timeout persistence. Refer to the delayed delivery API. Use `EndpointConfiguration.UseTransport<AzureStorageQueueTransport>().DelayedDelivery()` instead. Will be treated as an error from version 3.0.0. Will be removed in version 4.0.0.", false)]
public static NServiceBus.PersistenceExtensions<NServiceBus.AzureStoragePersistence, NServiceBus.StorageType.Timeouts> TimeoutManagerDataTableName(this NServiceBus.PersistenceExtensions<NServiceBus.AzureStoragePersistence, NServiceBus.StorageType.Timeouts> config, string tableName) { }
[System.ObsoleteAttribute(@"Azure Storage Queues transport supports timeouts natively and does not require timeout persistence. Refer to the delayed delivery API. Use `EndpointConfiguration.UseTransport<AzureStorageQueueTransport>().DelayedDelivery()` instead. Will be treated as an error from version 3.0.0. Will be removed in version 4.0.0.", false)]
public static NServiceBus.PersistenceExtensions<NServiceBus.AzureStoragePersistence, NServiceBus.StorageType.Timeouts> TimeoutStateContainerName(this NServiceBus.PersistenceExtensions<NServiceBus.AzureStoragePersistence, NServiceBus.StorageType.Timeouts> config, string blobName) { }
}
}
Expand Down
3 changes: 1 addition & 2 deletions src/Tests/Sagas/When_executing_concurrently.cs
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,7 @@ public async Task Should_enable_saving_another_saga_with_same_correlation_id_as_
async Task DeletePrimary(Guid sagaId)
{
var entities = await cloudTable.ExecuteQueryAsync(new TableQuery<TableEntity>()).ConfigureAwait(false);
Guid guid;
var primary = entities.Single(te => Guid.TryParse(te.PartitionKey, out guid) && guid == sagaId);
var primary = entities.Single(te => Guid.TryParse(te.PartitionKey, out var guid) && guid == sagaId);
await cloudTable.DeleteIgnoringNotFound(primary);
}

Expand Down

0 comments on commit 804f46a

Please sign in to comment.