コード例 #1
0
ファイル: ControllerReporter.cs プロジェクト: pereca303/soa
        public async Task Invoke(HttpContext context, IMessageBroker messageBroker)
        {
            // this method is called on every http request

            DateTime requestTime = DateTime.Now;

            await next.Invoke(context);

            CollectorAccessEvent newEvent = new CollectorAccessEvent(
                ServiceConfiguration.Instance.serviceId,
                context.Request.Method,
                context.Request.Path,
                context.Request.QueryString.ToString(),
                context.Connection.RemoteIpAddress.ToString(),
                context.Connection.RemotePort,
                requestTime,
                context.Response.StatusCode,
                context.Response.ContentType,
                context.Response.ContentLength);

            messageBroker.PublishCollectorAccessEvent(newEvent);
        }
コード例 #2
0
 public void PublishCollectorAccessEvent(CollectorAccessEvent newEvent)
 {
     this.PublishEvent(newEvent,
                       this.config.collectorTopic,
                       this.config.accessEventFilter);
 }