Skip to content

Commit

Permalink
Merge v2 to v3
Browse files Browse the repository at this point in the history
Signed-off-by: Tomasz Maruszak <[email protected]>
  • Loading branch information
zarusz committed Nov 24, 2024
2 parents 4cbf73f + fd775b4 commit 18953af
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ protected override void Build()
InitTaskList.Add(ProvisionTopology, CancellationToken);
}

_client = ProviderSettings.ClientFactory();
_client = ProviderSettings.ClientFactory(Settings.ServiceProvider, ProviderSettings);

_producerByPath = new SafeDictionaryWrapper<string, ServiceBusSender>(path =>
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
public class ServiceBusMessageBusSettings : HasProviderExtensions
{
public string ConnectionString { get; set; }
public Func<ServiceBusClient> ClientFactory { get; set; }
public Func<ServiceBusAdministrationClient> AdminClientFactory { get; set; }
public Func<IServiceProvider, ServiceBusMessageBusSettings, ServiceBusClient> ClientFactory { get; set; }
public Func<IServiceProvider, ServiceBusMessageBusSettings, ServiceBusAdministrationClient> AdminClientFactory { get; set; }
public Func<string, ServiceBusClient, ServiceBusSender> SenderFactory { get; set; }
public Func<TopicSubscriptionParams, ServiceBusProcessorOptions> ProcessorOptionsFactory { get; set; }
public Func<TopicSubscriptionParams, ServiceBusProcessorOptions, ServiceBusClient, ServiceBusProcessor> ProcessorFactory { get; set; }
Expand Down Expand Up @@ -45,8 +45,8 @@ public class ServiceBusMessageBusSettings : HasProviderExtensions

public ServiceBusMessageBusSettings()
{
ClientFactory = () => new ServiceBusClient(ConnectionString);
AdminClientFactory = () => new ServiceBusAdministrationClient(ConnectionString);
ClientFactory = (_, settings) => new ServiceBusClient(settings.ConnectionString);
AdminClientFactory = (_, settings) => new ServiceBusAdministrationClient(settings.ConnectionString);

SenderFactory = (path, client) => client.CreateSender(path);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public ServiceBusTopologyService(ILogger<ServiceBusTopologyService> logger, Mess
_logger = logger;
_settings = settings;
_providerSettings = providerSettings;
_adminClient = providerSettings.AdminClientFactory();
_adminClient = providerSettings.AdminClientFactory(settings.ServiceProvider, providerSettings);
}

[Flags]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public ServiceBusMessageBusTests()

ProviderBusSettings = new ServiceBusMessageBusSettings("connection-string")
{
ClientFactory = () =>
ClientFactory = (_, _) =>
{
var client = new Mock<ServiceBusClient>();
return client.Object;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public ProvisionTopologyTests()

ProviderBusSettings = new ServiceBusMessageBusSettings("connection-string")
{
AdminClientFactory = () => _mockAdminClient.Object,
AdminClientFactory = (_, _) => _mockAdminClient.Object,
TopologyProvisioning = new ServiceBusTopologySettings
{
Enabled = false
Expand Down

0 comments on commit 18953af

Please sign in to comment.