Permalink
Browse files

fix more complex subscription discovery scenario - multiple endpoints…

… will not be Published too if the batch is mixed
  • Loading branch information...
1 parent d449495 commit 5640525422a393b4eba2f7815c8c0c0a901eadc9 mnichols committed Aug 4, 2010
Showing with 7 additions and 6 deletions.
  1. +7 −6 Rhino.ServiceBus/Impl/DefaultServiceBus.cs
@@ -351,13 +351,14 @@ private bool PublishInternal(object[] messages)
if (messages.Length == 0)
throw new MessagePublicationException("Cannot publish an empty message batch");
- IEnumerable<Uri> subscriptions=new Uri[0];
- var index = 0;
- do
+ var subscriptions = new HashSet<Uri>();
+ foreach (var message in messages)
{
- subscriptions = subscriptionStorage.GetSubscriptionsFor(messages[index++].GetType());
- } while ((messages.Length > index && subscriptions.Count() == 0));
-
+ foreach (var uri in subscriptionStorage.GetSubscriptionsFor(message.GetType()))
+ {
+ subscriptions.Add(uri);
+ }
+ }
foreach (Uri subscription in subscriptions)
{
transport.Send(endpointRouter.GetRoutedEndpoint(subscription), messages);

0 comments on commit 5640525

Please sign in to comment.