As default, MassTransit sets the PrefetchCount to 16. I would like to change that. I can do this when configuring MassTransit. But when using ConnectReceiveEndpoint
I cannot set the PrefetchCount.
If I set the PrefetchCount doing configuration, then MassTransit will create some random queues which correctly has a PrefetchCount that I defined, but the queues created with ConnectReceiveEndpoint
still have the default value of 16.
Is there any way to set the PrefetchCount for queues created with ConnectReceiveEndpoint
?
public async Task SubscribeAsync<T>(Func<T, Task> callback, string queueName) where T : class, IMessage
{
queueName ??= $"{Assembly.GetEntryAssembly().GetName().Name}_{Environment.MachineName}";
hostHandler = busControl.ConnectReceiveEndpoint(queueName, cfg =>
{
cfg.Handler<T>(async context =>
{
return callback(context.Message);
},
config =>
{
config.UseConcurrentMessageLimit(10);
config.UseMessageRetry(r => r.Exponential(3, TimeSpan.FromSeconds(2), TimeSpan.FromSeconds(10), TimeSpan.FromSeconds(2)));
});
});
await hostHandler.Ready;
}
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…