public RabbitAdvancedBus( IConnectionFactory connectionFactory, IClientCommandDispatcherFactory clientCommandDispatcherFactory, IPublishConfirmationListener confirmationListener) { this.confirmationListener = confirmationListener; connection = new PersistentConnection(connectionFactory); clientCommandDispatcher = clientCommandDispatcherFactory.GetClientCommandDispatcher(connection); connection.Initialize(); }
public void SetUp() { var logger = new ConsoleLogger(); var eventBus = new EventBus(); var parser = new ConnectionStringParser(); var configuration = parser.Parse("host=localhost"); var hostSelectionStrategy = new RandomClusterHostSelectionStrategy<ConnectionFactoryInfo>(); var connectionFactory = new ConnectionFactoryWrapper(configuration, hostSelectionStrategy); connection = new PersistentConnection(connectionFactory, logger, eventBus); persistentChannel = new PersistentChannel(connection, logger, configuration, new EventBus()); connection.Initialize(); }
public PersistentChannelTests() { var eventBus = new EventBus(); var parser = new ConnectionStringParser(); var configuration = parser.Parse("host=localhost"); var hostSelectionStrategy = new RandomClusterHostSelectionStrategy <ConnectionFactoryInfo>(); var connectionFactory = new ConnectionFactoryWrapper(configuration, hostSelectionStrategy); connection = new PersistentConnection(connectionFactory, eventBus); persistentChannel = new PersistentChannel(connection, configuration, new EventBus()); connection.Initialize(); }
public void SetUp() { var eventBus = new EventBus(); var logger = new ConsoleLogger(); var parser = new ConnectionStringParser(); var configuration = parser.Parse("host=localhost"); var hostSelectionStrategy = new RandomClusterHostSelectionStrategy <ConnectionFactoryInfo>(); var connectionFactory = new ConnectionFactoryWrapper(configuration, hostSelectionStrategy); connection = new PersistentConnection(connectionFactory, logger, eventBus); var persistentChannelFactory = new PersistentChannelFactory(logger, configuration, eventBus); dispatcher = new ClientCommandDispatcher(connection, persistentChannelFactory); connection.Initialize(); }
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(); }