feat(masstransit): add service bus configuration hook (#6658)
This commit is contained in:
parent
50ed45d51d
commit
065626dda3
|
|
@ -26,6 +26,7 @@ namespace Elsa.MassTransit.Features;
|
|||
public class MassTransitFeature : FeatureBase
|
||||
{
|
||||
private bool _runInMemory;
|
||||
private Action<IBusRegistrationConfigurator> _configureServiceBus = _ => { };
|
||||
|
||||
/// <inheritdoc />
|
||||
public MassTransitFeature(IModule module) : base(module)
|
||||
|
|
@ -41,10 +42,19 @@ public class MassTransitFeature : FeatureBase
|
|||
public bool DisableConsumers { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// A delegate that can be set to configure MassTransit's <see cref="IBusRegistrationConfigurator"/>. Used by transport-level features such as AzureServiceBusFeature and RabbitMqServiceBusFeature.
|
||||
/// A delegate that can be set to configure MassTransit's <see cref="IBusRegistrationConfigurator"/>. Used by transport-level features such as AzureServiceBusFeature and RabbitMqServiceBusFeature.
|
||||
/// </summary>
|
||||
public Action<IBusRegistrationConfigurator>? BusConfigurator { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Allows configuring the service bus after the transport has been configured.
|
||||
/// </summary>
|
||||
public MassTransitFeature ConfigureServiceBus(Action<IBusRegistrationConfigurator> configure)
|
||||
{
|
||||
_configureServiceBus += configure;
|
||||
return this;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// A factory that creates a <see cref="IEndpointChannelFormatter"/>.
|
||||
/// </summary>
|
||||
|
|
@ -111,6 +121,7 @@ public class MassTransitFeature : FeatureBase
|
|||
bus.AddConsumer(definition.ConsumerType, definition.ConsumerDefinitionType);
|
||||
|
||||
busConfigurator(bus);
|
||||
_configureServiceBus(bus);
|
||||
});
|
||||
|
||||
Services.AddOptions<MassTransitHostOptions>().Configure(options =>
|
||||
|
|
|
|||
Loading…
Reference in a new issue