public static byte[] SaveEnvelopeData(this IEnvelopeStreamer streamer, object message, Action <EnvelopeBuilder> build = null) { var builder = new EnvelopeBuilder(Guid.NewGuid().ToString()); builder.AddItem(message); if (null != build) { build(builder); } return(streamer.SaveEnvelopeData(builder.Build())); }
void InnerSendBatch(Action <EnvelopeBuilder> configure, object[] messageItems) { var id = _idGenerator(); var builder = new EnvelopeBuilder(id); foreach (var item in messageItems) { builder.AddItem(item); } configure(builder); var envelope = builder.Build(); SendEnvelope(envelope); }
protected override ImmutableEnvelope RoundtripViaSerializer(EnvelopeBuilder builder) { var bytes = _streamer.SaveEnvelopeData(builder.Build()); return(_streamer.ReadAsEnvelopeData(bytes)); }