© 2026 Hedgehog Software, LLC
services.AddMassTransit(config => { config.AddConsumers(typeof(MyNonBatchConsumer).Assembly); config.UsingAmazonSqs((context, cfg) => { cfg.UsePublishFilter(typeof(LoggingPublishFilter<>), provider); cfg.UseConsumeFilter(typeof(LoggingConsumeFilter<>), provider); cfg.ReceiveEndpoint($"{typeof(Startup).Namespace?.Replace(".", "_")}_{environment.EnvironmentName}", receiveEndpointConfig => { //tried registering the filter here as well, didn't work receiveEndpointConfig.ConfigureConsumer<MyNonBatchConsumer>(context); //Batch consumer receiveEndpointConfig.ConfigureConsumer<MyBatchConsumer>(context); }); })); }); services.AddScoped(typeof(LoggingPublishFilter<>)); services.AddScoped(typeof(LoggingConsumeFilter<>));
csharp public class MyBatchConsumerHandler : IIntegrationEventBatchHandler<MyBatchConsumer> { private readonly IMediator _mediator; public MyBatchConsumerHandler(IMediator mediator) { _mediator = mediator; } public async Task Consume(ConsumeContext<Batch<MyBatchConsumer>> context) { //removed for brevity } }
receiveEndpointConfig.ConfigureConsumer<MyBatchConsumer>(context);