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"); } }
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"); } }
public HelloWorldShouter(IHelloWorldMessage message) { this.Message = message; }
public HelloWorldController(IHelloWorldMessage helloWorldMsg) { this.helloWorldMsg = helloWorldMsg; }