public RequestResponseInvocationForMessagesBehavior(RequestResponseStateLookup requestResponseStateLookup)
 {
     this.requestResponseStateLookup = requestResponseStateLookup;
 }
 public UpdateRequestResponseCorrelationTableBehavior(RequestResponseStateLookup lookup)
 {
     this.lookup = lookup;
 }
Exemple #3
0
        public static RequestResponseStateLookup.State?TryRemoveResponseStateBasedOnCorrelationId(this IIncomingContext context, IncomingMessage message, RequestResponseStateLookup lookup)
        {
            var correlationId = context.GetCorrelationId();

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

            string version;
            var    checkMessageIntent = true;

            if (message.Headers.TryGetValue(Headers.NServiceBusVersion, out version))
            {
                Version parsedVersion;
                if (Version.TryParse(version, out parsedVersion))
                {
                    if (parsedVersion < minimumVersionThatSupportMessageIntent_Reply)
                    {
                        checkMessageIntent = false;
                    }
                }
            }

            var messageIntentEnum = message.GetMessageIntent();

            if (checkMessageIntent && messageIntentEnum != MessageIntentEnum.Reply)
            {
                return(null);
            }

            RequestResponseStateLookup.State state;
            return(lookup.TryRemove(correlationId, out state) ? (RequestResponseStateLookup.State?)state : null);
        }
 public Registration(RequestResponseStateLookup lookup)
     : base("UpdateRequestResponseCorrelationTable", typeof(UpdateRequestResponseCorrelationTableBehavior), "Updates the correlation table that keeps track of synchronous request/response callbacks", b => new UpdateRequestResponseCorrelationTableBehavior(lookup))
 {
     InsertAfterIfExists("MutateOutgoingTransportMessage");
 }