public SimpleTrackingChannel(TrackingParameters parameters) { trackingParameters = parameters; trackingDataFile = TrackingDataFilePrefix + parameters.InstanceId.ToString() + ".txt"; Console.WriteLine("Saving tracking information to " + trackingDataFile); streamWriter = File.CreateText(trackingDataFile); streamWriter.AutoFlush = true; }
/// <summary> /// Construct a <see cref="GenericTrackingChannel" /> using /// the specified <see cref="IResourceProvider" /> for providing /// resources necessary for manipulating the underlying persistence store. /// </summary> /// <param name="resourceProvider"> /// A <see cref="IResourceProvider" /> responsible for providing /// resources necessary for manipulating the underlying persistence store. /// </param> /// <param name="trackingParameters"> /// <see cref="TrackingParameters" /> from the <see cref="TrackingService" />. /// </param> protected GenericTrackingChannel(IResourceProvider resourceProvider, TrackingParameters trackingParameters) { if (resourceProvider == null) throw new ArgumentNullException("resourceProvider"); if (trackingParameters == null) throw new ArgumentNullException("trackingParameters"); this.resourceProvider = resourceProvider; this.trackingParameters = trackingParameters; }
/// <summary> /// Create an instance of the <see cref="AdoTrackingChannel" /> /// with the specified <see cref="IAdoResourceProvider" />, <see cref="ITrackingNameResolver" /> /// and <see cref="IAdoValueReader" />. /// </summary> /// <param name="resourceProvider"> /// An <see cref="IAdoResourceProvider" /> that provides resources /// for manipulating the underlying tracking store. /// </param> /// <param name="valueReader"> /// An <see cref="IAdoValueReader" /> that is responsible for /// reading values from the underlying tracking store. /// </param> /// <param name="nameResolver"> /// An <see cref="ITrackingNameResolver" /> that is responsible for /// resolving names for the underlying tracking store. /// </param> /// <param name="trackingParameters"> /// <see cref="TrackingParameters" /> from the <see cref="TrackingService" />. /// </param> public AdoTrackingChannel(IAdoResourceProvider resourceProvider, IAdoValueReader valueReader, ITrackingNameResolver nameResolver, TrackingParameters trackingParameters) : base(resourceProvider, trackingParameters) { if (valueReader == null) throw new ArgumentNullException("valueReader"); if (nameResolver == null) throw new ArgumentNullException("nameResolver"); this.valueReader = valueReader; this.nameResolver = nameResolver; }
internal void ReloadProfiles(WorkflowExecutor exec, Guid instanceId, ref TrackingListenerBroker broker, ref List<TrackingChannelWrapper> channels) { Type workflowType = exec.WorkflowDefinition.GetType(); foreach (TrackingService service in this._services) { TrackingProfile profile = null; TrackingChannelWrapper wrapper = null; if (service.TryReloadProfile(workflowType, instanceId, out profile)) { bool flag = false; int index = 0; while (index < channels.Count) { if (service.GetType() == channels[index].TrackingServiceType) { wrapper = channels[index]; flag = true; break; } index++; } if (profile == null) { if (flag) { broker.RemoveService(wrapper.TrackingServiceType); channels.RemoveAt(index); } } else { RTTrackingProfile profile2 = new RTTrackingProfile(profile, exec.WorkflowDefinition, workflowType) { IsPrivate = true }; if (!flag) { List<string> callPath = null; Guid empty = Guid.Empty; TrackingCallingState trackingCallingState = exec.TrackingCallingState; IList<string> collection = null; Guid context = this.GetContext(exec.RootActivity); Guid callerContextGuid = Guid.Empty; Guid callerParentContextGuid = Guid.Empty; if (trackingCallingState != null) { collection = trackingCallingState.CallerActivityPathProxy; if ((collection != null) && (collection.Count > 0)) { callPath = new List<string>(collection); empty = trackingCallingState.CallerWorkflowInstanceId; callerContextGuid = trackingCallingState.CallerContextGuid; callerParentContextGuid = trackingCallingState.CallerParentContextGuid; } } TrackingParameters parameters = new TrackingParameters(instanceId, workflowType, exec.WorkflowDefinition, callPath, empty, context, callerContextGuid, callerParentContextGuid); TrackingChannelWrapper item = new TrackingChannelWrapper(service.GetTrackingChannel(parameters), service.GetType(), workflowType, profile2); channels.Add(item); Type type = service.GetType(); broker.AddService(type, profile2.Version); broker.MakeProfileInstance(type); } else { wrapper.SetTrackingProfile(profile2); broker.MakeProfileInstance(wrapper.TrackingServiceType); } } } } }
protected override TrackingChannel GetTrackingChannel(TrackingParameters parameters) { return new Budget2TrackingChannel(parameters); }
public Budget2TrackingChannel(TrackingParameters parameters) { _parameters = parameters; }
protected internal abstract TrackingChannel GetTrackingChannel(TrackingParameters parameters);
/// <summary> /// Returns a tracking channel that will receive instnce terminated events. /// </summary> protected override TrackingChannel GetTrackingChannel(TrackingParameters parameters) { return new TerminationTrackingChannel(parameters, source); }
protected override TrackingChannel GetTrackingChannel(TrackingParameters parameters) { // Returns the channel that the runtime tracking infrastructure uses // to send tracking records to the tracking service. // For this sample a channel is returned that dumps the tracking record // to the command window using Console.WriteLine(). return new TrackingChannelSample(parameters); }
protected override TrackingChannel GetTrackingChannel(TrackingParameters parameters) { //return a tracking channel to receive runtime events return new TrackingChannelSample(parameters); }
public LoggerTrackingChannel(TrackingParameters parameters, Logging.ILogger logger) { m_Logger = logger; m_Parameters = parameters; }
///<summary> ///Must be overridden in the derived class, and when implemented, returns the channel that the runtime tracking infrastructure uses to send tracking records to the tracking service. ///</summary> /// ///<returns> ///The <see cref="T:System.Workflow.Runtime.Tracking.TrackingChannel"></see> that is used to send tracking records to the tracking service. ///</returns> /// ///<param name="parameters">The <see cref="T:System.Workflow.Runtime.Tracking.TrackingParameters"></see> associated with the workflow instance.</param> protected override TrackingChannel GetTrackingChannel(TrackingParameters parameters) { IAdoResourceProvider resourceProvider = ResourceProvider as IAdoResourceProvider; if (resourceProvider == null) throw new ArgumentException(RM.Get_Error_NotIAdoResourceProvider()); return new AdoTrackingChannel(resourceProvider, valueReader, nameResolver, parameters); }
protected override TrackingChannel GetTrackingChannel(TrackingParameters parameters) { throw new NotImplementedException(); }
public TerminationTrackingChannel(TrackingParameters parameters, string source) { if (null == parameters) throw new ArgumentNullException("parameters"); if (null == source) throw new ArgumentNullException("source"); if (0 == source.Length) throw new ArgumentException("EventSource cannot be null or empty.", "source"); sourceValue = source; parametersValue = parameters; }
private List<TrackingChannelWrapper> GetChannels(Activity schedule, WorkflowExecutor exec, Guid instanceID, Type workflowType, ref TrackingListenerBroker broker) { if (this._services == null) { return null; } bool flag = false; if (broker == null) { broker = new TrackingListenerBroker(); flag = true; } List<TrackingChannelWrapper> list = new List<TrackingChannelWrapper>(); List<string> callPath = null; Guid empty = Guid.Empty; Guid context = this.GetContext(exec.RootActivity); Guid callerContextGuid = Guid.Empty; Guid callerParentContextGuid = Guid.Empty; TrackingCallingState trackingCallingState = exec.TrackingCallingState; TrackingListenerBroker broker1 = (TrackingListenerBroker) exec.RootActivity.GetValue(WorkflowExecutor.TrackingListenerBrokerProperty); IList<string> collection = (trackingCallingState != null) ? trackingCallingState.CallerActivityPathProxy : null; if ((collection != null) && (collection.Count > 0)) { callPath = new List<string>(collection); empty = trackingCallingState.CallerWorkflowInstanceId; callerContextGuid = trackingCallingState.CallerContextGuid; callerParentContextGuid = trackingCallingState.CallerParentContextGuid; } TrackingParameters parameters = new TrackingParameters(instanceID, workflowType, exec.WorkflowDefinition, callPath, empty, context, callerContextGuid, callerParentContextGuid); for (int i = 0; i < this._services.Count; i++) { TrackingChannel trackingChannel = null; Type trackingServiceType = this._services[i].GetType(); RTTrackingProfile profile = null; if (flag) { profile = this._profileManager.GetProfile(this._services[i], schedule); if (profile == null) { continue; } broker.AddService(trackingServiceType, profile.Version); } else { if (!broker.ContainsService(trackingServiceType)) { continue; } if (broker.IsProfileInstance(trackingServiceType)) { profile = this._profileManager.GetProfile(this._services[i], schedule, instanceID); if (profile == null) { throw new InvalidOperationException(ExecutionStringManager.MissingProfileForService + trackingServiceType.ToString()); } profile.IsPrivate = true; } else { Version version; if (!broker.TryGetProfileVersionId(trackingServiceType, out version)) { continue; } profile = this._profileManager.GetProfile(this._services[i], schedule, version); if (profile == null) { throw new InvalidOperationException(ExecutionStringManager.MissingProfileForService + trackingServiceType.ToString() + ExecutionStringManager.MissingProfileForVersion + version.ToString()); } if (broker.IsProfilePrivate(trackingServiceType)) { profile = profile.Clone(); profile.IsPrivate = true; } } } trackingChannel = this._services[i].GetTrackingChannel(parameters); if (trackingChannel == null) { throw new InvalidOperationException(ExecutionStringManager.NullChannel); } list.Add(new TrackingChannelWrapper(trackingChannel, this._services[i].GetType(), workflowType, profile)); } return list; }
public TrackingChannelSample(TrackingParameters parameters) { this.parameters = parameters; }
protected override TrackingChannel GetTrackingChannel(TrackingParameters parameters) { //return a tracking channel to receive runtime events return new Workflows.LoggerTrackingChannel(parameters, m_Logger); }