Exemplo n.º 1
0
        private static void AsyncRemoteDequeue()
        {
            while (true)
            {
                RemoteQueue q = new RemoteQueue("Cellcom");

                IQueueItem item = q.Dequeue();
                if (item != null)
                {
                    Console.WriteLine("Dequeue: " + ItemToString(item));
                    //logger.WriteLoge("Dequeue: " + ItemToString(item), Mode.INFO);
                    rq_MessageReceived(q, new QueueItemEventArgs(item, ItemState.Commit));
                }

                Console.WriteLine("Count: " + q.Count);

                //}
                Thread.Sleep(100);
            }
        }
Exemplo n.º 2
0
        private static void AsyncDequeue()
        {
            while (true)
            {
                //if (counter >= 100)
                //{
                RemoteQueue q = new RemoteQueue("Cellcom");

                IQueueItem item = q.Dequeue();
                if (item != null)
                {
                    //logger.WriteLoge("Dequeue: " + item.Priority.ToString());
                    //logger.WriteLoge("Dequeue: " + ItemToString(item), Mode.INFO);
                    //Console.WriteLine(item.Priority.ToString());
                    //Console.WriteLine(item.ToString());
                }
                //}
                Thread.Sleep(100);
            }
        }
Exemplo n.º 3
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.Dequeue();//.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);
            }
Exemplo n.º 4
0
        //=================== End Async Queue =====================================

        //=================== Queue =====================================

        //static RemoteQueue rq;
        //static IAsyncQueue queue;
        private static void RunQueueTest()
        {
            McQueueProperties prop = new McQueueProperties("Cellcom");

            //prop.ConnectionString = cnn;
            prop.CoverMode = CoverMode.FileSystem;//.ItemsAndLog;
            prop.Server    = 0;
            //prop.Provider = QueueProvider.SqlServer;

            RemoteQueue rq = new RemoteQueue(prop.QueueName);

            Console.WriteLine(rq.Reply("test"));

            IQueueItem[] items = CreateItems(3, rq);


            RemoteQueue rq2 = new RemoteQueue(prop.QueueName);//"Cellcom");//RemoteQueue.Instance;

            Console.WriteLine(rq2.Reply("test"));

            IQueueItem[] itemsb = CreateItems(3, rq);

            rq2.Enqueue(itemsb[0]);
            rq2.Enqueue(itemsb[1]);
            rq2.Enqueue(itemsb[2]);

            int count = rq2.Count;

            DataTable dt2 = rq.GetQueueItemsTable();

            count = dt2.Rows.Count;


            int countq = rq.Count;

            Console.WriteLine(countq.ToString());


            rq.Enqueue(items[0]);
            rq.Enqueue(items[1]);
            rq.Enqueue(items[2]);
            countq = rq.Count;
            Console.WriteLine(countq.ToString());

            //DataTable dt = McQueue.Queues.GetAllCoverItems();// GetAllItems();//QueueProvider.Embedded, null);
            //     string fileName = Environment.CurrentDirectory + "\\McQueue.xml";
            //    dt.WriteXml(fileName);


            Thread.Sleep(100);
            IQueueItem[] items2 = new IQueueItem[3];
            int          intout = 0;

            while (intout < 2)
            {
                IQueueItem it = rq.Dequeue();
                if (it != null)
                {
                    items2[intout] = it;
                }
                countq = rq.Count;
                Console.WriteLine(countq.ToString());
                Thread.Sleep(100);
            }
        }