Пример #1
0
        static void Main(string[] args)
        {
            CloudQueue    _queue   = AzureFactory.GetQueue(AzureFactory.MSGorillaQueue.SearchEngineSpider);
            SearchManager _manager = new SearchManager();

            var result = _manager.SearchMessage("woss user1");

            while (true)
            {
                try
                {
                    CloudQueueMessage message = null;
                    while ((message = _queue.GetMessage()) == null)
                    {
                        Thread.Sleep(10000);
                    }

                    _queue.UpdateMessage(message,
                                         TimeSpan.FromSeconds(60.0), // Make it visible immediately.
                                         MessageUpdateFields.Visibility);

                    Message msg = JsonConvert.DeserializeObject <Message>(message.AsString);

                    _manager.SpideMessage(msg);
                    //_queue.DeleteMessage(message);
                }
                catch (Exception e)
                {
                    Console.WriteLine("Exception in worker role", e.StackTrace);
                }
            }
        }
Пример #2
0
        public override void Run()
        {
            // This is a sample worker implementation. Replace with your logic.
            Trace.TraceInformation("MSGorilla.Spider entry point called");

            CloudQueue    _queue   = AzureFactory.GetQueue(AzureFactory.MSGorillaQueue.SearchEngineSpider);
            SearchManager _manager = new SearchManager();

            while (true)
            {
                try
                {
                    CloudQueueMessage message = null;
                    while ((message = _queue.GetMessage()) == null)
                    {
                        Thread.Sleep(10000);
                    }

                    _queue.UpdateMessage(message,
                                         TimeSpan.FromSeconds(60.0), // Make it visible immediately.
                                         MessageUpdateFields.Visibility);

                    Message msg = JsonConvert.DeserializeObject <Message>(message.AsString);
                    //string content = (string)mess.Content;
                    //Message tweet = JsonConvert.DeserializeObject<Message>(content);

                    _manager.SpideMessage(msg);
                    _queue.DeleteMessage(message);
                }
                catch (Exception e)
                {
                    Trace.TraceError("Exception in worker role", e.StackTrace);
                }
            }
        }
Пример #3
0
        public override void Run()
        {
            Trace.TraceInformation("MSGorilla.MailDispatcher entry point called");

            _mailboxCache   = new MemoryCache("mailbox");
            _mailStoreCache = new MemoryCache("mailstore");
            _groupID2Name   = new Dictionary <string, string>();
            _topicManager   = new TopicManager();
            _groupManager   = new GroupManager();
            _accountManager = new AccountManager();
            _richMsgManager = new RichMsgManager();

            CloudQueue _queue = AzureFactory.GetQueue(AzureFactory.MSGorillaQueue.MailMessage);;

            while (true)
            {
                try
                {
                    CloudQueueMessage message = _queue.GetMessage();
                    while (message == null)
                    {
                        Thread.Sleep(1000);
                        message = _queue.GetMessage();
                    }
                    _queue.UpdateMessage(message,
                                         TimeSpan.FromSeconds(60.0 * 1), // Make it in five minutes
                                         MessageUpdateFields.Visibility);

                    Message msg = JsonConvert.DeserializeObject <Message>(message.AsString);

                    DispatchMail(msg);

                    _queue.DeleteMessage(message);
                }
                catch (Exception e)
                {
                    Trace.TraceError("Exception in worker role", e.StackTrace);
                }
            }
        }
Пример #4
0
        public MessageManager()
        {
            _homeline         = AzureFactory.GetTable(AzureFactory.MSGorillaTable.Homeline);
            _userline         = AzureFactory.GetTable(AzureFactory.MSGorillaTable.Userline);
            _eventline        = AzureFactory.GetTable(AzureFactory.MSGorillaTable.EventLine);
            _publicSquareLine = AzureFactory.GetTable(AzureFactory.MSGorillaTable.PublicSquareLine);
            _topicline        = AzureFactory.GetTable(AzureFactory.MSGorillaTable.TopicLine);
            _ownerline        = AzureFactory.GetTable(AzureFactory.MSGorillaTable.OwnerLine);
            _atline           = AzureFactory.GetTable(Azure.AzureFactory.MSGorillaTable.AtLine);
            _reply            = AzureFactory.GetTable(AzureFactory.MSGorillaTable.Reply);

            _queue            = AzureFactory.GetQueue(AzureFactory.MSGorillaQueue.Dispatcher);
            _spiderqueue      = AzureFactory.GetQueue(AzureFactory.MSGorillaQueue.SearchEngineSpider);
            _mailMessageQueue = AzureFactory.GetQueue(AzureFactory.MSGorillaQueue.MailMessage);

            _accManager     = new AccountManager();
            _attManager     = new AttachmentManager();
            _schemaManager  = new SchemaManager();
            _notifManager   = new NotifManager();
            _topicManager   = new TopicManager();
            _richMsgManager = new RichMsgManager();
            _groupManager   = new GroupManager();
        }