Ejemplo n.º 1
0
        /// <summary>
        /// 消费者 IO 线程同步实时处理数据
        /// </summary>
        private void synchronousStream()
        {
            enqueue();

            start(CallbackType.SynchronousStream, TestType.MessageDistributionDequeue);
            using (AutoCSer.CacheServer.MessageQueue.Abstract.DistributionConsumer consumer1 = distributor.CreateConsumerStream(onMessage, getConfig()))
                using (AutoCSer.CacheServer.MessageQueue.Abstract.DistributionConsumer consumer2 = distributor.CreateConsumerStream(onMessage, getConfig()))
                {
                    wait();
                }
            client.RemoveDataStructure(cacheName);
        }
Ejemplo n.º 2
0
 /// <summary>
 /// 消费者 IO 线程同步实时处理数据(生产消费实时并行测试)
 /// </summary>
 private void synchronousStreamMixing()
 {
     client.RemoveDataStructure(cacheName);
     distributor = client.GetOrCreateDataStructure <Distributor <Binary <Message> > >(cacheName);
     bitArray.SetAll(false);
     errorCount = messageIndex = 0;
     start(CallbackType.SynchronousStream, TestType.MessageDistributionMixing, 2);
     using (AutoCSer.CacheServer.MessageQueue.Abstract.DistributionConsumer consumer1 = distributor.CreateConsumerStream(onMessageInterlocked, getConfig()))
         using (AutoCSer.CacheServer.MessageQueue.Abstract.DistributionConsumer consumer2 = distributor.CreateConsumerStream(onMessageInterlocked, getConfig()))
         {
             for (int index = 0; index != count; ++index)
             {
                 distributor.EnqueueStream(new Message {
                     Value = index
                 }, enqueueCallbackInterlockedReturnParameter);
             }
             wait();
         }
     client.RemoveDataStructure(cacheName);
 }