Ejemplo n.º 1
0
        protected void InitRabbitClient()
        {
            client             = new RabbitMQClient("iClock Service Queue");
            client.OnRecieved += (model, message) =>
            {
                if (fingerPrinterManager != null && !string.IsNullOrEmpty(message))
                {
                    try
                    {
                        CommandObject command = client.JsonDeserialize(message);
                        switch (command.Command)
                        {
                        case MessageCommandEnum.DISCONNECT:
                        {
                            string ip = command.Data as string;
                            fingerPrinterManager.Disconnect(ip);
                            break;
                        }

                        case MessageCommandEnum.CONNECT:
                        {
                            string ip = command.Data as string;
                            fingerPrinterManager.Connect(ip);
                            break;
                        }
                        }
                    }
                    catch (Exception ex)
                    {
                        logger.Error(ex.Message, ex);
                    }
                }
            };
        }
Ejemplo n.º 2
0
 public FingerPrintHub()
 {
     if (_client == null)
     {
         _client             = new RabbitMQClient("MT Dashboard Queue");
         _client.OnRecieved += (model, message) =>
         {
             var cmdObject = _client.JsonDeserialize(message);
             switch (cmdObject.Command)
             {
             case MessageCommandEnum.PUSH:
             {
                 var toasts = ExecutePatientProcedure(Convert.ToInt32(cmdObject.Data), "FINGER_PRINT");
                 Clients.All.ReloadPatientList(toasts);
                 break;
             }
             }
         };
     }
     RunTask();
 }