コード例 #1
0
        /// <summary>
        /// Execute MQ with requestContext
        /// </summary>
        public object ExecuteMessage(IMessage dto, IRequest req)
        {
            req.Dto = appHost.ApplyRequestConverters(req, dto.Body);
            if (appHost.ApplyMessageRequestFilters(req, req.Response, dto.Body))
            {
                return(req.Response.Dto);
            }

            var response = Execute(dto.Body, req);

            var taskResponse = response as Task;

            if (taskResponse != null)
            {
                response = taskResponse.GetResult();
            }

            response = appHost.ApplyResponseConverters(req, response);

            if (appHost.ApplyMessageResponseFilters(req, req.Response, response))
            {
                response = req.Response.Dto;
            }

            req.Response.EndMqRequest();

            return(response);
        }
コード例 #2
0
        /// <summary>
        /// Execute MQ with requestContext
        /// </summary>
        public object ExecuteMessage(IMessage message, IRequest req)
        {
            RequestContext.Instance.StartRequestContext();

            req.PopulateFromRequestIfHasSessionId(message.Body);

            req.Dto = AppHost.ApplyRequestConvertersAsync(req, message.Body).Result;
            if (AppHost.ApplyMessageRequestFilters(req, req.Response, message.Body))
            {
                return(req.Response.Dto);
            }

            var response = Execute(message.Body, req);

            if (response is Task taskResponse)
            {
                response = taskResponse.GetResult();
            }

            response = AppHost.ApplyResponseConvertersAsync(req, response).Result;

            if (AppHost.ApplyMessageResponseFilters(req, req.Response, response))
            {
                response = req.Response.Dto;
            }

            req.Response.EndMqRequest();

            return(response);
        }
コード例 #3
0
        /// <summary>
        /// Execute MQ with requestContext
        /// </summary>
        public object ExecuteMessage(IMessage dto, IRequest req)
        {
            req.Dto = appHost.ApplyRequestConverters(req, dto.Body);
            if (appHost.ApplyMessageRequestFilters(req, req.Response, dto.Body))
            {
                return(req.Response.Dto);
            }

            var response = Execute(dto.Body, req);

            response = ApplyResponseFilters(response, req);

            req.Response.EndMqRequest();

            return(response);
        }