internal DeliveryHistoryEntry(DeliveryOperation operation, long?serviceInstanceID, Dictionary <string, object> parameters = null) { this.Operation = operation; this.ServiceInstanceID = serviceInstanceID; this.DateRecorded = DateTime.Now; this.Parameters = parameters; }
/// <summary> /// Constuctor. /// </summary> /// <param name="operation">Specifies how the message should be interpreted.</param> /// <param name="timestamp">The time (UTC) when the delivery was completed successfully or was aborted.</param> /// <param name="targetEP">The original target or cluster endpoint.</param> /// <param name="confirmEP">The confirmation endpoint (or <c>null</c>).</param> /// <param name="query">The query message.</param> /// <param name="topologyID">The globally unique cluster topology provider instance ID or <see cref="Guid.Empty" />.</param> /// <param name="topologyInfo">The serialized cluster itopology nformation (or <c>null</c>).</param> /// <param name="topologyParam">The serialized topology parameter (or <c>null</c>).</param> /// <param name="exception">The exception for failed deliveries or queries.</param> /// <param name="response">The response message (or <c>null</c>).</param> public DeliveryMsg(DeliveryOperation operation, DateTime timestamp, MsgEP targetEP, MsgEP confirmEP, Msg query, Guid topologyID, string topologyInfo, string topologyParam, Exception exception, Msg response) { this.Operation = operation; this.Timestamp = timestamp; this.TargetEP = targetEP; this.ConfirmEP = confirmEP; this.TopologyID = topologyID; this.TopologyInfo = topologyInfo; this.TopologyParam = topologyParam; this.Exception = exception; this.query = query; this.response = response; // Serialize the query and responses to the message blob EnhancedBlockStream es = new EnhancedBlockStream(); try { Msg.Save(es, query); if (response != null) { Msg.Save(es, response); } base._Data = es.ToArray(); } finally { es.Close(); } }
void Batch(Delivery[] deliveries, int passes, Action onBegin, Action <Exception> onEnd, Action <int> onBeginPass, Action <int> onEndPass, Action <int> onItem, Action onDispose, DeliveryImportManagerState activeState, DeliveryOperation historyOperation) { ThrowIfNotIdle(); this.State = activeState; Dictionary <string, object>[] entryParams = new Dictionary <string, object> [deliveries.Length]; onBegin(); Exception exception = null; try { for (int pass = 0; pass < passes; pass++) { onBeginPass(pass); for (int i = 0; i < deliveries.Length; i++) { this.CurrentDelivery = deliveries[i]; this.HistoryEntryParameters = entryParams[i] ?? (entryParams[i] = new Dictionary <string, object>()); onItem(pass); } onEndPass(pass); } } catch (Exception ex) { exception = ex; } this.CurrentDelivery = null; this.HistoryEntryParameters = null; onEnd(exception); if (exception == null) { // Add history and save for (int i = 0; i < deliveries.Length; i++) { Delivery delivery = deliveries[i]; delivery.History.Add(historyOperation, this._serviceInstanceID, entryParams[i]); delivery.Save(); } } else { // Throw exception throw new Exception("InnerException:", exception); } this.State = DeliveryImportManagerState.Idle; onDispose(); OnDispose(); }
public void Add(DeliveryOperation operation, long?serviceInstanceID, Dictionary <string, object> parameters = null) { InnerList.Add(new DeliveryHistoryEntry(operation, serviceInstanceID, parameters)); }
void Batch(Delivery[] deliveries, int passes, Action onBegin, Action <Exception> onEnd, Action <int> onBeginPass, Action <int> onEndPass, Action <int> onItem, Action onDispose, DeliveryImportManagerState activeState, DeliveryOperation historyOperation) { ThrowIfNotIdle(); this.State = activeState; Dictionary <string, object>[] entryParams = new Dictionary <string, object> [deliveries.Length]; onBegin(); Exception exception = null; try { for (int pass = 0; pass < passes; pass++) { onBeginPass(pass); for (int i = 0; i < deliveries.Length; i++) { this.CurrentDelivery = deliveries[i]; this.HistoryEntryParameters = entryParams[i] ?? (entryParams[i] = new Dictionary <string, object>()); onItem(pass); } onEndPass(pass); } } catch (DeliveryConflictException dceex) { throw dceex; } catch (Exception ex) { exception = ex; } this.CurrentDelivery = null; this.HistoryEntryParameters = null; try { onEnd(exception); } catch (Exception ex) { if (exception == null) { throw new Exception("Failed to end delivery operation. There were no other exceptions before this one.", ex); } else { Log.Write("Failed to end delivery operation - probably because of another exception. See next log message.", ex); } } if (exception == null) { // Add history and save for (int i = 0; i < deliveries.Length; i++) { Delivery delivery = deliveries[i]; delivery.History.Add(historyOperation, this._serviceInstanceID, entryParams[i]); delivery.Save(); } } else { // Throw exception throw new Exception("Delivery operation failed while importing.", exception); } this.State = DeliveryImportManagerState.Idle; onDispose(); OnDispose(); }
public async Task <IResult> DeleteAsync(DeliveryOperation deliveryOperation) { await _deliveryOperationDao.DeleteAsync(deliveryOperation); return(new SuccessResult(true, ResultMessages.DeliveryOrderDeleted)); }
public IResult Delete(DeliveryOperation deliveryOperation) { _deliveryOperationDao.Add(deliveryOperation); return(new SuccessResult(true, ResultMessages.DeliveryOrderDeleted)); }
public IResult Update(DeliveryOperation deliveryOperation) { _deliveryOperationDao.Update(deliveryOperation); return(new SuccessResult(true, ResultMessages.DeliveryOrderUpdated)); }