Beispiel #1
0
 public static PullMessageRequest ReadFromStream(Stream stream)
 {
     using (var reader = new BinaryReader(stream))
     {
         var request = new PullMessageRequest();
         request.ConsumerId                    = reader.ReadString();
         request.ConsumerGroup                 = reader.ReadString();
         request.MessageQueue                  = new MessageQueue(reader.ReadString(), reader.ReadString(), reader.ReadInt32());
         request.Tags                          = reader.ReadString();
         request.QueueOffset                   = reader.ReadInt64();
         request.PullMessageBatchSize          = reader.ReadInt32();
         request.SupendPullRequestMilliseconds = reader.ReadInt64();
         request.ConsumeFromWhere              = (ConsumeFromWhere)reader.ReadInt32();
         request.IgnoreLastConsumedOffset      = reader.ReadBoolean();
         return(request);
     }
 }
Beispiel #2
0
 public static void WriteToStream(PullMessageRequest request, Stream stream)
 {
     using (var writer = new BinaryWriter(stream))
     {
         writer.Write(request.ConsumerId);
         writer.Write(request.ConsumerGroup);
         writer.Write(request.MessageQueue.BrokerName);
         writer.Write(request.MessageQueue.Topic);
         writer.Write(request.MessageQueue.QueueId);
         writer.Write(request.Tags);
         writer.Write(request.QueueOffset);
         writer.Write(request.PullMessageBatchSize);
         writer.Write(request.SupendPullRequestMilliseconds);
         writer.Write((int)request.ConsumeFromWhere);
         writer.Write(request.IgnoreLastConsumedOffset);
     }
 }