18 using System.Collections.Generic;
20 namespace Deveel.Data.Protocol {
22 private static int dispatchCounter = -1;
29 if (!metadata.TryGetValue(
"DispatchID", out dispatchId))
30 throw new ArgumentException(
"Metadata must specify a Dispatch ID");
32 DispatchId = (int) dispatchId;
35 public IDictionary<string, object> Metadata {
get;
private set; }
37 public int DispatchId {
get;
private set; }
49 var metadata =
new Dictionary<string, object>();
50 metadata[
"DispatchID"] = dispatchId;
56 metadata =
new Dictionary<string, object>();
59 if (!metadata.TryGetValue(
"DispatchID", out dispatchId))
60 dispatchId = dispatchCounter++;
62 metadata[
"DispatchID"] = dispatchId;
EmbeddedMessageEnvelope(IDictionary< string, object > metadata, IMessage message)
static EmbeddedMessageEnvelope Create(int dispatchId, IMessage message)
void SetError(Exception error)
static EmbeddedMessageEnvelope Create(IDictionary< string, object > metadata, IMessage message)