public AccountController()
 {
     trace = zipkin4net.Trace.Create();
 }
 public ByPassAuthMiddleware()
 {
     trace = zipkin4net.Trace.Create();
 }
예제 #3
0
 public BasketController()
 {
     trace = zipkin4net.Trace.Create();
 }
예제 #4
0
        protected ITransmissionRequest CreateTransmissionRequest(Trace root)
        {
            Trace span = root.Child();

            span.Record(Annotations.ServiceName("create transmission request"));
            span.Record(Annotations.ClientSend());

            try
            {
                // creates a transmission request builder and enables trace
                TransmissionRequestBuilder requestBuilder =
                    this.parameters.HyperwayOutboundComponent.GetTransmissionRequestBuilder();

                requestBuilder.SetTransmissionBuilderOverride(true);

                // add receiver participant
                if (this.parameters.Receiver != null)
                {
                    requestBuilder.Receiver(this.parameters.Receiver);
                }

                // add sender participant
                if (this.parameters.Sender != null)
                {
                    requestBuilder.Sender(this.parameters.Sender);
                }

                if (this.parameters.DocType != null)
                {
                    requestBuilder.DocumentType(this.parameters.DocType);
                }

                if (this.parameters.ProcessIdentifier != null)
                {
                    requestBuilder.ProcessType(this.parameters.ProcessIdentifier);
                }

                // Supplies the payload
                using (Stream inputStream = File.Open(this.xmlPayloadFile.FullName, FileMode.Open, FileAccess.Read))
                {
                    requestBuilder.PayLoad(inputStream);
                }

                // Overrides the destination URL if so requested
                if (this.parameters.Endpoint != null)
                {
                    Endpoint endpoint = this.parameters.Endpoint;
                    requestBuilder.OverrideAs2Endpoint(endpoint);
                }

                // Specifying the details completed, creates the transmission request
                return(requestBuilder.Build(span));
            }
            catch (Exception e)
            {
                span.Record(Annotations.Tag("exception", e.Message));
                Console.WriteLine("Message failed : " + e.Message + e.StackTrace);
                return(null);
            }
            finally
            {
                span.Record(Annotations.ClientRecv());
            }
        }
예제 #5
0
 public Config()
 {
     trace = zipkin4net.Trace.Create();
 }
예제 #6
0
 public RedisBasketRepository()
 {
     trace = zipkin4net.Trace.Create();
 }
 public LocationsContextSeed()
 {
     trace = zipkin4net.Trace.Create();
 }
 public HomeController()
 {
     trace = zipkin4net.Trace.Create();
 }
 public ConsentController()
 {
     trace = zipkin4net.Trace.Create();
 }
예제 #10
0
        public void DoPost()
        {
            var headers   = this.httpContext.Request.Headers;
            var messageId = headers["message-id"];

            if (string.IsNullOrWhiteSpace(messageId))
            {
                var errorResult = new ContentResult();
                errorResult.StatusCode = StatusCodes.Status400BadRequest;
                errorResult.Content    = "Header field 'Message-ID' not found.";
                throw new NotSupportedException("error management");
                // return errorResult;
            }


            Trace root = Trace.Create();

            root.Record(Annotations.ServiceName("as2servlet.post"));
            root.Record(Annotations.ServerRecv());
            root.Record(Annotations.Tag("message-id", messageId));

            Logger.Debug("Receiving HTTP POST request");
            try
            {
                // Read MIME message
                var         bodyStream  = this.httpContext.Request.Body;
                var         bodyData    = bodyStream.ToBuffer();
                MimeMessage mimeMessage =
                    MimeMessageHelper.CreateMimeMessageAssistedByHeaders(bodyData.ToStream(), headers);

                try
                {
                    Trace span = root.Child();
                    span.Record(Annotations.ServiceName("as2message"));
                    span.Record(Annotations.ServerRecv());
                    MimeMessage mdn = this.inboundHandlerProvider().Receive(headers, mimeMessage);
                    span.Record(Annotations.ServerSend());

                    span = root.Child();
                    span.Record(Annotations.ServiceName("mdn"));
                    span.Record(Annotations.ServerRecv());

                    this.WriteMdn(this.httpContext.Response, mdn, (int)HttpStatusCode.OK);
                    span.Record(Annotations.ServerSend());
                }
                catch (HyperwayAs2InboundException e)
                {
                    String identifier = Guid.NewGuid().ToString();
                    Logger.ErrorFormat("Error [{0}] {1}", identifier, e);

                    // Open message for reading
                    SMimeReader sMimeReader = new SMimeReader(mimeMessage);

                    // Begin builder
                    MdnBuilder mdnBuilder = MdnBuilder.NewInstance(mimeMessage);
                    // Original Message-Id
                    mdnBuilder.AddHeader(MdnHeader.OriginalMessageId, headers[As2Header.MessageId]);
                    // Disposition from exception
                    mdnBuilder.AddHeader(MdnHeader.Disposition, e.Disposition);
                    mdnBuilder.AddText(String.Format("Error [{0}]", identifier), e.Message);

                    // Build and add headers
                    MimeMessage mdn = this.sMimeMessageFactory.CreateSignedMimeMessage(
                        mdnBuilder.Build(),
                        sMimeReader.GetDigestMethod());
                    mdn.Headers.Add(As2Header.As2Version, As2Header.Version);
                    mdn.Headers.Add(As2Header.As2From, headers[As2Header.As2To]);
                    mdn.Headers.Add(As2Header.As2To, headers[As2Header.As2From]);
                    this.WriteMdn(this.httpContext.Response, mdn, (int)HttpStatusCode.BadRequest);
                }
            }
            catch (Exception e)
            {
                root.Record(Annotations.Tag("exception", e.Message));

                // Unexpected internal error, cannot proceed, return HTTP 500 and partly MDN to indicating the problem
                Logger.ErrorFormat("Internal error occured: {0}", e.Message);
                Logger.Error("Attempting to return MDN with explanatory message and HTTP 500 status");

                // TODO: manage failure
                this.WriteFailureWithExplanation(this.httpContext.Request, this.httpContext.Response, e);
            }

            // MDC.clear();
            root.Record(Annotations.ServerSend());
        }
예제 #11
0
 public FlickrSearchService(string apiKey, string secret)
 {
     _flickr = new Flickr(apiKey, secret);
     _trace  = zipkin4net.Trace.Current.Child();
 }
 public LocationsController(ILocationsService locationsService, IIdentityService identityService)
 {
     trace             = zipkin4net.Trace.Create();
     _locationsService = locationsService ?? throw new ArgumentNullException(nameof(locationsService));
     _identityService  = identityService ?? throw new ArgumentNullException(nameof(identityService));
 }
 public LocationsController()
 {
     trace = zipkin4net.Trace.Create();
 }