Skip to content

Commit 8f366af

Browse files
benspethbspeth-afk
andauthored
Enable backward compatibility by enabling empty isolation key (#91) (#93)
Co-authored-by: Benjamin SPETH <bspeth@ecovadis.com>
1 parent 12c744e commit 8f366af

3 files changed

Lines changed: 3 additions & 3 deletions

File tree

src/Ev.ServiceBus.Abstractions/Configuration/ServiceBusSettings.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ public sealed class ServiceBusSettings
2828
/// </summary>
2929
public bool UseIsolation { get; set; } = false;
3030
/// <summary>
31-
/// Key that is used to deremine if this running instance should receive and complete or abandon a message
31+
/// Key that is used to determine if this running instance should receive and complete or abandon a message
3232
/// </summary>
3333
public string? IsolationKey { get; set; } = null;
3434

src/Ev.ServiceBus/Reception/MessageReceptionHandler.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ public async Task HandleMessageAsync(MessageContext context)
5050
if (_serviceBusOptions.Settings.UseIsolation)
5151
{
5252
var expectedIsolationKey = _serviceBusOptions.Settings.IsolationKey;
53-
var receivedIsolationKey = context.IsolationKey;
53+
var receivedIsolationKey = context.IsolationKey ?? string.Empty;
5454
if (receivedIsolationKey != expectedIsolationKey)
5555
{
5656
_logger.IgnoreMessage(expectedIsolationKey, receivedIsolationKey);

src/Ev.ServiceBus/ServiceBusEngine.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ public async Task StartAll()
5151
_serviceBusEngineLogger.FailedToConnectToServiceBus(ex);
5252
}
5353
}
54-
if (settings.UseIsolation && string.IsNullOrEmpty(settings.IsolationKey))
54+
if (settings.UseIsolation && settings.IsolationKey == null)
5555
{
5656
throw new Exception("Isolation key must be set when isolation is enabled");
5757
}

0 commit comments

Comments
 (0)