问题
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,
- Does MassTransit still publish all
Fault
events, or will it always beFault<T>
? - 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.
来源:https://stackoverflow.com/questions/53050780/masstransit-subscribing-to-all-fault-events-on-azure-service-bus