Beispiel #1
0
        public void CreateAndStartActivity_DontCreateEventsIfNobodyListens()
        {
            string             name     = nameof(CreateAndStartActivity_DontCreateEventsIfNobodyListens);
            DiagnosticListener listener = new DiagnosticListener(name);

            Activity?activity = listener.CreateAndStartActivity(name);

            Assert.IsNull(activity);
        }
        /// <inheritdoc />
        public override void HandleOneWayMessage(IServiceRemotingRequestMessage requestMessage)
        {
            Activity?activity = m_diagnosticListener.CreateAndStartActivity(OneWayMessageActivityName);

            try
            {
                requestMessage.ExtractActivityFromIncomingRequest(activity);
                base.HandleOneWayMessage(requestMessage);
                activity?.SetResult(TimedScopeResult.Success);
            }
            catch (Exception ex)
            {
                m_diagnosticListener.ReportException(ex);
                throw;
            }
            finally
            {
                m_diagnosticListener.StopActivityIfExist(activity);
            }
        }