Beispiel #1
0
        public async Task Process(IncomingStepContext context, Func <Task> next)
        {
            var message = context.Load <Message>();

            string correlationId;

            var hasCorrelationId = message.Headers.TryGetValue(Headers.CorrelationId, out correlationId);

            if (hasCorrelationId)
            {
                var isRequestReplyCorrelationId = correlationId.StartsWith(SpecialCorrelationIdPrefix);
                if (isRequestReplyCorrelationId)
                {
                    var isRequest = message.Headers.ContainsKey(SpecialRequestTag);
                    if (!isRequest)
                    {
                        // it's the reply!
                        _messages[correlationId] = new TimedMessage(message);
                        return;
                    }
                }
            }

            await next();
        }
Beispiel #2
0
        public async Task Process(IncomingStepContext context, Func <Task> next)
        {
            var message = context.Load <Message>();

            var hasInReplyToHeader = message.Headers.TryGetValue(Headers.InReplyTo, out var inReplyToMessageId);

            if (hasInReplyToHeader)
            {
                var isRequestReplyCorrelationId = inReplyToMessageId.StartsWith(SpecialMessageIdPrefix);
                if (isRequestReplyCorrelationId)
                {
                    // it's the reply!
                    _messages[inReplyToMessageId] = new TimedMessage(message);
                    return;
                }
            }

            await next();
        }
Beispiel #3
0
        public async Task Process(IncomingStepContext context, Func<Task> next)
        {
            var message = context.Load<Message>();

            string correlationId;

            var hasCorrelationId = message.Headers.TryGetValue(Headers.CorrelationId, out correlationId);
            if (hasCorrelationId)
            {
                var isRequestReplyCorrelationId = correlationId.StartsWith(SpecialCorrelationIdPrefix);
                if (isRequestReplyCorrelationId)
                {
                    var isRequest = message.Headers.ContainsKey(SpecialRequestTag);
                    if (!isRequest)
                    {
                        // it's the reply!
                        _messages[correlationId] = new TimedMessage(message);
                        return;
                    }
                }
            }

            await next();
        }