Beispiel #1
0
        private static void AsyncManagerWorker()
        {
            RemoteQueue r     = new RemoteQueue("NC_Quick");
            int         count = 10000;

            for (int i = 0; i <= count; i++)
            {
                Priority  p    = (i % 5 == 0) ? Priority.High : (i % 2 == 0) ? Priority.Medium : Priority.Normal;
                QueueItem item = new QueueItem(p);
                item.MessageId   = i;
                item.Body        = "this is a test  אכן זוהי דוגמא";
                item.Subject     = "test";
                item.Sender      = "ibm";
                item.Destination = "nissim";
                //RemoteQueue q = new RemoteQueue("Cellcom");
                r.Enqueue(item);
                //logger.WriteLoge("Enqueue: " + ItemToString(item), Mode.INFO);
                counter = i;
            }
        }
Beispiel #2
0
        private void QueueInserterWorker(string[] names, int i)
        {
            foreach (string name in names)
            {
                Priority  p    = (i % 5 == 0) ? Priority.High : (i % 2 == 0) ? Priority.Medium : Priority.Normal;
                QueueItem item = new QueueItem(p);
                item.MessageId   = i;
                item.Body        = name + " abc this is a test..";
                item.Subject     = "test";
                item.Sender      = "ibm";
                item.Destination = "nissim";


                RemoteQueue r = new RemoteQueue(name);
                r.Enqueue(item);
                Console.WriteLine("Queue {0} Inserted: {1} ", name, item.ItemId);
            }
            //logger.WriteLoge("Enqueue: " + ItemToString(item), Mode.INFO);
            Thread.Sleep(10);
        }
Beispiel #3
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);
            }
        }