/// <summary> /// ctor /// </summary> /// <param name="parameters"></param> /// <param name="logPath">tracking file path </param> /// <param name="wfHost">Workflow service host name</param> /// <param name="wfPersistanceDb">connection string, where WF persistance happens</param> public XMLFileTrackingChannel(TrackingParameters parameters, string wfHost, string logPath, string wfPersistanceDb) { _parameters = parameters; _wfPersistanceDb = wfPersistanceDb; _workflowID = parameters.InstanceId.ToString(); _logLocation = logPath; _wfHost = wfHost; if (!Directory.Exists(_logLocation)) { Directory.CreateDirectory(_logLocation); } //Start- Save Wf definition if (_persistanceHelper == null) { _persistanceHelper = new XMLFilePersistence( Path.Combine(_logLocation, _workflowID + "_def.xml"), Path.Combine(_logLocation, _workflowID + ".xml"), _wfPersistanceDb ); //We will save Wf definition, if wf is new or it has been updated if (_persistanceHelper.IsNewOrUpdatedWfDefinition(_parameters.RootActivity)) { DateTime wfCompilationTimestamp = _persistanceHelper.GetWfCompilationTimestamp(_parameters.RootActivity); ActivitySummary rootActivitySummary = BuildRootActivitySummary(); String activityXml = BuildActivityXml(rootActivitySummary, wfCompilationTimestamp); _persistanceHelper.PersistWfDefinitionXml(activityXml); } } //End- Save Wf definition }
public void Complete(bool succeeded, System.Collections.ICollection items) { if (_persistanceHelper != null) { _persistanceHelper.Dispose(); _persistanceHelper = null; } }
private void LogWfHostStartupInfo() { XMLFilePersistence persistanceHelper = new XMLFilePersistence( Path.Combine(_logLocation, GetMachineName() + ".log")); Process currentProcess = Process.GetCurrentProcess(); persistanceHelper.PersistWorkflowHostLog(currentProcess.ProcessName + " PID=" + currentProcess.Id + " started @ " + currentProcess.StartTime); }
public void Commit(System.Transactions.Transaction transaction, System.Collections.ICollection items) { if (_persistanceHelper == null) { //_persistanceHelper = new XmlPersistence(Path.Combine(_logLocation, _workflowID + ".xml")); _persistanceHelper = new XMLFilePersistence( Path.Combine(_logLocation, _workflowID + "_def.xml"), Path.Combine(_logLocation, _workflowID + ".xml"), _wfPersistanceDb ); } _persistanceHelper.PersistTrackingRecords(items); }
//Retruns the workflow defition sring from XML public string GetDefinition() { string FileName = string.Empty; try { string FolderName = Path.GetDirectoryName(TrackingFilePath); FileName = Path.GetFileNameWithoutExtension(TrackingFilePath); string _wfDefFilePath = Path.Combine(FolderName, FileName + "_def.xml"); XMLFilePersistence persistance = new XMLFilePersistence(_wfDefFilePath, TrackingFilePath, string.Empty); return(persistance.GetWorkflowDefinitionString()); } catch { throw new Exception("Unable to load workflow definition for '" + FileName + "'"); } }