大众运输一位故障使用者处理所有故障消息 [英] Masstransit one fault consumer for all fault message

查看:49
本文介绍了大众运输一位故障使用者处理所有故障消息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何让一个通用使用者处理所有故障消息?

How to have one generic consumer that handle all Fault Messages ?

我是否需要为我的每条故障消息注册Fault Consumer?

Do I need to register Fault Consumer for each of my fault messages?

推荐答案

为什么不消费Fault?

public class WantAllFaultsGimmeThem : IConsumer<Fault>
{
    public async Task Consume(ConsumeContext<Fault> context)
    {
        // whatever you want to do here
    }
}

唯一的问题是Message不是该接口的一部分,因此甚至不会反序列化.因此您将无权访问消息,而只能访问消息ID.

The only issue is that the Message is not part of this interface and therefore it will not be even deserialised. so you will not have access to the message, only to the message id.

这篇关于大众运输一位故障使用者处理所有故障消息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆