public Letter Clone() { var clone = this.Clone <Letter>(); clone.LetterMetadata = LetterMetadata.Clone <LetterMetadata>(); return(clone); }
public Letter Clone() { var metadata = new LetterMetadata { Compressed = LetterMetadata.Compressed, Encrypted = LetterMetadata.Encrypted, }; foreach (var kvp in LetterMetadata.CustomFields) { metadata.CustomFields.Add(kvp.Key, kvp.Value); } return(new Letter { Envelope = new Envelope { Exchange = Envelope.Exchange, RoutingKey = Envelope.RoutingKey, RoutingOptions = new RoutingOptions { DeliveryMode = Envelope.RoutingOptions?.DeliveryMode ?? 2, Mandatory = Envelope.RoutingOptions?.Mandatory ?? false, PriorityLevel = Envelope.RoutingOptions?.PriorityLevel ?? 0, } }, LetterMetadata = metadata }); }
public Letter(string exchange, string routingKey, byte[] data, LetterMetadata metadata = null, RoutingOptions routingOptions = null) { Envelope = new Envelope { Exchange = exchange, RoutingKey = routingKey, RoutingOptions = routingOptions ?? RoutingOptions.CreateDefaultRoutingOptions() }; Body = data; LetterMetadata = metadata ?? new LetterMetadata(); }
public Letter(string exchange, string routingKey, byte[] data, string id, RoutingOptions routingOptions = null) { Envelope = new Envelope { Exchange = exchange, RoutingKey = routingKey, RoutingOptions = routingOptions ?? RoutingOptions.CreateDefaultRoutingOptions() }; Body = data; if (!string.IsNullOrWhiteSpace(id)) { LetterMetadata = new LetterMetadata { Id = id }; } else { LetterMetadata = new LetterMetadata(); } }
public IDictionary <string, object> GetHeadersOutOfMetadata() => LetterMetadata.GetHeadersOutOfMetadata();
public bool RemoveHeader(string key) => LetterMetadata.RemoveHeader(key);
public T GetHeader <T>(string key) => LetterMetadata.GetHeader <T>(key);