public void SetUp() { this.context = new Context(); this.registry = new HandlerRegistrySimulator(this.context); this.broker = new Broker(); this.sender = new MessageUnit(new EndpointConfiguration().Endpoint("Sender").Concurrency(1)) .Use(new AlwaysRouteToDestination(Queue.Create("Receiver"))) .Use(this.registry); this.broker.Register(this.sender); this.broker.Start(); }
public IReadOnlyCollection <Address> GetDestinationFor(Type messageType) { if (messageType == typeof(MessageForReceiverOne)) { return(this.To(Queue.Create(ReceiverOneEndpointName))); } if (messageType == typeof(MessageForReceiverTwo)) { return(this.To(Queue.Create(ReceiverTwoEndpointName))); } return(this.NoDestination()); }
public void SetUp() { this.context = new Context(); this.registry = new HandlerRegistrySimulator(this.context); this.sender = new MessageUnit(new EndpointConfiguration().Endpoint(SenderEndpointName).Concurrency(1)) .Use(MessagingFactory.Create()) .Use(new AlwaysRouteToDestination(Queue.Create(ReceiverEndpointName))) .Use(this.registry); this.SetUpNecessaryInfrastructure(); this.sender.StartAsync().Wait(); }
public void SetUp() { this.registry = new HandlerRegistrySimulator(); this.broker = new Broker(); this.sender = new MessageUnit(new EndpointConfiguration().Endpoint("Sender").Concurrency(1)) .Use(new AlwaysRouteToDestination(Queue.Create("Receiver"))); this.receiver = new MessageUnit(new EndpointConfiguration().Endpoint("Receiver") .Concurrency(1).MaximumImmediateRetryCount(MaxImmediateRetryCount).MaximumDelayedRetryCount(MaxDelayedRetryCount)).Use(this.registry); this.broker.Register(this.sender) .Register(this.receiver); this.broker.Start(); }
public async Task WhenSendingMessages_WithSpecificSendDestination_MessagesAreRoutedByUserInput() { var sendOptions = new SendOptions { Queue = Queue.Create(ReceiverThreeEndpointName) }; await this.sender.Send(new MessageForReceiverThree { Bar = 42 }, sendOptions); this.context.AsyncReceiverOneCalled.Should().NotBeInvoked(); this.context.SyncReceiverOneCalled.Should().NotBeInvoked(); this.context.AsyncReceiverTwoCalled.Should().NotBeInvoked(); this.context.SyncReceiverTwoCalled.Should().NotBeInvoked(); this.context.AsyncReceiverThreeCalled.Should().BeInvokedOnce(); this.context.SyncReceiverThreeCalled.Should().BeInvokedOnce(); }
public EndpointConfiguration Endpoint([NotNull] string endpointName) { this.EndpointQueue = Queue.Create(endpointName); return(this); }