Exemplo n.º 1
0
 public ChatHub(IApplicationConfig applicationConfig, ICacheHelper cacheHelper, IQueueDataModel queueDataModel,
                IAgentDataModel agentDataModel)
 {
     _applicationConfig = applicationConfig;
     _cacheHelper       = cacheHelper;
     _queueDataModel    = queueDataModel;
     _agentDataModel    = agentDataModel;
 }
Exemplo n.º 2
0
        static void Main(string[] args)
        {
            #region DI Container Builder
            var builder = new ContainerBuilder();

            builder.RegisterType <RedisHelper>().As <ICacheHelper>();
            builder.RegisterType <ApplicationConfig>().As <IApplicationConfig>();
            builder.RegisterType <RabbitMQHelper>().As <IMessageQueueHelper>();
            builder.RegisterType <QueueDataModel>().As <IQueueDataModel>();
            builder.RegisterType <AgentDataModel>().As <IAgentDataModel>();
            builder.RegisterType <ChatHub>().As <IChatHub>();

            builder.RegisterType <QueueDataModel>().As <IQueueDataModel>().SingleInstance();
            var container = builder.Build();
            #endregion

            using (var scope = container.BeginLifetimeScope())
            {
                #region DI Resolver
                _cacheHelper        = scope.Resolve <ICacheHelper>();
                _messageQueueHelper = scope.Resolve <IMessageQueueHelper>();
                _applicationConfig  = scope.Resolve <IApplicationConfig>();
                _queueDataModel     = scope.Resolve <IQueueDataModel>();
                _agentDataModel     = scope.Resolve <IAgentDataModel>();
                _chatHub            = scope.Resolve <IChatHub>();

                var chatMonitorHelper = new ChatMonitorHelper(_queueDataModel, _agentDataModel, _chatHub);
                var webserverHelper   = new WebServerHelper(_applicationConfig);
                #endregion

                #region Processors
                //Start Message Queue Listener
                Task.Run(() => _messageQueueHelper.ReadMessages <QueueMetaData>(_applicationConfig, chatMonitorHelper.ProcessQueue));
                //Start Message Queue Processor
                Task.Run(() => chatMonitorHelper.MonitorQueue());
                //Start WebSocket Server
                Task.Run(() => webserverHelper.StartWebServer());
                #endregion
            }

            Console.ReadLine();
        }
Exemplo n.º 3
0
 public AgentHub(IAgentDataModel agentDataModel, IQueueDataModel queueDataModel, IChatHub chathub)
 {
     _agentDataModel = agentDataModel;
     _queueDataModel = queueDataModel;
     _chatHub        = chathub;
 }
Exemplo n.º 4
0
 public ChatMonitorHelper(IQueueDataModel queueDataModel, IAgentDataModel agentDataModel, IChatHub chatHub)
 {
     _queueDataModel = queueDataModel;
     _agentDataModel = agentDataModel;
     _chatHub        = chatHub;
 }
Exemplo n.º 5
0
 public AgentHelper(IAgentDataModel agentDataModel, IQueueDataModel queueDataModel, IChatHub chatHub)
 {
     this._agentDataModel = agentDataModel;
     this._queueDataModel = queueDataModel;
     this._chatHub        = chatHub;
 }