public As2TransmissionResponse( TransmissionIdentifier transmissionIdentifier, ITransmissionRequest transmissionRequest, Digest digest, byte[] nativeEvidenceBytes, Timestamp timestamp, DateTime date) { this.transmissionIdentifier = transmissionIdentifier; this.transmissionRequest = transmissionRequest; this.digest = digest; this.receipt = Receipt.Of("message/disposition-notification", nativeEvidenceBytes); this.timestamp = date; List <Receipt> allReceipts = new List <Receipt>(); allReceipts.Add(this.receipt); if (timestamp.GetReceipt() != null) { allReceipts.Add(timestamp.GetReceipt()); } this.receipts = new ImmutableList <Receipt>(allReceipts); }
public TransmissionResult Call() { Trace span = Trace.Create(); span.Record(Annotations.ServiceName("standalone")); span.Record(Annotations.ClientSend()); try { ITransmissionResponse transmissionResponse; long duration = 0; if (this.parameters.UseFactory) { using (Stream inputStream = File.Open(this.xmlPayloadFile.FullName, FileMode.Open, FileAccess.Read)) { transmissionResponse = this.parameters.HyperwayOutboundComponent.GetTransmissionService() .Send(inputStream, span); } } else { ITransmissionRequest transmissionRequest = this.CreateTransmissionRequest(span); ITransmitter transmitter; Trace span1 = span.Child(); span1.Record(Annotations.ServiceName("get transmitter")); span1.Record(Annotations.ClientSend()); try { transmitter = this.parameters.HyperwayOutboundComponent.GetTransmitter(); } finally { span1.Record(Annotations.ClientRecv()); } // Performs the transmission var watch = new Stopwatch(); watch.Start(); transmissionResponse = this.PerformTransmission( this.parameters.EvidencePath, transmitter, transmissionRequest, span); watch.Stop(); return(new TransmissionResult(watch.ElapsedMilliseconds, transmissionResponse.GetTransmissionIdentifier())); } return(new TransmissionResult(duration, transmissionResponse.GetTransmissionIdentifier())); } finally { span.Record(Annotations.ClientRecv()); } }
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()); } }
public ITransmissionResponse Send(ITransmissionRequest request, Trace traceParent) { this.transmissionRequest = request; this.root = traceParent.Child(); this.root.Record(Annotations.ServiceName("Send AS2 message")); this.root.Record(Annotations.ClientSend()); try { return(this.SendHttpRequest(this.PrepareHttpRequest())); } catch (HyperwayTransmissionException e) { this.root.Record(Annotations.Tag("exception", e.Message)); throw; } finally { this.root.Record(Annotations.ClientRecv()); } }
protected ITransmissionResponse PerformTransmission( DirectoryInfo evidencePath, ITransmitter transmitter, ITransmissionRequest transmissionRequest, Trace root) { Trace span = root.Child(); span.Record(Annotations.ServiceName("transmission")); span.Record(Annotations.ClientSend()); try { // ... and performs the transmission Stopwatch watch = new Stopwatch(); watch.Start(); // long start = System.DateTime.Now; ITransmissionResponse transmissionResponse = transmitter.Transmit(transmissionRequest, span); watch.Stop(); long durationInMs = watch.ElapsedMilliseconds; // System.DateTime.Now - start; Log.Debug( String.Format( "Message using messageId {0} sent to {1} using {2} was assigned transmissionId {3} took {4}ms\n", transmissionResponse.GetHeader().Identifier.Identifier, transmissionResponse.GetEndpoint().Address, transmissionResponse.GetProtocol().Identifier, transmissionResponse.GetTransmissionIdentifier(), durationInMs)); this.SaveEvidence(transmissionResponse, evidencePath, span); return(transmissionResponse); } finally { span.Record(Annotations.ClientRecv()); } }
public ITransmissionResponse Send(ITransmissionRequest request) { return(this.Send(request, this.root)); }
public void Persist(ITransmissionRequest transmissionRequest, ITransmissionResponse transmissionResponse, Trace root) { // No action. }