public void StartInitialization() { ILoggerFactory connectionLoggerFactory = LoggerFactory.Create(""); IRmqLogger connectionLogger = connectionLoggerFactory.CreateLogger(nameof(ConnectionWrapper)); connection = new ConnectionWrapper(config, connectionLogger); IModel rpcCh = connection.CreateChannel(); rpcChannelPool = channelPoolFactory.CreateChannelPool(rpcCh); IConsumerBinder rpcConsumerBinder = new RpcConsumerBinder(); IConsumerFactory rpcConsumerFactory = new ConsumerFactory( rpcChannelPool.GetChannelWrapper(), rpcConsumerBinder); ILoggerFactory loggerFactory = LoggerFactory.Create(ConsumerType.Rpc.ToString()); IRmqLogger managerLogger = loggerFactory.CreateLogger(nameof(ConsumerManager)); IConsumerManager rpcConsumerManager = new ConsumerManager( rpcConsumerFactory, managerLogger); rpcConsumerManager.InitConsumer(); IMainConsumerEventHandlerFactory rpcMainEventHandlerFactory = ConsumerEventHandlersFactory.Create(rpcConsumerManager, loggerFactory); IConsumerMainEventHandlers rpcConsumerMainEventHandler = rpcMainEventHandlerFactory.CreateMainHandler(); IRmqLogger connectionHandlerLogger = loggerFactory.CreateLogger(nameof(ConnectionEventHandlers)); IConnectionEventsHandlerFactory connectionEventsHandlerFactory = ConnectionEventsHandlerFactory.Create(connectionHandlerLogger, connection); IConnectionEventHandlers connectionEventHandler = connectionEventsHandlerFactory.CreateHandler(); IRmqLogger channelGuardLogger = loggerFactory.CreateLogger(nameof(ChannelGuardService)); this.channelGuardService = new ChannelGuardService( rpcChannelPool, // <--- TODO только rpc? channelGuardLogger, connectionEventHandler, rpcConsumerMainEventHandler); // Подписка на ответы запросов rpc responseMessageHandler = responseMessageHandlerFactory.GetHandler(); rpcConsumerMainEventHandler.AddReceiveHandler(responseMessageHandler.HandleMessage); }
public ConsumerMainEventHandlers( IConsumerEventHandlersFactory consumerEventHandlersFactory, IConsumerManager consumerManager, IRmqLogger logger) { this.consumerManager = consumerManager; this.logger = logger; consumerRegisterEventHandler = consumerEventHandlersFactory.CreateRegisterEventHandler(); consumerReceiveEventHandelr = consumerEventHandlersFactory.CreateReceiveEventHandelr(); consumerCommonEventHandelr = consumerEventHandlersFactory.CreateCommonEventHandelr(); Init(); }
public ResponseMessageHandler(IRmqLogger logger) { this.logger = logger; }
public ChannelEventsHandler(IRmqLogger logger) { this.logger = logger; }
public ResponseMessageHandlerFactory(IRmqLogger logger) { responseMessageHandler = new ResponseMessageHandler(logger); }
public static IResponseMessageHandlerFactory Create(IRmqLogger logger) { return(new ResponseMessageHandlerFactory(logger)); }
public PublisherFactory(IConnectionManager connectionManager, RmqConfig rmqConfig, IRmqLogger logger) { IChannelWrapper channel = connectionManager.GetRpcChannel(); IResponseMessageHandler replyHandler = connectionManager.GetResponseMessageHandler(); basicPublisher = new BasicPublisher(channel, replyHandler, rmqConfig, logger); }