Esempio n. 1
0
        private void ReEnqueueFiles()
        {
            if (reEnqueueItems)
            {
                return;
            }
            try
            {
                Console.WriteLine("Start ReEnqueueQueueItems");

                reEnqueueItems = true;

                string path = GetRelayPath();

                if (Directory.Exists(path))
                {
                    string[] messages = Directory.GetFiles(path, "*.mcq");
                    if (messages == null || messages.Length == 0)
                    {
                        return;
                    }

                    Console.WriteLine("{0} items found to ReEnqueue", messages.Length);

                    Netlog.InfoFormat("ReEnqueueFiles: {0} ", messages.Length);


                    foreach (string message in messages)
                    {
                        //while (this.Count > 1000)
                        //{

                        //    Thread.Sleep(1000);
                        //}

                        QueueItem item = QueueItem.ReadFile(message);
                        if (item != null)
                        {
                            Enqueue(item as IQueueItem);
                        }
                        SysUtil.DeleteFile(message);
                        Thread.Sleep(100);
                    }
                    Netlog.Info("ReEnqueueFiles finished. ");
                }
            }
            catch (Exception ex)
            {
                string s = ex.Message;
            }
            finally
            {
                reEnqueueItems = false;
            }
        }
Esempio n. 2
0
        static void Main(string[] args)
        {
            Netlog.Info("test log");

            string qtype = "remote";

            string queueName = "NC_DEMO";

            /*
             * RemotingTable rt = new RemotingTable();
             * rt.AddTrans("123",new TimeSpan(0,0,30));
             * //rt.Push("123", "hello");
             *
             * TransItem ti= rt.Pop("123");
             * Console.WriteLine(ti.ItemState.ToString());
             * //rt.Push("123", "hello");
             * Console.WriteLine("trans push");
             */

            //if (args.Length == 0)
            //{
            //    throw new ArgumentNullException("Invalid argument");
            //}


            //McQueueProperties prop = new McQueueProperties(queueName);

            //prop.CoverMode = CoverMode.FileSystem;
            //prop.Server = 0;
            //prop.IsTrans = false;
            //McQueue queue = McQueue.Create(prop);


            if (qtype == "queue")
            {
                McQueue q = new McQueue("demo");
            }
            else
            {
                RemoteQueueInserter qi = new RemoteQueueInserter(args);
                while (true)
                {
                    DateTime start = DateTime.Now;
                    qi.Start(1000);
                    TimeSpan ts = DateTime.Now.Subtract(start);
                    Console.WriteLine("Total secondes={0}", ts.TotalSeconds);
                    Thread.Sleep(2000);
                }
            }

            Console.ReadLine();
        }
Esempio n. 3
0
 void _ConfigFileWatcher_FileChanged(object sender, FileSystemEventArgs e)
 {
     ConfigurationManager.RefreshSection("appSettings");
     ConfigurationManager.RefreshSection("connectionStrings");
     Netlog.Info("ConfigFileWatcher FileChanged");
 }