MassTransit message mis-typing

后端 未结 1 836
孤城傲影
孤城傲影 2021-01-05 04:02

I am running into a base-typing problem with messages I am attempting to publish through MassTransit. Consider the following:

[Serializable]
public abstract         


        
相关标签:
1条回答
  • 2021-01-05 04:42

    Edit: Serializer doesn't matter here. I didn't think this through.

    You could invoke Bus.Instance.Publish with the right type information by doing reflection on the Event object and getting it's actual type as well. This is going to be some awkward code but once it's done likely easy to reuse. In Magnum we have an extension method to help with this.

    Bus.Instance.FastInvoke(new[]{ event.GetType() }, "Publish", event);
    

    Join us on the mailing list, http://groups.google.com/group/masstransit-discuss, and we'll be happy to discuss in more details.

    0 讨论(0)
提交回复
热议问题