Exemplo n.º 1
0
 /*
  * Logger thread
  */
 public void LoggerThreadRun()
 {
     while (true)
     {
         try
         {
             String value = (String)loggerQueue.Dequeue();
             loggerEmitter.Send(value, Encoding.UTF8, SendRecvOpt.NONE);
             logger.Debug("Message is sent for logging");
             Thread.Sleep(1);
             if (messagingFinished && loggerQueue.Count == 0)
             {
                 loggerEmitter.Send(FINISH_COMMAND, Encoding.UTF8, SendRecvOpt.NONE);
                 return;
             }
         }
         catch (System.Exception e)
         {
             //disables logging type messaging
             DB_LOGGING = false;
             loggerQueue.Clear();
             logger.Error(e);
             IGNORE_QUEUE_OVERFLOW = ON;
             return;
         }
     }
 }
Exemplo n.º 2
0
        /*
         * File storage thread
         */
        public void FileThreadRun()
        {
            while (!messagingFinished)
            {
                try
                {
                    //if there are no new messages in the queue, reads messages from the file storage
                    if (outgoingMessageQueue.Count < 5 && fileQueue.Count > 0)
                    {
                        String message = readOutGoingMessageFile();
                        outgoingMessageQueue.Enqueue(message);
                        Thread.Sleep(1);
                    }
                    else
                    {
                        Thread.Sleep(outgoingMessageQueue.Count * 10);
                    }

                    if (messagingFinished && fileQueue.Count == 0)
                    {
                        return;
                    }
                }
                catch (System.Exception e)
                {
                    logger.Error(e);
                    fileQueue.Clear();
                    return;
                }
            }
        }
Exemplo n.º 3
0
 /*
  * Activemq messaging thread
  */
 public void ActiveMQBrokerThreadRun()
 {
     while (true)
     {
         try
         {
             String value = (String)brokerQueue.Dequeue();
             //activemqSender.Send(value);
             logger.Debug("Message is sent with activemq");
             Thread.Sleep(1);
             if (messagingFinished && brokerQueue.Count == 0)
             {
                 activeMQconnection.Close();
                 return;
             }
         }
         catch (System.Exception e)
         {
             //disables broker type messaging
             BROKER = NONE;
             logger.Error(e);
             brokerQueue.Clear();
             activeMQconnection.Close();
             return;
         }
     }
 }