MassTransit - subscribing to all fault events on A

2019-08-23 10:09发布

问题:

I'm aware of a similar post here but don't have enough rep to comment and ask for clarification.

I've been trying to achieve a similar thing as the accepted answer suggests, with one service on Azure Service Bus capturing all Fault events, but can't see any events of type Fault being published.

This is how I'm subscribed:

Bus.Factory.CreateUsingAzureServiceBus(
sbc =>
{
    var host = ConfigureServiceBus(serviceBusPath, sbc);
    sbc.SubscriptionEndpoint<Fault>(host, subscriptionName,
    ec => { ec.Consumer<FaultConsumerBase>(context); });
})

Where FaultConsumerBase : IConsumer<Fault>.
I can see my subscriber under masstransit/fault/FaultEventSubscription.

From the documentation, the examples are all of subscribers Fault<T>.
So,

  1. Does MassTransit still publish all Fault events, or will it always be Fault<T>?
  2. If yes, how does one subscribe to these? If no, what is the recommended pattern to catch all published Faults (just once) on the service bus?
    A service that is constantly updated with subscriptions to new events, for example, would be undesirable.

回答1:

As mentioned by @ChrisPatterson in comment to my quesiton, this is does not work on ASB due to the fact that ASB does not support polymorphic messaging.