问题描述
默认情况下,Masstransit 将 PrefetchCount 设置为 16。我想更改它。我可以在配置 Masstransit 时执行此操作。但是在使用 ConnectReceiveEndpoint
时,我无法设置 PrefetchCount。
如果我设置 PrefetchCount 做配置,那么 Masstransit 将创建一些随机队列,这些队列正确地具有我定义的 PrefetchCount,但使用 ConnectReceiveEndpoint
创建的队列仍然具有默认值 16。
有没有办法为使用 ConnectReceiveEndpoint
创建的队列设置 PrefetchCount?
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;
}
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)