public void Can_create_a_single_exchange_and_queue_and_send_a_simple_message() { router.AddSource("exchange_A", null); router.AddDestination("queue_A"); router.Link("exchange_A", "queue_A"); router.Send("exchange_A", null, null, null, "Hello, world"); var message = router.GetAndFinish("queue_A", out _); Assert.That(message, Is.EqualTo("Hello, world")); }
public void If_I_make_a_link_twice_I_only_get_one_copy_of_each_message() { router.AddSource("src", null); router.AddDestination("dst"); router.Link("src", "dst"); router.Link("src", "dst"); router.Send("src", null, null, null, "Hello"); Assert.That(router.GetAndFinish("dst", out _), Is.EqualTo("Hello")); Assert.That(router.GetAndFinish("dst", out _), Is.Null); }
public void When_sending_a_message_with_mulitple_inheritance_should_receive_one_copy_at_base_level() { subject.BuildRoutes(typeof(IFile)); router.AddDestination("dst"); router.Link("Example.Types.IMsg", "dst"); router.Send("Example.Types.IFile", null, null, null, "Hello"); Assert.That(router.GetAndFinish("dst", out _), Is.EqualTo("Hello")); Assert.That(router.GetAndFinish("dst", out _), Is.Null); }
public void SetUp() { var longTermConnection = ConfigurationHelpers.ChannelWithAppConfigSettings(); var shortTermConnection = ConfigurationHelpers.FreshConnectionFromAppConfig(); subject = new RabbitRouter(longTermConnection, shortTermConnection); typeRouter = new TypeRouter(subject); typeRouter.BuildRoutes(typeof(IFile)); subject.AddDestination("dst"); subject.Link("Example.Types.IMsg", "dst"); subject.Send("Example.Types.IFile", "Hello"); }
public void SetUp() { var longTermConnection = ConfigurationHelpers.ChannelWithAppConfigSettings(); var shortTermConnection = ConfigurationHelpers.FreshConnectionFromAppConfig(); subject = new RabbitRouter(longTermConnection, shortTermConnection); typeRouter = new TypeRouter(subject); typeRouter.BuildRoutes(typeof(IFile)); subject.AddDestination("dst"); subject.Link("Example.Types.IMsg", "dst"); subject.Send("Example.Types.IFile", null, null, null, "Hello"); }
/// <summary> /// Ensure a destination exists, and bind it to the exchanges for the given type /// </summary> public void CreateDestination([NotNull] Type sourceType, [NotNull] string destinationName, [NotNull] Expires messageExpiry) { RouteSource(sourceType); if (messageExpiry.Milliseconds > 0) { messageRouter.AddLimitedDestination(destinationName, messageExpiry); } else { messageRouter.AddDestination(destinationName); } messageRouter.Link(sourceType.FullName, destinationName); }