Example #1
0
 protected override void TransformHeaders(IDictionary <string, object> headers)
 {
     foreach (KeyValuePair <string, object> entry in _headersToAdd)
     {
         string key = entry.Key;
         if (_overwrite || DictionaryUtils.Get(headers, key) == null)
         {
             DictionaryUtils.Put(headers, key, entry.Value);
         }
     }
 }
        private MethodInfo FindClosestMatch(Type payloadType)
        {
            ICollection <Type> expectedTypes = _methodMap.Keys;
            int        minTypeDiffWeight     = Int32.MaxValue;
            MethodInfo matchingMethod        = null;

            foreach (Type expectedType in expectedTypes)
            {
                int typeDiffWeight = GetTypeDifferenceWeight(expectedType, payloadType);
                if (typeDiffWeight < minTypeDiffWeight)
                {
                    minTypeDiffWeight = typeDiffWeight;
                    matchingMethod    = DictionaryUtils.Get(_methodMap, expectedType);
                }
            }
            if (matchingMethod != null)
            {
                DictionaryUtils.Put(_methodMap, payloadType, matchingMethod);
            }
            return(matchingMethod);
        }
 public void AddChannel(IMessageChannel channel)
 {
     Assert.IsNotNull(channel, "'channel' must not be null");
     Assert.IsNotNull(channel.Name, "channel name must not be null");
     DictionaryUtils.Put(channels, channel.Name, channel);
 }
 protected override void DoAddMessage(IMessage message, MessageBarrier <IDictionary <object, IMessage>, object> barrier)
 {
     DictionaryUtils.Put(barrier.Messages, message.Headers.Id, message);
 }