コード例 #1
0
        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);
        }
コード例 #2
0
        public ConsumerMainEventHandlers(
            IConsumerEventHandlersFactory consumerEventHandlersFactory,
            IConsumerManager consumerManager,
            IRmqLogger logger)
        {
            this.consumerManager = consumerManager;
            this.logger          = logger;

            consumerRegisterEventHandler = consumerEventHandlersFactory.CreateRegisterEventHandler();
            consumerReceiveEventHandelr  = consumerEventHandlersFactory.CreateReceiveEventHandelr();
            consumerCommonEventHandelr   = consumerEventHandlersFactory.CreateCommonEventHandelr();

            Init();
        }
コード例 #3
0
 public ResponseMessageHandler(IRmqLogger logger)
 {
     this.logger = logger;
 }
コード例 #4
0
 public ChannelEventsHandler(IRmqLogger logger)
 {
     this.logger = logger;
 }
コード例 #5
0
 public ResponseMessageHandlerFactory(IRmqLogger logger)
 {
     responseMessageHandler = new ResponseMessageHandler(logger);
 }
コード例 #6
0
 public static IResponseMessageHandlerFactory Create(IRmqLogger logger)
 {
     return(new ResponseMessageHandlerFactory(logger));
 }
コード例 #7
0
        public PublisherFactory(IConnectionManager connectionManager, RmqConfig rmqConfig, IRmqLogger logger)
        {
            IChannelWrapper         channel      = connectionManager.GetRpcChannel();
            IResponseMessageHandler replyHandler = connectionManager.GetResponseMessageHandler();

            basicPublisher = new BasicPublisher(channel, replyHandler, rmqConfig, logger);
        }