/// <summary> /// Returns true if ExecProviderEvent instances are equal /// </summary> /// <param name="other">Instance of ExecProviderEvent to be compared</param> /// <returns>Boolean</returns> public bool Equals(ExecProviderEvent other) { if (ReferenceEquals(null, other)) { return(false); } if (ReferenceEquals(this, other)) { return(true); } return (( BatchId == other.BatchId || BatchId != null && BatchId.Equals(other.BatchId) ) && ( ExeScript == other.ExeScript || ExeScript != null && ExeScript.Equals(other.ExeScript) ) && ( EventType == other.EventType || EventType != null && EventType.Equals(other.EventType) ) && ( ActivityId == other.ActivityId || ActivityId != null && ActivityId.Equals(other.ActivityId) )); }
/// <summary> /// Gets the hash code /// </summary> /// <returns>Hash code</returns> public override int GetHashCode() { unchecked // Overflow is fine, just wrap { var hashCode = 41; // Suitable nullity checks etc, of course :) if (BatchId != null) { hashCode = hashCode * 59 + BatchId.GetHashCode(); } if (ExeScript != null) { hashCode = hashCode * 59 + ExeScript.GetHashCode(); } if (EventType != null) { hashCode = hashCode * 59 + EventType.GetHashCode(); } if (ActivityId != null) { hashCode = hashCode * 59 + ActivityId.GetHashCode(); } return(hashCode); } }
public ExeScript CreateExeScriptBatch(string activityId, ExeScript exeScript) { exeScript.BatchId = "" + Guid.NewGuid(); this.ExeBatches.Add(exeScript.BatchId, exeScript); return(exeScript); }
public string ExecAsync(string activityId, ExeScript exeScript) { return(new ExecOperation( this.AgreementRepository, this.ActivityRepository, this.ProviderEventQueues) .Run(activityId, exeScript)); }
public string Run(string activityId, ExeScript exeScript) { var activity = this.ActivityRepository.GetActivity(activityId); if (activity == null) { throw new Exception($"Activity {activityId} does not exist..."); } else { var requestorNodeId = activity.RequestorNodeId; var providerNodeId = activity.ProviderNodeId; // 1. Create the exeScript batch record var exeScriptBatch = this.ActivityRepository.CreateExeScriptBatch(activityId, exeScript); // 2. Send the Exec event to the Provider var providerEvent = new Entities.ActivityProviderEvent() { EventType = Entities.ActivityProviderEvent.ActivityProviderEventType.Exec, ActivityId = activity.Id, ExeScript = exeScriptBatch }; if (this.ProviderEventQueues.ContainsKey(providerNodeId)) { this.ProviderEventQueues[providerNodeId].Add(providerEvent); } else { throw new Exception($"Unable to find provider node id {providerNodeId} in ProviderEventQueues..."); } return(exeScriptBatch.BatchId); } }