TrackingChannel.Send(TrackingRecord) Methode

Definition

Sendet beim Implementieren in einer abgeleiteten Klasse einen TrackingRecord über den TrackingChannel.When implemented in a derived class, sends a TrackingRecord on the TrackingChannel.

protected public:
 abstract void Send(System::Workflow::Runtime::Tracking::TrackingRecord ^ record);
protected internal abstract void Send (System.Workflow.Runtime.Tracking.TrackingRecord record);
abstract member Send : System.Workflow.Runtime.Tracking.TrackingRecord -> unit
Protected Friend MustOverride Sub Send (record As TrackingRecord)

Parameter

record
TrackingRecord

Der zu sendende TrackingRecord.The TrackingRecord to send.

Beispiele

Im folgenden Beispiel wird eine Implementierung der Send-Methode veranschaulicht.The following example demonstrates an implementation of the Send method. In dieser Implementierung werden Verfolgungsmeldungen nach Beendigung eines Workflows in das Ereignisprotokoll geschrieben.In this implementation, tracking messages are written to the event log when a workflow terminates. Dieses Beispiel stammt aus dem Termination Tracking Service SDK-Beispiel.This sample is from the Termination Tracking Service SDK sample. Weitere Informationen finden Sie unter Beispiel für den Abbruch Verfolgungs Dienst.For more information, see Termination Tracking Service Sample.

/// <summary>
/// Receives tracking events.  Instance terminated events are written to the event log.
/// </summary>
protected override void Send(TrackingRecord record)
{
    WorkflowTrackingRecord instanceTrackingRecord = record as WorkflowTrackingRecord;

    if ((null == instanceTrackingRecord) || (TrackingWorkflowEvent.Terminated != instanceTrackingRecord.TrackingWorkflowEvent))
        return;

    // Create an EventLog instance and assign its source.
    EventLog log = new EventLog();
    log.Source = sourceValue;

    // Write an informational entry to the event log.  
    TrackingWorkflowTerminatedEventArgs terminatedEventArgs = instanceTrackingRecord.EventArgs as TrackingWorkflowTerminatedEventArgs;

    StringBuilder message = new StringBuilder(512);
    message.AppendLine(string.Format(System.Globalization.CultureInfo.InvariantCulture, "Workflow instance {0} has been terminated.", parametersValue.InstanceId.ToString()));
    message.AppendLine();

    if (null != terminatedEventArgs.Exception)
        message.AppendLine(terminatedEventArgs.Exception.ToString());

    log.WriteEntry(message.ToString(), EventLogEntryType.Warning);
}
'/ <summary>
'/ Receives tracking events.  Instance terminated events are written to the event log.
'/ </summary>
Protected Overrides Sub Send(ByVal record As TrackingRecord)

    Dim instanceTrackingRecord As WorkflowTrackingRecord = CType(record, WorkflowTrackingRecord)

    If instanceTrackingRecord Is Nothing Or Not TrackingWorkflowEvent.Terminated = instanceTrackingRecord.TrackingWorkflowEvent Then
        Return
    End If

    ' Create an EventLog instance and assign its source.
    Dim log As New EventLog()
    log.Source = sourceValue

    ' Write an informational entry to the event log.  
    Dim terminatedEventArgs As TrackingWorkflowTerminatedEventArgs = CType(instanceTrackingRecord.EventArgs, TrackingWorkflowTerminatedEventArgs)

    Dim Message As New StringBuilder(512)
    Message.AppendLine(String.Format(System.Globalization.CultureInfo.InvariantCulture, "Workflow instance 0} has been terminated.", parametersValue.InstanceId.ToString()))
    Message.AppendLine()

    If terminatedEventArgs.Exception Is Nothing Then
        Message.AppendLine(terminatedEventArgs.Exception.ToString())
    End If


    log.WriteEntry(Message.ToString(), EventLogEntryType.Warning)
End Sub

Hinweise

Die Laufzeitverfolgungsinfrastruktur ruft Send auf, um einen TrackingRecord über den TrackingChannel zu senden, wenn sie mit einem Verfolgungspunkt in einem TrackingProfile übereinstimmt.The runtime tracking infrastructure calls Send to deliver a TrackingRecord on the TrackingChannel when it matches a track point in a TrackingProfile. Sie können die über einen TrackingChannel gesendeten Verfolgungsinformationen den Anforderungen Ihrer Anwendung entsprechend beliebig verarbeiten.You can treat the tracking information sent on the TrackingChannel in whatever manner the requirements of your application dictate.

Gilt für: