Beispiel #1
0
        /// <inheritdoc />
        public async Task <HttpContext> Parse(ConsumeResult <byte[], byte[]> request, FeatureCollection features)
        {
            var context = await _creator.Create(request.Message.Value, features, !_options.ForceResponseStream);

            if (context == null)
            {
                return(null);
            }

            if (context.Request.Headers.TryGetValue(QueueHeaders.ReplyTo, out var replyValues))
            {
                if (string.IsNullOrWhiteSpace(replyValues))
                {
                    _log.LogError($"Request to uri {context.Request.GetDisplayUrl()} header {QueueHeaders.ReplyTo} is set but value cannot be empty. Response not be sent");
                }
                else
                {
                    _log.LogTrace("create memory stream response");
                    if (!(context.Response.Body is MemoryStream))
                    {
                        context.Response.Body = new MemoryStream();
                    }
                }
            }

            return(context);
        }
Beispiel #2
0
        public async Task <HttpContext> Parse(MsgHandlerEventArgs args, IFeatureCollection features)
        {
            var context = await _converter.Create(args.Message.Data, features, !_option.ForceResponseStream && args.Message.Reply == null);

            return(context);
        }