public override void Dispatch(MessageDelivery messageDelivery) { PublishRequest pr = new PublishRequest(messageDelivery.ContractType, messageDelivery.Action, messageDelivery.Message, messageDelivery.Context); using (TransactionScope ts = new TransactionScope()) { foreach (MessageDelivery md in determineDeliveries(pr)) { DeliveryCore deliveryCore = SelectDeliveryCore(md); deliveryCore.Deliver(md); } ts.Complete(); } }
void deliverToSubscriptionEndpoint(TimeSpan timeout, PublishRequest publishRequest) { SubscriptionEndpoint se = _subscriptionEndpoint; publishRequest = PublishRequest.Copy(publishRequest, new KeyValuePair <MessageDeliveryContextKey, object>(MessageDelivery.PublishRequestId, publishRequest.PublishRequestId)); using (TransactionScope ts = new TransactionScope()) { MessageDelivery md = new MessageDelivery(Guid.NewGuid().ToString(), se.Id, publishRequest.ContractType, publishRequest.Action, publishRequest.Message, MaxRetries, 0, null, publishRequest.Context, DateTime.Now + timeout); DeliveryCore deliveryCore = ServiceLocator.GetInstance <DeliveryCore>(); deliveryCore.Deliver(md); ts.Complete(); } }