Thanks. Marco
Hi, looking inside RabbitMq client libray, setting ConsumerDispatchConcurrency
>1 generate a Thread pool by itself, according with this documentation:
https://rabbitmq.github.io/rabbitmq-dotnet-client/api/RabbitMQ.Client.ConnectionFactory.html#RabbitMQ_Client_ConnectionFactory_ConsumerDispatchConcurrency
So seems using IAsyncBasicConsumer
the library made all.
internal ConsumerDispatcherChannelBase(Impl.Channel channel, ushort concurrency)
{
_channel = channel;
_concurrency = concurrency;
var channelOpts = new System.Threading.Channels.UnboundedChannelOptions
{
SingleReader = _concurrency == 1,
SingleWriter = false,
AllowSynchronousContinuations = false
};
var workChannel = System.Threading.Channels.Channel.CreateUnbounded<WorkStruct>(channelOpts);
_reader = workChannel.Reader;
_writer = workChannel.Writer;
Func<Task> loopStart = ProcessChannelAsync;
if (_concurrency == 1)
{
_worker = Task.Run(loopStart);
}
else
{
var tasks = new Task[_concurrency];
for (int i = 0; i < _concurrency; i++)
{
tasks[i] = Task.Run(loopStart);
}
_worker = Task.WhenAll(tasks);
}
}
Hi. thanks, In your example you refer for multi consumer for EventBus. And for multi consumer for backgroud job using RabbitMq. it's enought to set ConsumerDispatchConcurrency using this example:
[Dependency(ReplaceServices = true)]
public class MyAbpRabbitMqModule : AbpRabbitMqModule
{
public override void ConfigureServices(ServiceConfigurationContext context)
{
var configuration = context.Services.GetConfiguration();
Configure<AbpRabbitMqOptions>(configuration.GetSection("RabbitMQ"));
Configure<AbpRabbitMqOptions>(options =>
{
foreach (var connectionFactory in options.Connections.Values)
{
connectionFactory.DispatchConsumersAsync = true;
connectionFactory.ConsumerDispatchConcurrency = 3; // add this line for configure
}
});
}
}
<br> <br>
Hi I need to have more threads that consume same queue on rabbitmq. It's no important the order of processing messages in queue, but only this must be fast as it as possibile. I see that on RabbitMq client library there is a parameter on ConnectionFactory ConsumerDispatchConcurrency that enable multithread consumer. This feature require that messages will be consumed using IAsyncBasicConsumer. Abp in AbpRabbitMqModule use AsyncEventingBasicConsumer. Set parameter ConsumerDispatchConcurrency greater then 1 on AbpRabbitMqModule is possible and enable multithread consumer? Many thanks. Marco
Ok. Ii's work also for me. Thanks,
I have a question about FluentValidation in Blazor server. I use it with package Blazorise.FluentValditation, and also adding Volo.Abp.FluentValidation. I notice 2 problem:
I fix it by myself. Sorry,
How I can fix it? Many thanks.
ok thanks now it's fixed.
Same issue, I think the problem is due to the recent migration of ABP portal to Cloudflare.