Пример #1
0
        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
 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 });
 }