コード例 #1
0
        private void TracingError(Guid operationId, string topic, string values, Exception ex, DateTimeOffset startTime, TimeSpan du)
        {
            var eventData = new BrokerPublishErrorEventData(
                operationId,
                "",
                ServersAddress,
                topic,
                values,
                ex,
                startTime,
                du);

            s_diagnosticListener.WritePublishError(eventData);
        }
コード例 #2
0
        private void TracingError(Guid operationId, CapPublishedMessage message, OperateResult result, DateTimeOffset startTime, TimeSpan du)
        {
            var ex = new PublisherSentFailedException(result.ToString(), result.Exception);

            _logger.MessagePublishException(message.Id, result.ToString(), ex);

            var eventData = new BrokerPublishErrorEventData(
                operationId,
                "",
                ServersAddress,
                message.Name,
                message.Content,
                ex,
                startTime,
                du);

            s_diagnosticListener.WritePublishError(eventData);
        }
コード例 #3
0
        public void WritePublishErrorTest()
        {
            Guid operationId = Guid.NewGuid();
            var  ex          = new Exception("WritePublishErrorTest");

            DiagnosticsWapper(() =>
            {
                var eventData = new BrokerPublishErrorEventData(operationId, "", "", "", "", ex, DateTimeOffset.UtcNow, default(TimeSpan), default(int));
                s_diagnosticListener.WritePublishError(eventData);
            }, kvp =>
            {
                if (kvp.Key.Equals(CapDiagnosticListenerExtensions.CapErrorPublish))
                {
                    Assert.NotNull(kvp.Value);
                    Assert.IsType <BrokerPublishErrorEventData>(kvp.Value);
                    Assert.Equal(operationId, ((BrokerPublishErrorEventData)kvp.Value).OperationId);
                    Assert.Equal(ex, ((BrokerPublishErrorEventData)kvp.Value).Exception);
                }
            });
        }