Skip to content

Commit

Permalink
Add stroage to event hub on idops server
Browse files Browse the repository at this point in the history
  • Loading branch information
PascalSenn committed Jun 3, 2024
1 parent bcaaf71 commit 2dcf002
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,15 @@ public class EventHubOptions
public string? ConnectionString { get; set; }

public string? Namespace { get; set; }

public EventStorageHubOptions? Storage { get; set; }
}

public sealed class EventStorageHubOptions
{
public string? ConnectionString { get; set; }

public string? Url { get; set; }
}

public enum MessagingTransport
Expand Down
17 changes: 17 additions & 0 deletions src/Server/src/Core/Configuration/IdOpsServerBuilderExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,23 @@ private static void UseEventHub(
}

k.ReceiveEndpoint("identity-events", e => e.ConfigureConsumers(contex));

if (options.Storage is { } storageOption)
{
if (storageOption.Url is { } url)
{
k.Storage(new Uri(url), new DefaultAzureCredential());
}
else if (storageOption.ConnectionString is { } connectionString)
{
k.Storage(connectionString);
}
else
{
throw new ApplicationException(
"EventHub storage configuration is missing. Please check your settings.");
}
}
});
});
}
Expand Down

0 comments on commit 2dcf002

Please sign in to comment.