public void ShouldReceivedPublishedMessage()
{
using (var bus = Depot.Connect("localhost/integration"))
{
var numReceived = 0;
bus.Subscribe((HelloWorldMessage hwm) =>
Interlocked.Increment(ref numReceived),
o => o.SubscribeOn("queue-1", "queue-2")
.SetTopology(new SharedSubscriptionTopology()));
using (var first = bus.CreatePublisher<HelloWorldMessage>(o => o.PublishOn("exchange-queue-1")))
using (var second = bus.CreatePublisher<HelloWorldMessage>(o => o.PublishOn("exchange-queue-2")))
{
for (var i = 0; i < 25; ++i)
{
first.Publish(new HelloWorldMessage { Message = "subscribe!" });
second.Publish(new HelloWorldMessage { Message = "subscribe!" });
}
}
WaitForDelivery();
Assert.That(numReceived, Is.EqualTo(50));
}
}