如何解决UseConsumeFilter之后,MassTransit.dll中的NullReferenceException
我正在尝试注册我的作用域使用过滤器:
serviceCollectionConfigurator.UsingAzureServiceBus((context,cfg) =>
{
//some code...
cfg.UseConsumeFilter(typeof(MyFilter<>),context);
});
但是随后在运行时,当应该使用消息时,我在MassTransit.dll中得到了NullReferenceException。它甚至不访问过滤器的构造函数。当我删除此过滤器注册或更改过滤器并将其注册为非范围过滤器时,一切正常。我的问题可能是什么原因?
过滤器代码:
public class MyFilter<T> : IFilter<ConsumeContext<T>> where T : class
{
public MyFilter()
{
}
public void Probe(ProbeContext context)
{
context.CreateFilterScope("ExternalMessageFilter");
}
public async Task Send(ConsumeContext<T> context,IPipe<ConsumeContext<T>> next)
{
}
}
谢谢!
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。