Ejemplo n.º 1
0
        public void ShouldSubscribeToMessageInterfacesWithCustomMessageFactory()
        {
            var serializer = new JsonMessageSerializer(
                new CastleMessageTypeFactory());

            var depotSettings = new DepotSettings();

            depotSettings.MessageSerializers.Register(serializer);

            using (var bus = Depot.Connect("localhost/integration", depotSettings))
            {
                IHelloWorldMessage lastReceived = null;
                bus.Subscribe((IHelloWorldMessage hwm) =>
                {
                    lastReceived = hwm;
                });
                bus.Publish(new HelloWorldMessage {
                    Message = "subscribe!"
                });

                WaitForDelivery();

                Assert.That(lastReceived, Is.Not.Null);
                Assert.That(lastReceived.Message, Is.EqualTo("subscribe!"));

                Assert.That(admin.Exists(IntegrationVHost, new Queue("HelloWorldMessage")), "did not create queue");
                Assert.That(admin.Exists(IntegrationVHost, new Exchange("HelloWorldMessage")), "did not create exchange");
            }
        }
Ejemplo n.º 2
0
        public void ShouldSubscribeToMessageInterfaces()
        {
            using (var bus = Depot.Connect("localhost/integration"))
            {
                IHelloWorldMessage lastReceived = null;
                bus.Subscribe((IHelloWorldMessage hwm) =>
                {
                    lastReceived = hwm;
                });
                bus.Publish(new HelloWorldMessage {
                    Message = "subscribe!"
                });

                WaitForDelivery();

                Assert.That(lastReceived, Is.Not.Null);
                Assert.That(lastReceived.Message, Is.EqualTo("subscribe!"));

                Assert.That(admin.Exists(IntegrationVHost, new Queue("HelloWorldMessage")), "did not create queue");
                Assert.That(admin.Exists(IntegrationVHost, new Exchange("HelloWorldMessage")), "did not create exchange");
            }
        }
Ejemplo n.º 3
0
 public HelloWorldShouter(IHelloWorldMessage message)
 {
     this.Message = message;
 }
Ejemplo n.º 4
0
 public HelloWorldController(IHelloWorldMessage helloWorldMsg)
 {
     this.helloWorldMsg = helloWorldMsg;
 }