예제 #1
0
        public override void ProcessMessage(object sender, MessageEventArgs args)
        {
            bool handled = false;

            try
            {
                string  msg = Encoding.UTF8.GetString(args.Message.BodyStream.ToByteArray());
                Channel ch  = Utility.DeserializeXMLString <Channel>(msg);

                if (!Object.Equals(ch, null))
                {
                    YouTubeDataComponent ytdc = new YouTubeDataComponent();
                    ytdc.YouTubeChannel = ch;

                    handled = true;
                    FireMessageProcessingEvent();
                    QueueComponentDataSource.Process(ytdc);
                    FireMessageProcessedEvent();
                }
            }
            catch (Exception e)
            {
                ExceptionExtensions.LogError(e, "QueueYouTube.ProcessMessage");

                if (Utility.IsCriticalDBError(e))
                {
                    FireShuttingDownEvent();
                }

                if (handled)
                {
                    FireMessageProcessedEvent();
                }
            }
        }
예제 #2
0
        public override void ProcessMessage(object sender, MessageEventArgs args)
        {
            bool handled = false;

            try
            {
                string        msg = Encoding.UTF8.GetString(args.Message.BodyStream.ToByteArray());
                KeywordStatus ks  = Utility.DeserializeXMLString <KeywordStatus>(msg);

                if (!Object.Equals(ks, null))
                {
                    TwitterDataComponent tdc = new TwitterDataComponent();
                    tdc.KeywordStatus = ks;

                    handled = true;
                    FireMessageProcessingEvent();
                    QueueComponentDataSource.Process(tdc);
                    FireMessageProcessedEvent();
                }

                List <User> users = Utility.DeserializeXMLString <List <User> >(msg);
                if (!Object.Equals(null, users))
                {
                    TwitterDataComponent tdc = new TwitterDataComponent();
                    tdc.TwitterUserList = users;

                    handled = true;
                    FireMessageProcessingEvent();
                    QueueComponentDataSource.Process(tdc);
                    FireMessageProcessedEvent();
                }
            }
            catch (Exception e)
            {
                ExceptionExtensions.LogError(e, "QueueTwitter.ProcessMessage");

                if (Utility.IsCriticalDBError(e))
                {
                    FireShuttingDownEvent();
                }

                if (handled)
                {
                    FireMessageProcessedEvent();
                }
            }
        }
예제 #3
0
        public override void ProcessMessage(object sender, MessageEventArgs args)
        {
            bool   handled = false;
            string msg     = string.Empty;

            try
            {
                msg = Encoding.UTF8.GetString(args.Message.BodyStream.ToByteArray());

                PortfolioDataType ms = Utility.DeserializeXMLString <PortfolioDataType>(msg);

                if (!Object.Equals(ms, null))
                {
                    WriteToUsageLogFile("PortfolioDataType:" + ms.ToString(), string.Format("Executing {0}.{1}", ProcessorName, MethodInfo.GetCurrentMethod().Name), true);
                    PortfolioDataComponent dc = new PortfolioDataComponent();
                    dc.PortfolioType = ms;

                    handled = true;
                    FireMessageProcessingEvent();
                    QueueComponentDataSource.Process(dc);
                    FireMessageProcessedEvent();
                }

                ms = null;
            }
            catch (Exception e)
            {
                ExceptionExtensions.LogError(e, "QueuePortfolio.ProcessMessage", "Msg to process: " + msg);

                if (Utility.IsCriticalDBError(e))
                {
                    FireShuttingDownEvent();
                }

                if (handled)
                {
                    FireMessageProcessedEvent();
                }
            }
        }
예제 #4
0
        public override void ProcessMessage(object sender, MessageEventArgs args)
        {
            bool handled = false;

            try
            {
                string      msg = Encoding.UTF8.GetString(args.Message.BodyStream.ToByteArray());
                CompanyRoot cr  = Utility.DeserializeXMLString <CompanyRoot>(msg);
                if (!Object.Equals(cr, null))
                {
                    WriteToUsageLogFile("Domain:" + cr.homepage_url, string.Format("Executing {0}.{1}", ProcessorName, MethodInfo.GetCurrentMethod().Name), true);

                    CrunchbaseDataComponent dc = new CrunchbaseDataComponent();
                    dc.CompanyLocal = cr;

                    handled = true;
                    FireMessageProcessingEvent();
                    QueueComponentDataSource.Process(dc);
                    FireMessageProcessedEvent();
                }

                cr = null;
            }
            catch (Exception e)
            {
                ExceptionExtensions.LogError(e, "QueueCrunchbase.ProcessMessage");

                if (Utility.IsCriticalDBError(e))
                {
                    FireShuttingDownEvent();
                }

                if (handled)                 //if false, processor was never incremented, no need to decrement
                {
                    FireMessageProcessedEvent();
                }
            }
        }
예제 #5
0
        public override void ProcessMessage(object sender, MessageEventArgs args)
        {
            bool handled = false;

            try
            {
                FacebookDataComponent dc = new FacebookDataComponent();
                string msg  = Encoding.UTF8.GetString(args.Message.BodyStream.ToByteArray());
                Page   page = Utility.DeserializeXMLString <Page>(msg);

                if (!Object.Equals(page, null))
                {
                    dc.FBPage = page;

                    handled = true;
                    FireMessageProcessingEvent();
                    QueueComponentDataSource.Process(dc);
                    FireMessageProcessedEvent();
                }
                else
                {
                    Demographic <Country> ctry = Utility.DeserializeXMLString <Demographic <Country> >(msg);
                    if (!Object.Equals(ctry, null))
                    {
                        dc.CountryDemographic = ctry;

                        handled = true;
                        FireMessageProcessingEvent();
                        QueueComponentDataSource.Process(dc);
                        FireMessageProcessedEvent();
                    }
                    else
                    {
                        Demographic <Locale> lcl = Utility.DeserializeXMLString <Demographic <Locale> >(msg);
                        if (!Object.Equals(lcl, null))
                        {
                            dc.LocaleDemographic = lcl;

                            handled = true;
                            FireMessageProcessingEvent();
                            QueueComponentDataSource.Process(dc);
                            FireMessageProcessedEvent();
                        }
                        else
                        {
                            Demographic <Gender> gndr = Utility.DeserializeXMLString <Demographic <Gender> >(msg);
                            if (!Object.Equals(gndr, null))
                            {
                                dc.GenderDemographic = gndr;

                                handled = true;
                                FireMessageProcessingEvent();
                                QueueComponentDataSource.Process(dc);
                                FireMessageProcessedEvent();
                            }
                        }
                    }
                }
            }
            catch (Exception e)
            {
                ExceptionExtensions.LogError(e, "QueueFacebook.ProcessMessage");

                if (Utility.IsCriticalDBError(e))
                {
                    FireShuttingDownEvent();
                }

                if (handled)
                {
                    FireMessageProcessedEvent();
                }
            }
        }