public override void Deliver(MessageDelivery delivery)
{
if (!Started)
{
throw new InvalidOperationException("Cannot deliver messages before the bus is started");
}
try
{
SubscriptionEndpoint endpoint = Runtime.GetSubscription(delivery.SubscriptionEndpointId);
if (endpoint != null) // subscription may be removed
{
endpoint.Dispatcher.Dispatch(delivery);
}
NotifyDelivery(delivery);
}
catch(Exception ex)
{
throw new DeliveryException("Unhandled exception while attempting to deliver the message", ex);
}
}