Example #1
0
        private static void RunRemoteQueue()
        {
            McQueueProperties prop = new McQueueProperties("NC_Quick");

            //prop.ConnectionString = cnn;
            prop.CoverMode = CoverMode.FileSystem;//.ItemsAndLog;
            prop.Server    = 0;
            //prop.Provider = QueueProvider.SqlServer;
            prop.ReloadOnStart = true;
            Console.WriteLine("create remote queue");
            RemoteQueue rque = RemoteManager.Create(prop);

            //rque.ReceiveCompleted += new ReceiveCompletedEventHandler(rq_ReceiveCompleted);


            //RemoteQueue.AddQueue(prop);
            Console.WriteLine("rempote queue created");
            rque.MessageArraived += new QueueItemEventHandler(rq_MessageArraived);
            rque.MessageReceived += new QueueItemEventHandler(rq_MessageReceived);
            //Console.WriteLine(rqc.Reply("test"));

            //AsyncManagerWorker();
            RunThreads(new ThreadStart(AsyncRemoteDequeue), 10);
            RunThreads(new ThreadStart(AsyncManagerWorker), 10);

            while (true)
            {
                IAsyncResult result = rque.BeginReceive(null);
                Console.WriteLine("Count: {0}", rque.Count);
                Thread.Sleep(10);
            }
            Console.ReadLine();
        }
Example #2
0
            private void Listner()
            {
                DateTime start = DateTime.Now;

                Console.WriteLine("Queue Reciever {0} Started", rque.QueueName);
                int index = 0;

                while (keepalive)
                {
                    object state = new object();
                    rque.BeginReceive(new TimeSpan(0, 0, 20), state);
                    index++;
                    Thread.Sleep(100);
                    if (index >= 1000)
                    {
                        break;
                    }
                }
                Console.WriteLine("Queue Reciever {0} Stoped", rque.QueueName);
                TimeSpan ts = DateTime.Now.Subtract(start);

                Console.WriteLine("Total secondes={0}", ts.TotalSeconds);
            }
Example #3
0
 public void BeginReceive()
 {
     rque.BeginReceive(new TimeSpan(0, 0, 20), null);
 }