示例#1
0
 public void WriteChannelValue(ProducerChannelValue value, PrismRequest.WriteChannelValueCallback cb)
 {
     try
     {
         RequestQueue.Enqueue(new PrismRequest.PrismRequestItem(PrismRequest.PrismRequestItem.PrismRequestMethod.WriteChannel, JsonConvert.SerializeObject(new PrismZmqWriteChannelReqPacket(value)), value, cb));
         RouteProcessQueue();
     }
     catch (SystemException e)
     {
         System.Diagnostics.Debug.WriteLine(e.ToString());
         cb(e.ToString(), null);
     }
 }
示例#2
0
        public PrismRequestProducer(List<string> endpoints)
        {
            Context = ZmqContext.Create();
            RequestWorkers = new List<PrismRequest>();
            RequestQueue = new Queue<PrismRequest.PrismRequestItem>();

            foreach (string endpoint in endpoints)
            {
                PrismRequest requestWorker = new PrismRequest(Context, endpoint, RequestQueue);
                requestWorker.Start();
                RequestWorkers.Add(requestWorker);
            }
        }
示例#3
0
 public void GetChannelList(string group, PrismRequest.GetChannelListCallback cb)
 {
     try
     {
         RequestQueue.Enqueue(new PrismRequest.PrismRequestItem(PrismRequest.PrismRequestItem.PrismRequestMethod.ChannelList, JsonConvert.SerializeObject(new PrismZmqChannelListReqPacket(group)), group, cb));
         RouteProcessQueue();
     }
     catch (SystemException e)
     {
         System.Diagnostics.Debug.WriteLine(e.ToString());
         cb(e.ToString(), null);
     }
 }