public NsbBus Create(BusProperties properties) { if (properties.TransportType == TransportType.RabbitMq) { return CreateAmqp(properties); } return CreateMsmq(properties); }
NsbBus CreateAmqp(BusProperties properties) { var types = _container.Handlers(). Union(_container.Finders()). Union(_container.Sagas()). Union(_registerer.MessageTypes). Union(properties.AdditionalTypes).ToList(); var configure = Configure .With(types) .MachineBuilder(_container) .CustomizedXmlSerializer() .AmqpTransport() .On(properties.ListenAddress.ToString(), properties.PoisonAddress.ToString()) .Sagas() .CustomizedUnicastBus() .LoadMessageHandlers(First<GridInterceptingMessageHandler>.Then<SagaMessageHandler>()) .WithMessageRoutes(_messageRouting); return Add(configure.CreateBus()); }
public IMessageBus AddMessageBus(BusProperties properties) { var bus = _messageBusFactory.Create(properties); return new NServiceBusMessageBus(_routing, bus); }