【发布时间】:2022-11-03 10:43:59
【问题描述】:
我正在尝试创建过滤器来填写消费者中的correlationId,并将此correlationId 添加到发送消息中。
但是,我相信,因为它是多总线,所以 2 个配置的总线之间的上下文是不同的,有什么办法可以使这项工作。
以下是其中一个过滤器的示例:
public class CorrelationSendFilter<T> :
IFilter<SendContext<T>>
where T : class
{
private CorrelationContext _correlationContext;
public CorrelationSendFilter(CorrelationContext correlationContext) { _correlationContext = correlationContext; }
public async Task Send(SendContext<T> context, IPipe<SendContext<T>> next)
{
context.CorrelationId = _correlationContext.GetOrNewCorrelationId();
await next.Send(context);
}
public void Probe(ProbeContext context) { }
}
CorrelationContext 是在 DI 中定义的
【问题讨论】:
-
从一条总线上使用的消息复制上下文的能力正在发送到另一条总线上,这是没有 ETA 的路线图。
标签: .net-core masstransit