public ConnectionMonitor(string logFile, IPersistentConnectionFactory persitentConnectionFactory) { this.logFile = logFile; this.persitentConnectionFactory = persitentConnectionFactory; }
public RabbitAdvancedBus( IConnectionFactory connectionFactory, IConsumerFactory consumerFactory, IClientCommandDispatcherFactory clientCommandDispatcherFactory, IPublishConfirmationListener confirmationListener, IEventBus eventBus, IHandlerCollectionFactory handlerCollectionFactory, IServiceResolver container, ConnectionConfiguration connectionConfiguration, IProduceConsumeInterceptor produceConsumeInterceptor, IMessageSerializationStrategy messageSerializationStrategy, IConventions conventions, AdvancedBusEventHandlers advancedBusEventHandlers, IPersistentConnectionFactory persistentConnectionFactory) { Preconditions.CheckNotNull(connectionFactory, "connectionFactory"); Preconditions.CheckNotNull(consumerFactory, "consumerFactory"); 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.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(); }