다음을 통해 공유


TrackingChannel.Send(TrackingRecord) 메서드

정의

파생 클래스에서 구현되는 경우 TrackingRecord에서 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)

매개 변수

record
TrackingRecord

보낼 TrackingRecord입니다.

예제

다음 예제에서는 Send 메서드의 구현 방법을 보여 줍니다. 이 구현에서는 워크플로가 종료될 때 추적 메시지가 이벤트 로그에 기록됩니다. 이 샘플은 Termination Tracking Service SDK 샘플에 포함되어 있습니다. 자세한 내용은 종료 추적 서비스 샘플합니다.

/// <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

설명

런타임 추적 인프라는 Send를 호출하여 TrackingRecord의 추적 지점을 일치시킬 때 TrackingChannel에서 TrackingProfile를 제공합니다. TrackingChannel에서 전송된 추적 정보를 애플리케이션 요구 사항이 지정하는 임의의 방식으로 처리할 수 있습니다.

적용 대상