예제 #1
0
        public static bool TryToRoute(PublishedMessage sender, Subscription receiver, out MessageRoute route, out PublisherSubscriberMismatch mismatch)
        {
            route    = null;
            mismatch = null;

            var transportsMatch = (sender.Transports ?? new string[0]).Contains(receiver.Destination.Scheme);

            var contentType = SelectContentType(sender, receiver);

            if (transportsMatch && contentType.IsNotEmpty())
            {
                route = new MessageRoute(sender.DotNetType, receiver.Destination, contentType)
                {
                    Publisher = sender.ServiceName,
                    Receiver  = receiver.ServiceName
                };
                return(true);
            }

            mismatch = new PublisherSubscriberMismatch(sender, receiver)
            {
                IncompatibleTransports   = !transportsMatch,
                IncompatibleContentTypes = contentType == null
            };

            return(false);
        }
예제 #2
0
        public void ForMismatch([SelectionList("MessageTypes")] string messageType, string publisher, string subscriber)
        {
            _mismatch = _graph.Mismatches.FirstOrDefault(x =>
                                                         x.MessageType == messageType && x.Publisher == publisher && x.Subscriber == subscriber);

            StoryTellerAssert.Fail(_mismatch == null, () => $@"Could not find this mismatch, the known mismatches are:
{_graph.Mismatches.Select(x => $"* {x}{Environment.NewLine}")}

");
        }
예제 #3
0
 public void SubscriptionMismatch(PublisherSubscriberMismatch mismatch)
 {
     foreach (var sink in Loggers)
     {
         try
         {
             sink.SubscriptionMismatch(mismatch);
         }
         catch (Exception)
         {
         }
     }
 }
예제 #4
0
 public void SubscriptionMismatch(PublisherSubscriberMismatch mismatch)
 {
 }
예제 #5
0
 public void SubscriptionMismatch(PublisherSubscriberMismatch mismatch)
 {
     ConsoleWriter.Write(ConsoleColor.Yellow, $"Subscriber mismatch: {mismatch}");
 }
예제 #6
0
 public virtual void SubscriptionMismatch(PublisherSubscriberMismatch mismatch)
 {
     _subscriptionMismatch(_logger, mismatch, null);
 }
예제 #7
0
 public void SubscriptionMismatch(PublisherSubscriberMismatch mismatch)
 {
     trace($"Subscription mismatch: {mismatch}");
 }
예제 #8
0
 public override void SubscriptionMismatch(PublisherSubscriberMismatch mismatch)
 {
     _mismatches.Add(mismatch);
     base.SubscriptionMismatch(mismatch);
 }
예제 #9
0
 public void SubscriptionMismatch(PublisherSubscriberMismatch mismatch)
 {
     _mismatches.Add(mismatch);
 }