/// <summary> /// Registers components of a <see cref="RabbitBus"/>. /// </summary> /// <param name="serviceRegister"/> /// <param name="connectionConfigurationFactory"> /// A factory of <see cref="ConnectionConfiguration"/> instance. /// </param> /// <param name="registerServices"> /// Override default services. For example, to override the default <see cref="ISerializer"/>: /// RabbitHutch.CreateBus("host=localhost", x => x.Register{ISerializer}(mySerializer)); /// </param> /// <returns> /// A new <see cref="RabbitBus"/> instance. /// </returns> public static void RegisterBus(IServiceRegister serviceRegister, Func <IServiceResolver, ConnectionConfiguration> connectionConfigurationFactory, Action <IServiceRegister> registerServices) { Preconditions.CheckNotNull(serviceRegister, "serviceRegister"); Preconditions.CheckNotNull(connectionConfigurationFactory, "connectionConfiguration"); Preconditions.CheckNotNull(registerServices, "registerServices"); serviceRegister.Register(c => { var connectionConfiguration = connectionConfigurationFactory.Invoke(c); connectionConfiguration.Validate(); return(connectionConfiguration); }); serviceRegister.RegisterDefaultServices(); registerServices(serviceRegister); }