How to register a UsePublishFilter while using Bus.Factory.CreateUsingRabbitMq on a .net 4.7.2 project

Viewed 136

I am trying to add a custom filter to the publish-action on the publishing side. However, to register a custom filter, I need to pass an instance of IConfigurationServiceProvider.

When using asp.net core, this would not be a problem as there are many examples around. That is unfortionately not the case for an application using the "full" .net 4.7.2

Here is some samplecode to further illustrate what I am trying to do:

var busControl = Bus.Factory.CreateUsingRabbitMq(config =>
{

    config.Host(RabbitMqHostUrl, h =>
    {
        h.Username(RabbitMqUsername);
        h.Password(RabbitMqPassword);
    });

    config.UsePublishFilter(typeof(MyCustomFilter<>), Instance_of_IConfigurationServiceProvider);
});
1 Answers

Scoped Filters only work with Microsoft.Extensions.DependencyInjection or Autofac, and require the use of the currently supported container-based configuration syntax.

Related