public List <SupportedEventProcessor> GetAll()
        {
            MySqlCommand cmd = new MySqlCommand("SELECT * FROM reporting.event_processors order by event_id", this._connection.Handle);

            DataTable datatable = new DataTable();

            this._dataAdapter.SelectCommand = cmd;
            this._dataAdapter.Fill(datatable);

            List <SupportedEventProcessor> l = new List <SupportedEventProcessor>();


            foreach (DataRow row in datatable.Rows)
            {
                SupportedEventProcessor e = new SupportedEventProcessor();

                e.AssemblyFilename = row["assembly_filename"].ToString();
                e.ClassName        = row["class_name"].ToString();
                e.Description      = row["description"].ToString();
                e.EventId          = Convert.ToUInt64(row["event_id"]);
                e.MethodName       = row["method_name"].ToString();
                e.Name             = row["name"].ToString();

                l.Add(e);
            }

            return(l);
        }
        private static void Worker(object cm)
        {
            //    Logger.Debug("Inside worker thread....");

            SupportedEventProcessor eventProcessorInfo = (SupportedEventProcessor)cm;

            ulong thisEventId = eventProcessorInfo.EventId;
            ulong sleepTime   = thisEventId * 2;

            String   threadId = String.Format("{0}({1})", eventProcessorInfo.Name, eventProcessorInfo.EventId);
            Assembly asm      = null;

            try
            {
                asm = ReflectionManager.LoadAssembly(eventProcessorInfo.AssemblyFilename);
            }
            catch (Exception ex)
            {
                Logger.Debug(String.Format("Worker {0}: Exception in querying logic: {1}", threadId, ex.Message));
                Thread.Sleep(5000);
            }

            bool firstTime = true;

            while (true)
            {
                Logger.Debug("Worker Thread: " + Thread.CurrentThread.ManagedThreadId + "  Host Ip: " + HostUtil.GetLocalIPAddress() + "  Thread Id: " + threadId);

                if (firstTime)
                {
                    //  Logger.Debug(String.Format("{0} - Loading events from database table...", threadId));

                    try
                    {
                        eventsQueueManager.LoadEvents(threadId, thisEventId, connectionManager);
                    }
                    catch (Exception ex)
                    {
                        Logger.Error("Unable to load events: " + ex.Message);
                        continue;
                    }

                    firstTime = false;
                }

                //  Get next event for this event id.

                // Logger.Debug(String.Format("{0} - Getting next event...", threadId));

                ReportEvent evt;

                try
                {
                    evt = eventsQueueManager.GetEvent(thisEventId, connectionManager, threadId);
                }
                catch (Exception ex)
                {
                    Logger.Debug(String.Format("{0} - Error getting next event: {1}", threadId, ex.Message));
                    Thread.Sleep(2000);
                    continue;
                }

                if (evt == null)
                {
                    Logger.Debug(String.Format("{0} - No events to process", threadId));

                    Thread.Sleep(5000);

                    firstTime = true;

                    continue;
                }

                //  Received an event for this event id.  Process the event

                //      Logger.Debug(String.Format("{0} - Processing event {1}", threadId, evt.Id));

                try
                {
                    ReflectionManager.ProcessEvent(asm, eventProcessorInfo.ClassName, eventProcessorInfo.MethodName, evt, connectionManager, (int)sleepTime);
                }
                catch (EventProcessorClassNotFound)
                {
                    Logger.Debug("Internal error: Class SharedLibrary.MyClass not found");
                    return;
                }
                catch (EventProcessorClassEntryNotImplemented)
                {
                    Logger.Debug("Internal error: Start method in class SharedLibrary.MyClass not found");
                    return;
                }
                catch (Exception ex3)
                {
                    Logger.Debug("Error: " + ex3.Message);
                    return;
                }



                //   Logger.Debug(String.Format("{0}:  Id: {1}  Event Id: {2}  Event Date {3}  Event Data {4}",
                //                  threadId, evt.Id, evt.EventId, evt.EventDate, evt.EventData));
            } // END while(true)
        }     //  END Worker