示例#1
0
        public void Persist(
            ITransmissionRequest transmissionRequest,
            ITransmissionResponse transmissionResponse,
            Trace root)
        {
            Trace span = root.Child();

            span.Record(Annotations.ServiceName("persist statistics"));
            span.Record(Annotations.ClientSend());
            try
            {
                RawStatisticsBuilder builder = new RawStatisticsBuilder()
                                               .AccessPointIdentifier(this.ourAccessPointIdentifier).Direction(Direction.OUT)
                                               .DocumentType(transmissionResponse.GetHeader().DocumentType)
                                               .Sender(transmissionResponse.GetHeader().Sender)
                                               .Receiver(transmissionResponse.GetHeader().Receiver)
                                               .Profile(transmissionResponse.GetHeader().Process)
                                               .Date(transmissionResponse.GetTimestamp()); // Time stamp of reception of the receipt

                // If we know the CN name of the destination AP, supply that
                // as the channel id otherwise use the protocol name
                if (transmissionRequest.GetEndpoint().Certificate != null)
                {
                    String accessPointIdentifierValue =
                        CertificateUtils.ExtractCommonName(transmissionRequest.GetEndpoint().Certificate);
                    builder.Channel(new ChannelId(accessPointIdentifierValue));
                }
                else
                {
                    String protocolName = transmissionRequest.GetEndpoint().TransportProfile.Identifier;
                    builder.Channel(new ChannelId(protocolName));
                }

                DefaultRawStatistics rawStatistics = builder.Build();
                this.rawStatisticsRepository.Persist(rawStatistics);
            }
            catch (Exception ex)
            {
                span.Record(Annotations.Tag("exception", ex.Message));
                Logger.Error($"Persisting DefaultRawStatistics about oubound transmission failed : {ex.Message}", ex);
            }
            finally
            {
                span.Record(Annotations.ClientRecv());
            }
        }
示例#2
0
        public void Persist(IInboundMetadata inboundMetadata)
        {
            // Persists raw statistics when message was received (ignore if stats couldn't be persisted, just warn)
            try
            {
                DefaultRawStatistics rawStatistics = new RawStatisticsBuilder()
                                                     .AccessPointIdentifier(this.ourAccessPointIdentifier).Direction(Direction.IN)
                                                     .DocumentType(inboundMetadata.GetHeader().DocumentType)
                                                     .Sender(inboundMetadata.GetHeader().Sender).Receiver(inboundMetadata.GetHeader().Receiver)
                                                     .Profile(inboundMetadata.GetHeader().Process).Channel(new ChannelId("AS2")).Build();

                this.rawStatisticsRepository.Persist(rawStatistics);
            }
            catch (Exception e)
            {
                Logger.Error($"Unable to persist statistics for {inboundMetadata}\n {e.Message}", e);
            }
        }
示例#3
0
 internal DefaultRawStatistics(RawStatisticsBuilder builder) : base(builder)
 {
     this.Sender   = builder.GetSender();
     this.Receiver = builder.GetReceiver();
 }