Exemplo n.º 1
0
        public void run()
        {
            try
            {
                this.initClient();

                Console.Out.WriteLine("big queue size before enqueue : " + client.getSize(TOPIC));

                QueueRequest req = new QueueRequest();
                req.Data = Encoding.Default.GetBytes("hello world");
                client.enqueue(TOPIC, req);

                Console.Out.WriteLine("big queue size after enqueue : " + client.getSize(TOPIC));

                QueueResponse resp = client.peek(TOPIC);
                Console.Out.WriteLine("big queue size after peek : " + client.getSize(TOPIC));
                Console.Out.WriteLine("peeked message : " + Encoding.Default.GetString(resp.Data));

                resp = client.dequeue(TOPIC);
                Console.Out.WriteLine("big queue size after dequeue : " + client.getSize(TOPIC));
                Console.Out.WriteLine("dequeued message : " + Encoding.Default.GetString(resp.Data));
            }
            finally
            {
                this.closeClient();
            }
        }
Exemplo n.º 2
0
 public void send_enqueue(string topic, QueueRequest req)
 {
   oprot_.WriteMessageBegin(new TMessage("enqueue", TMessageType.Call, seqid_));
   enqueue_args args = new enqueue_args();
   args.Topic = topic;
   args.Req = req;
   args.Write(oprot_);
   oprot_.WriteMessageEnd();
   oprot_.Transport.Flush();
 }
Exemplo n.º 3
0
            public void send_enqueue(string topic, QueueRequest req)
            {
                oprot_.WriteMessageBegin(new TMessage("enqueue", TMessageType.Call, seqid_));
                enqueue_args args = new enqueue_args();

                args.Topic = topic;
                args.Req   = req;
                args.Write(oprot_);
                oprot_.WriteMessageEnd();
                oprot_.Transport.Flush();
            }
Exemplo n.º 4
0
            public void Read(TProtocol iprot)
            {
                TField field;

                iprot.ReadStructBegin();
                while (true)
                {
                    field = iprot.ReadFieldBegin();
                    if (field.Type == TType.Stop)
                    {
                        break;
                    }
                    switch (field.ID)
                    {
                    case 1:
                        if (field.Type == TType.String)
                        {
                            Topic = iprot.ReadString();
                        }
                        else
                        {
                            TProtocolUtil.Skip(iprot, field.Type);
                        }
                        break;

                    case 2:
                        if (field.Type == TType.Struct)
                        {
                            Req = new QueueRequest();
                            Req.Read(iprot);
                        }
                        else
                        {
                            TProtocolUtil.Skip(iprot, field.Type);
                        }
                        break;

                    default:
                        TProtocolUtil.Skip(iprot, field.Type);
                        break;
                    }
                    iprot.ReadFieldEnd();
                }
                iprot.ReadStructEnd();
            }
Exemplo n.º 5
0
 public QueueResponse enqueue(string topic, QueueRequest req)
 {
   send_enqueue(topic, req);
   return recv_enqueue();
 }
Exemplo n.º 6
0
 public void Read (TProtocol iprot)
 {
   TField field;
   iprot.ReadStructBegin();
   while (true)
   {
     field = iprot.ReadFieldBegin();
     if (field.Type == TType.Stop) { 
       break;
     }
     switch (field.ID)
     {
       case 1:
         if (field.Type == TType.String) {
           Topic = iprot.ReadString();
         } else { 
           TProtocolUtil.Skip(iprot, field.Type);
         }
         break;
       case 2:
         if (field.Type == TType.Struct) {
           Req = new QueueRequest();
           Req.Read(iprot);
         } else { 
           TProtocolUtil.Skip(iprot, field.Type);
         }
         break;
       default: 
         TProtocolUtil.Skip(iprot, field.Type);
         break;
     }
     iprot.ReadFieldEnd();
   }
   iprot.ReadStructEnd();
 }
Exemplo n.º 7
0
 public QueueResponse enqueue(string topic, QueueRequest req)
 {
     send_enqueue(topic, req);
     return(recv_enqueue());
 }