예제 #1
0
        protected override IDictionary <ProtocolFlowType, IProtocolFlow> InitializeFlows()
        {
            Dictionary <ProtocolFlowType, IProtocolFlow> flows = new Dictionary <ProtocolFlowType, IProtocolFlow>();

            IRepository <ClientSession>   sessionRepository  = repositoryProvider.GetRepository <ClientSession>();
            IRepository <RetainedMessage> retainedRepository = repositoryProvider.GetRepository <RetainedMessage>();
            PublishSenderFlow             senderFlow         = new PublishSenderFlow(sessionRepository, configuration);

            flows.Add(ProtocolFlowType.Connect, new ClientConnectFlow(sessionRepository, senderFlow));
            flows.Add(ProtocolFlowType.PublishSender, senderFlow);
            flows.Add(ProtocolFlowType.PublishReceiver, new PublishReceiverFlow(topicEvaluator,
                                                                                retainedRepository, sessionRepository, configuration));
            flows.Add(ProtocolFlowType.Subscribe, new ClientSubscribeFlow());
            flows.Add(ProtocolFlowType.Unsubscribe, new ClientUnsubscribeFlow());
            flows.Add(ProtocolFlowType.Ping, new PingFlow());

            return(flows);
        }
        protected override IDictionary <ProtocolFlowType, IProtocolFlow> InitializeFlows()
        {
            Dictionary <ProtocolFlowType, IProtocolFlow> flows = new Dictionary <ProtocolFlowType, IProtocolFlow>();

            IRepository <ClientSession>   sessionRepository  = repositoryProvider.GetRepository <ClientSession>();
            IRepository <ConnectionWill>  willRepository     = repositoryProvider.GetRepository <ConnectionWill>();
            IRepository <RetainedMessage> retainedRepository = repositoryProvider.GetRepository <RetainedMessage>();
            PublishSenderFlow             senderFlow         = new PublishSenderFlow(sessionRepository, configuration);

            flows.Add(ProtocolFlowType.Connect, new ServerConnectFlow(_authenticationProvider, sessionRepository, willRepository, senderFlow));
            flows.Add(ProtocolFlowType.PublishSender, senderFlow);
            flows.Add(ProtocolFlowType.PublishReceiver, new ServerPublishReceiverFlow(topicEvaluator, _connectionProvider,
                                                                                      senderFlow, retainedRepository, sessionRepository, willRepository, _packetIdProvider, _undeliveredMessagesListener, configuration));
            flows.Add(ProtocolFlowType.Subscribe, new ServerSubscribeFlow(topicEvaluator, sessionRepository,
                                                                          retainedRepository, _packetIdProvider, senderFlow, configuration));
            flows.Add(ProtocolFlowType.Unsubscribe, new ServerUnsubscribeFlow(sessionRepository));
            flows.Add(ProtocolFlowType.Ping, new PingFlow());
            flows.Add(ProtocolFlowType.Disconnect, new DisconnectFlow(_connectionProvider, sessionRepository, willRepository));

            return(flows);
        }