コード例 #1
0
ファイル: EnvelopeStreamer.cs プロジェクト: 11646729/iSeismic
        public byte[] SaveEnvelopeData(ImmutableEnvelope envelope)
        {
            using (var mem = new MemoryStream())
            {
                byte[] data;
                using (var block = new MemoryStream())
                {
                    MessageSerializer.WriteAttributes(envelope.Attributes, block);
                    MessageSerializer.WriteMessage(envelope.Message, envelope.Message.GetType(), block);
                    data = block.ToArray();
                }

                MessageSerializer.WriteCompactInt(Signature, mem);

                StorageFramesEvil.WriteFrame(envelope.EnvelopeId, envelope.CreatedUtc.Ticks, data, mem);
                return mem.ToArray();
            }
        }
コード例 #2
0
ファイル: MessageStore.cs プロジェクト: 11646729/iSeismic
 public void RecordMessage(string key, ImmutableEnvelope envelope)
 {
     // record properties as attributes
     var attribs = new List<MessageAttribute>(envelope.Attributes.Count + 2)
         {
             new MessageAttribute("id", envelope.EnvelopeId),
             new MessageAttribute("utc", envelope.CreatedUtc.ToString("o"))
         };
     // copy existing attributes
     attribs.AddRange(envelope.Attributes);
     AppendToStore(key, attribs, -1, new[] { envelope.Message });
 }