private static AdvancedBusEventHandlers DefineBusHandler() { var handler = new AdvancedBusEventHandlers( connected: (s, e) => { }, disconnected: (s, e) => { }, messageReturned: (s, e) => { }, unblocked: (s, e) => { }, blocked: (s, e) => { }); return handler; }
/// <summary> /// Creates a new instance of <see cref="RabbitBus"/>. /// </summary> /// <param name="hostName"> /// The RabbitMQ broker. /// </param> /// <param name="hostPort"> /// The RabbitMQ broker port. /// </param> /// <param name="virtualHost"> /// The RabbitMQ virtualHost. /// </param> /// <param name="username"> /// The username to use to connect to the RabbitMQ broker. /// </param> /// <param name="password"> /// The password to use to connect to the RabbitMQ broker. /// </param> /// <param name="requestedHeartbeat"> /// The initially requested heartbeat interval, in seconds; zero for none. /// </param> /// <param name="advancedBusEventHandlers"> /// An <see cref="AdvancedBusEventHandlers"/> instance which is used to add handlers /// to the events of the newly created <see cref="IBus.Advanced"/>. /// As <see cref="RabbitAdvancedBus"/> attempts to connect during instantiation, specifying a <see cref="AdvancedBusEventHandlers"/> /// before instantiation is the only way to catch the first <see cref="AdvancedBusEventHandlers.Connected"/> event. /// </param> /// <param name="registerServices"> /// Override default services. For example, to override the default <see cref="IEasyNetQLogger"/>: /// RabbitHutch.CreateBus("host=localhost", x => x.Register{IEasyNetQLogger}(_ => myLogger)); /// </param> /// <returns> /// A new <see cref="RabbitBus"/> instance. /// </returns> public static IBus CreateBus( string hostName, ushort hostPort, string virtualHost, string username, string password, ushort requestedHeartbeat, AdvancedBusEventHandlers advancedBusEventHandlers, Action <IServiceRegister> registerServices) { Preconditions.CheckNotNull(hostName, "hostName"); Preconditions.CheckNotNull(virtualHost, "virtualHost"); Preconditions.CheckNotNull(username, "username"); Preconditions.CheckNotNull(password, "password"); Preconditions.CheckNotNull(advancedBusEventHandlers, "advancedBusEventHandlers"); Preconditions.CheckNotNull(registerServices, "registerServices"); var connectionConfiguration = new ConnectionConfiguration { Hosts = new List <HostConfiguration> { new HostConfiguration { Host = hostName, Port = hostPort } }, Port = hostPort, VirtualHost = virtualHost, UserName = username, Password = password, RequestedHeartbeat = requestedHeartbeat }; return(CreateBus(connectionConfiguration, advancedBusEventHandlers, registerServices)); }
/// <summary> /// Creates a new instance of <see cref="RabbitBus"/>. /// </summary> /// <param name="connectionString"> /// The EasyNetQ connection string. Example: /// host=192.168.1.1;port=5672;virtualHost=MyVirtualHost;username=MyUsername;password=MyPassword;requestedHeartbeat=10 /// /// The following default values will be used if not specified: /// host=localhost;port=5672;virtualHost=/;username=guest;password=guest;requestedHeartbeat=10 /// </param> /// <param name="advancedBusEventHandlers"> /// An <see cref="AdvancedBusEventHandlers"/> instance which is used to add handlers /// to the events of the newly created <see cref="IBus.Advanced"/>. /// As <see cref="RabbitAdvancedBus"/> attempts to connect during instantiation, specifying a <see cref="AdvancedBusEventHandlers"/> /// before instantiation is the only way to catch the first <see cref="AdvancedBusEventHandlers.Connected"/> event. /// </param> /// <returns> /// A new <see cref="RabbitBus"/> instance. /// </returns> public static IBus CreateBus(string connectionString, AdvancedBusEventHandlers advancedBusEventHandlers) { Preconditions.CheckNotNull(connectionString, "connectionString"); Preconditions.CheckNotNull(advancedBusEventHandlers, "advancedBusEventHandlers"); return(CreateBus(connectionString, advancedBusEventHandlers, x => { })); }
/// <summary> /// Creates a new instance of <see cref="RabbitBus"/>. /// </summary> /// <param name="connectionString"> /// The EasyNetQ connection string. Example: /// host=192.168.1.1;port=5672;virtualHost=MyVirtualHost;username=MyUsername;password=MyPassword;requestedHeartbeat=10 /// /// The following default values will be used if not specified: /// host=localhost;port=5672;virtualHost=/;username=guest;password=guest;requestedHeartbeat=10 /// </param> /// <param name="advancedBusEventHandlers"> /// An <see cref="AdvancedBusEventHandlers"/> instance which is used to add handlers /// to the events of the newly created <see cref="IBus.Advanced"/>. /// As <see cref="RabbitAdvancedBus"/> attempts to connect during instantiation, specifying a <see cref="AdvancedBusEventHandlers"/> /// before instantiation is the only way to catch the first <see cref="AdvancedBusEventHandlers.Connected"/> event. /// </param> /// <param name="registerServices"> /// Override default services. For example, to override the default <see cref="IEasyNetQLogger"/>: /// RabbitHutch.CreateBus("host=localhost", x => x.Register{IEasyNetQLogger}(_ => myLogger)); /// </param> /// <returns> /// A new <see cref="RabbitBus"/> instance. /// </returns> public static IBus CreateBus(string connectionString, AdvancedBusEventHandlers advancedBusEventHandlers, Action <IServiceRegister> registerServices) { Preconditions.CheckNotNull(connectionString, "connectionString"); Preconditions.CheckNotNull(registerServices, "registerServices"); Preconditions.CheckNotNull(advancedBusEventHandlers, "advancedBusEventHandlers"); var connectionStringParser = new ConnectionStringParser(); var connectionConfiguration = connectionStringParser.Parse(connectionString); return(CreateBus(connectionConfiguration, advancedBusEventHandlers, registerServices)); }
/// <summary> /// Creates a new instance of <see cref="RabbitBus"/>. /// The RabbitMQ broker is defined in the connection string named 'rabbit'. /// </summary> /// <param name="advancedBusEventHandlers"> /// An <see cref="AdvancedBusEventHandlers"/> instance which is used to add handlers /// to the events of the newly created <see cref="IBus.Advanced"/>. /// As <see cref="RabbitAdvancedBus"/> attempts to connect during instantiation, specifying a <see cref="AdvancedBusEventHandlers"/> /// before instantiation is the only way to catch the first <see cref="AdvancedBusEventHandlers.Connected"/> event. /// </param> /// <param name="registerServices"> /// Override default services. For example, to override the default <see cref="IEasyNetQLogger"/>: /// RabbitHutch.CreateBus("host=localhost", x => x.Register{IEasyNetQLogger}(_ => myLogger)); /// </param> /// <returns> /// A new <see cref="RabbitBus"/> instance. /// </returns> public static IBus CreateBus(AdvancedBusEventHandlers advancedBusEventHandlers, Action<IServiceRegister> registerServices) { var rabbitConnectionString = ConfigurationManager.ConnectionStrings["rabbit"]; if (rabbitConnectionString == null) { throw new EasyNetQException( "Could not find a connection string for RabbitMQ. " + "Please add a connection string in the <ConnectionStrings> section" + "of the application's configuration file. For example: " + "<add name=\"rabbit\" connectionString=\"host=localhost\" />"); } return CreateBus(rabbitConnectionString.ConnectionString, advancedBusEventHandlers, registerServices); }
/// <summary> /// Creates a new instance of <see cref="RabbitBus"/>. /// The RabbitMQ broker is defined in the connection string named 'rabbit'. /// </summary> /// <param name="advancedBusEventHandlers"> /// An <see cref="AdvancedBusEventHandlers"/> instance which is used to add handlers /// to the events of the newly created <see cref="IBus.Advanced"/>. /// As <see cref="RabbitAdvancedBus"/> attempts to connect during instantiation, specifying a <see cref="AdvancedBusEventHandlers"/> /// before instantiation is the only way to catch the first <see cref="AdvancedBusEventHandlers.Connected"/> event. /// </param> /// <param name="registerServices"> /// Override default services. For example, to override the default <see cref="IEasyNetQLogger"/>: /// RabbitHutch.CreateBus("host=localhost", x => x.Register{IEasyNetQLogger}(_ => myLogger)); /// </param> /// <returns> /// A new <see cref="RabbitBus"/> instance. /// </returns> public static IBus CreateBus(AdvancedBusEventHandlers advancedBusEventHandlers, Action <IServiceRegister> registerServices) { var rabbitConnectionString = ConfigurationManager.ConnectionStrings["rabbit"]; if (rabbitConnectionString == null) { throw new EasyNetQException( "Could not find a connection string for RabbitMQ. " + "Please add a connection string in the <ConnectionStrings> section" + "of the application's configuration file. For example: " + "<add name=\"rabbit\" connectionString=\"host=localhost\" />"); } return(CreateBus(rabbitConnectionString.ConnectionString, advancedBusEventHandlers, registerServices)); }
public RabbitAdvancedBus( IConnectionFactory connectionFactory, IConsumerFactory consumerFactory, IEasyNetQLogger logger, IClientCommandDispatcherFactory clientCommandDispatcherFactory, IPublishConfirmationListener confirmationListener, IEventBus eventBus, IHandlerCollectionFactory handlerCollectionFactory, IContainer container, ConnectionConfiguration connectionConfiguration, IProduceConsumeInterceptor produceConsumeInterceptor, IMessageSerializationStrategy messageSerializationStrategy, IConventions conventions, AdvancedBusEventHandlers advancedBusEventHandlers, IPersistentConnectionFactory persistentConnectionFactory) { Preconditions.CheckNotNull(connectionFactory, "connectionFactory"); Preconditions.CheckNotNull(consumerFactory, "consumerFactory"); Preconditions.CheckNotNull(logger, "logger"); Preconditions.CheckNotNull(eventBus, "eventBus"); Preconditions.CheckNotNull(handlerCollectionFactory, "handlerCollectionFactory"); Preconditions.CheckNotNull(container, "container"); Preconditions.CheckNotNull(messageSerializationStrategy, "messageSerializationStrategy"); Preconditions.CheckNotNull(connectionConfiguration, "connectionConfiguration"); Preconditions.CheckNotNull(produceConsumeInterceptor, "produceConsumeInterceptor"); Preconditions.CheckNotNull(conventions, "conventions"); Preconditions.CheckNotNull(advancedBusEventHandlers, "advancedBusEventHandlers"); Preconditions.CheckNotNull(persistentConnectionFactory, "persistentConnectionFactory"); this.consumerFactory = consumerFactory; this.logger = logger; this.confirmationListener = confirmationListener; this.eventBus = eventBus; this.handlerCollectionFactory = handlerCollectionFactory; this.container = container; this.connectionConfiguration = connectionConfiguration; this.produceConsumeInterceptor = produceConsumeInterceptor; this.messageSerializationStrategy = messageSerializationStrategy; this.conventions = conventions; this.eventBus.Subscribe <ConnectionCreatedEvent>(e => OnConnected()); if (advancedBusEventHandlers.Connected != null) { Connected += advancedBusEventHandlers.Connected; } this.eventBus.Subscribe <ConnectionDisconnectedEvent>(e => OnDisconnected()); if (advancedBusEventHandlers.Disconnected != null) { Disconnected += advancedBusEventHandlers.Disconnected; } this.eventBus.Subscribe <ConnectionBlockedEvent>(OnBlocked); if (advancedBusEventHandlers.Blocked != null) { Blocked += advancedBusEventHandlers.Blocked; } this.eventBus.Subscribe <ConnectionUnblockedEvent>(e => OnUnblocked()); if (advancedBusEventHandlers.Unblocked != null) { Unblocked += advancedBusEventHandlers.Unblocked; } this.eventBus.Subscribe <ReturnedMessageEvent>(OnMessageReturned); if (advancedBusEventHandlers.MessageReturned != null) { MessageReturned += advancedBusEventHandlers.MessageReturned; } connection = persistentConnectionFactory.CreateConnection(); clientCommandDispatcher = clientCommandDispatcherFactory.GetClientCommandDispatcher(connection); connection.Initialize(); }
/// <summary> /// Creates RabbitAdvancedBus /// </summary> public RabbitAdvancedBus( IPersistentConnection connection, IConsumerFactory consumerFactory, IClientCommandDispatcher clientCommandDispatcher, IPublishConfirmationListener confirmationListener, IEventBus eventBus, IHandlerCollectionFactory handlerCollectionFactory, IServiceResolver container, ConnectionConfiguration configuration, IProduceConsumeInterceptor produceConsumeInterceptor, IMessageSerializationStrategy messageSerializationStrategy, IConventions conventions, IPullingConsumerFactory pullingConsumerFactory, AdvancedBusEventHandlers advancedBusEventHandlers ) { Preconditions.CheckNotNull(connection, "connection"); Preconditions.CheckNotNull(consumerFactory, "consumerFactory"); Preconditions.CheckNotNull(eventBus, "eventBus"); Preconditions.CheckNotNull(handlerCollectionFactory, "handlerCollectionFactory"); Preconditions.CheckNotNull(container, "container"); Preconditions.CheckNotNull(messageSerializationStrategy, "messageSerializationStrategy"); Preconditions.CheckNotNull(configuration, "configuration"); Preconditions.CheckNotNull(produceConsumeInterceptor, "produceConsumeInterceptor"); Preconditions.CheckNotNull(conventions, "conventions"); Preconditions.CheckNotNull(pullingConsumerFactory, "pullingConsumerFactory"); Preconditions.CheckNotNull(advancedBusEventHandlers, "advancedBusEventHandlers"); this.connection = connection; this.consumerFactory = consumerFactory; this.clientCommandDispatcher = clientCommandDispatcher; this.confirmationListener = confirmationListener; this.eventBus = eventBus; this.handlerCollectionFactory = handlerCollectionFactory; this.Container = container; this.configuration = configuration; this.produceConsumeInterceptor = produceConsumeInterceptor; this.messageSerializationStrategy = messageSerializationStrategy; this.pullingConsumerFactory = pullingConsumerFactory; this.Conventions = conventions; if (advancedBusEventHandlers.Connected != null) { Connected += advancedBusEventHandlers.Connected; } if (advancedBusEventHandlers.Disconnected != null) { Disconnected += advancedBusEventHandlers.Disconnected; } if (advancedBusEventHandlers.Blocked != null) { Blocked += advancedBusEventHandlers.Blocked; } if (advancedBusEventHandlers.Unblocked != null) { Unblocked += advancedBusEventHandlers.Unblocked; } if (advancedBusEventHandlers.MessageReturned != null) { MessageReturned += advancedBusEventHandlers.MessageReturned; } eventSubscriptions = new[] { this.eventBus.Subscribe <ConnectionCreatedEvent>(OnConnectionCreated), this.eventBus.Subscribe <ConnectionRecoveredEvent>(OnConnectionRecovered), this.eventBus.Subscribe <ConnectionDisconnectedEvent>(OnConnectionDisconnected), this.eventBus.Subscribe <ConnectionBlockedEvent>(OnConnectionBlocked), this.eventBus.Subscribe <ConnectionUnblockedEvent>(OnConnectionUnblocked), this.eventBus.Subscribe <ReturnedMessageEvent>(OnMessageReturned), }; }
/// <summary> /// Creates a new instance of <see cref="RabbitBus"/>. /// </summary> /// <param name="connectionConfiguration"> /// An <see cref="ConnectionConfiguration"/> instance. /// </param> /// <param name="advancedBusEventHandlers"> /// An <see cref="AdvancedBusEventHandlers"/> instance which is used to add handlers /// to the events of the newly created <see cref="IBus.Advanced"/>. /// As <see cref="RabbitAdvancedBus"/> attempts to connect during instantiation, specifying a <see cref="AdvancedBusEventHandlers"/> /// before instantiation is the only way to catch the first <see cref="AdvancedBusEventHandlers.Connected"/> event. /// </param> /// <param name="registerServices"> /// Override default services. For example, to override the default <see cref="IEasyNetQLogger"/>: /// RabbitHutch.CreateBus("host=localhost", x => x.Register{IEasyNetQLogger}(_ => myLogger)); /// </param> /// <returns> /// A new <see cref="RabbitBus"/> instance. /// </returns> public static IBus CreateBus(ConnectionConfiguration connectionConfiguration, AdvancedBusEventHandlers advancedBusEventHandlers, Action <IServiceRegister> registerServices) { Preconditions.CheckNotNull(connectionConfiguration, "connectionConfiguration"); Preconditions.CheckNotNull(advancedBusEventHandlers, "advancedBusEventHandlers"); Preconditions.CheckNotNull(registerServices, "registerServices"); var container = createContainerInternal(); if (container == null) { throw new EasyNetQException("Could not create container. " + "Have you called SetContainerFactory(...) with a function that returns null?"); } connectionConfiguration.Validate(); container.Register(_ => connectionConfiguration); container.Register(_ => advancedBusEventHandlers); registerServices(container); ComponentRegistration.RegisterServices(container); return(container.Resolve <IBus>()); }
/// <summary> /// Creates a new instance of <see cref="RabbitBus"/>. /// The RabbitMQ broker is defined in the connection string named 'rabbit'. /// </summary> /// <param name="advancedBusEventHandlers"> /// An <see cref="AdvancedBusEventHandlers"/> instance which is used to add handlers /// to the events of the newly created <see cref="IBus.Advanced"/>. /// As <see cref="RabbitAdvancedBus"/> attempts to connect during instantiation, specifying a <see cref="AdvancedBusEventHandlers"/> /// before instantiation is the only way to catch the first <see cref="AdvancedBusEventHandlers.Connected"/> event. /// </param> /// <returns> /// A new <see cref="RabbitBus"/> instance. /// </returns> public static IBus CreateBus(AdvancedBusEventHandlers advancedBusEventHandlers) { return(CreateBus(advancedBusEventHandlers, c => {})); }
/// <summary> /// Creates a new instance of <see cref="RabbitBus"/>. /// </summary> /// <param name="connectionConfiguration"> /// An <see cref="ConnectionConfiguration"/> instance. /// </param> /// <param name="advancedBusEventHandlers"> /// An <see cref="AdvancedBusEventHandlers"/> instance which is used to add handlers /// to the events of the newly created <see cref="IBus.Advanced"/>. /// As <see cref="RabbitAdvancedBus"/> attempts to connect during instantiation, specifying a <see cref="AdvancedBusEventHandlers"/> /// before instantiation is the only way to catch the first <see cref="AdvancedBusEventHandlers.Connected"/> event. /// </param> /// <param name="registerServices"> /// Override default services. For example, to override the default <see cref="IEasyNetQLogger"/>: /// RabbitHutch.CreateBus("host=localhost", x => x.Register{IEasyNetQLogger}(_ => myLogger)); /// </param> /// <returns> /// A new <see cref="RabbitBus"/> instance. /// </returns> public static IBus CreateBus(ConnectionConfiguration connectionConfiguration, AdvancedBusEventHandlers advancedBusEventHandlers, Action<IServiceRegister> registerServices) { Preconditions.CheckNotNull(connectionConfiguration, "connectionConfiguration"); Preconditions.CheckNotNull(advancedBusEventHandlers, "advancedBusEventHandlers"); Preconditions.CheckNotNull(registerServices, "registerServices"); var container = createContainerInternal(); if (container == null) { throw new EasyNetQException("Could not create container. " + "Have you called SetContainerFactory(...) with a function that returns null?"); } connectionConfiguration.Validate(); container.Register(_ => connectionConfiguration); container.Register(_ => advancedBusEventHandlers); registerServices(container); ComponentRegistration.RegisterServices(container); return container.Resolve<IBus>(); }
/// <summary> /// Creates a new instance of <see cref="RabbitBus"/>. /// </summary> /// <param name="hostName"> /// The RabbitMQ broker. /// </param> /// <param name="hostPort"> /// The RabbitMQ broker port. /// </param> /// <param name="virtualHost"> /// The RabbitMQ virtualHost. /// </param> /// <param name="username"> /// The username to use to connect to the RabbitMQ broker. /// </param> /// <param name="password"> /// The password to use to connect to the RabbitMQ broker. /// </param> /// <param name="requestedHeartbeat"> /// The initially requested heartbeat interval, in seconds; zero for none. /// </param> /// <param name="advancedBusEventHandlers"> /// An <see cref="AdvancedBusEventHandlers"/> instance which is used to add handlers /// to the events of the newly created <see cref="IBus.Advanced"/>. /// As <see cref="RabbitAdvancedBus"/> attempts to connect during instantiation, specifying a <see cref="AdvancedBusEventHandlers"/> /// before instantiation is the only way to catch the first <see cref="AdvancedBusEventHandlers.Connected"/> event. /// </param> /// <param name="registerServices"> /// Override default services. For example, to override the default <see cref="IEasyNetQLogger"/>: /// RabbitHutch.CreateBus("host=localhost", x => x.Register{IEasyNetQLogger}(_ => myLogger)); /// </param> /// <returns> /// A new <see cref="RabbitBus"/> instance. /// </returns> public static IBus CreateBus( string hostName, ushort hostPort, string virtualHost, string username, string password, ushort requestedHeartbeat, AdvancedBusEventHandlers advancedBusEventHandlers, Action<IServiceRegister> registerServices) { Preconditions.CheckNotNull(hostName, "hostName"); Preconditions.CheckNotNull(virtualHost, "virtualHost"); Preconditions.CheckNotNull(username, "username"); Preconditions.CheckNotNull(password, "password"); Preconditions.CheckNotNull(advancedBusEventHandlers, "advancedBusEventHandlers"); Preconditions.CheckNotNull(registerServices, "registerServices"); var connectionConfiguration = new ConnectionConfiguration { Hosts = new List<HostConfiguration> { new HostConfiguration { Host = hostName, Port = hostPort } }, Port = hostPort, VirtualHost = virtualHost, UserName = username, Password = password, RequestedHeartbeat = requestedHeartbeat }; return CreateBus(connectionConfiguration, advancedBusEventHandlers, registerServices); }
/// <summary> /// Creates a new instance of <see cref="RabbitBus"/>. /// </summary> /// <param name="connectionString"> /// The EasyNetQ connection string. Example: /// host=192.168.1.1;port=5672;virtualHost=MyVirtualHost;username=MyUsername;password=MyPassword;requestedHeartbeat=10 /// /// The following default values will be used if not specified: /// host=localhost;port=5672;virtualHost=/;username=guest;password=guest;requestedHeartbeat=10 /// </param> /// <param name="advancedBusEventHandlers"> /// An <see cref="AdvancedBusEventHandlers"/> instance which is used to add handlers /// to the events of the newly created <see cref="IBus.Advanced"/>. /// As <see cref="RabbitAdvancedBus"/> attempts to connect during instantiation, specifying a <see cref="AdvancedBusEventHandlers"/> /// before instantiation is the only way to catch the first <see cref="AdvancedBusEventHandlers.Connected"/> event. /// </param> /// <param name="registerServices"> /// Override default services. For example, to override the default <see cref="IEasyNetQLogger"/>: /// RabbitHutch.CreateBus("host=localhost", x => x.Register{IEasyNetQLogger}(_ => myLogger)); /// </param> /// <returns> /// A new <see cref="RabbitBus"/> instance. /// </returns> public static IBus CreateBus(string connectionString, AdvancedBusEventHandlers advancedBusEventHandlers, Action<IServiceRegister> registerServices) { Preconditions.CheckNotNull(connectionString, "connectionString"); Preconditions.CheckNotNull(registerServices, "registerServices"); Preconditions.CheckNotNull(advancedBusEventHandlers, "advancedBusEventHandlers"); var connectionStringParser = new ConnectionStringParser(); var connectionConfiguration = connectionStringParser.Parse(connectionString); return CreateBus(connectionConfiguration, advancedBusEventHandlers, registerServices); }
/// <summary> /// Creates a new instance of <see cref="RabbitBus"/>. /// </summary> /// <param name="connectionString"> /// The EasyNetQ connection string. Example: /// host=192.168.1.1;port=5672;virtualHost=MyVirtualHost;username=MyUsername;password=MyPassword;requestedHeartbeat=10 /// /// The following default values will be used if not specified: /// host=localhost;port=5672;virtualHost=/;username=guest;password=guest;requestedHeartbeat=10 /// </param> /// <param name="advancedBusEventHandlers"> /// An <see cref="AdvancedBusEventHandlers"/> instance which is used to add handlers /// to the events of the newly created <see cref="IBus.Advanced"/>. /// As <see cref="RabbitAdvancedBus"/> attempts to connect during instantiation, specifying a <see cref="AdvancedBusEventHandlers"/> /// before instantiation is the only way to catch the first <see cref="AdvancedBusEventHandlers.Connected"/> event. /// </param> /// <returns> /// A new <see cref="RabbitBus"/> instance. /// </returns> public static IBus CreateBus(string connectionString, AdvancedBusEventHandlers advancedBusEventHandlers) { Preconditions.CheckNotNull(connectionString, "connectionString"); Preconditions.CheckNotNull(advancedBusEventHandlers, "advancedBusEventHandlers"); return CreateBus(connectionString, advancedBusEventHandlers, x => { }); }
/// <summary> /// Creates a new instance of <see cref="RabbitBus"/>. /// The RabbitMQ broker is defined in the connection string named 'rabbit'. /// </summary> /// <param name="advancedBusEventHandlers"> /// An <see cref="AdvancedBusEventHandlers"/> instance which is used to add handlers /// to the events of the newly created <see cref="IBus.Advanced"/>. /// As <see cref="RabbitAdvancedBus"/> attempts to connect during instantiation, specifying a <see cref="AdvancedBusEventHandlers"/> /// before instantiation is the only way to catch the first <see cref="AdvancedBusEventHandlers.Connected"/> event. /// </param> /// <returns> /// A new <see cref="RabbitBus"/> instance. /// </returns> public static IBus CreateBus(AdvancedBusEventHandlers advancedBusEventHandlers) { return CreateBus(advancedBusEventHandlers, c => {}); }