Class MessageHeaders
[Obsolete("This feature will be removed in the next major version. See https://steeltoe.io/docs/v3/obsolete for details.")]
public class MessageHeaders : IMessageHeaders, IDictionary, ICollection, IDictionary<string, object>, ICollection<KeyValuePair<string, object>>, IEnumerable<KeyValuePair<string, object>>, IEnumerable
- Inheritance
-
MessageHeaders
- Implements
- Derived
- Inherited Members
Constructors
MessageHeaders(MessageHeaders)
protected MessageHeaders(MessageHeaders other)
Parameters
otherMessageHeaders
MessageHeaders(IDictionary<string, object>)
public MessageHeaders(IDictionary<string, object> headers = null)
Parameters
headersIDictionary<string, object>
MessageHeaders(IDictionary<string, object>, string, long?)
public MessageHeaders(IDictionary<string, object> headers, string id, long? timestamp)
Parameters
headersIDictionary<string, object>idstringtimestamplong?
Fields
CONTENT_TYPE
public const string CONTENT_TYPE = "contentType"
Field Value
CONTENT_TYPE_BYTES
public const string CONTENT_TYPE_BYTES = "application/octet-stream"
Field Value
CONTENT_TYPE_DOTNET_SERIALIZED_OBJECT
public const string CONTENT_TYPE_DOTNET_SERIALIZED_OBJECT = "application/x-dotnet-serialized-object"
Field Value
CONTENT_TYPE_ID
public const string CONTENT_TYPE_ID = "__ContentTypeId__"
Field Value
CONTENT_TYPE_JAVA_SERIALIZED_OBJECT
public const string CONTENT_TYPE_JAVA_SERIALIZED_OBJECT = "application/x-java-serialized-object"
Field Value
CONTENT_TYPE_JSON
public const string CONTENT_TYPE_JSON = "application/json"
Field Value
CONTENT_TYPE_JSON_ALT
public const string CONTENT_TYPE_JSON_ALT = "text/x-json"
Field Value
CONTENT_TYPE_TEXT_PLAIN
public const string CONTENT_TYPE_TEXT_PLAIN = "text/plain"
Field Value
CONTENT_TYPE_XML
public const string CONTENT_TYPE_XML = "application/xml"
Field Value
ERROR_CHANNEL
public const string ERROR_CHANNEL = "errorChannel"
Field Value
ID
public const string ID = "id"
Field Value
ID_VALUE_NONE
public static readonly string ID_VALUE_NONE
Field Value
INFERRED_ARGUMENT_TYPE
public const string INFERRED_ARGUMENT_TYPE = "internal_InferredArgumentType"
Field Value
INTERNAL
public const string INTERNAL = "internal_"
Field Value
KEY_TYPE_ID
public const string KEY_TYPE_ID = "__KeyTypeId__"
Field Value
REPLY_CHANNEL
public const string REPLY_CHANNEL = "replyChannel"
Field Value
TIMESTAMP
public const string TIMESTAMP = "timestamp"
Field Value
TYPE_ID
public const string TYPE_ID = "__TypeId__"
Field Value
headers
protected readonly IDictionary<string, object> headers
Field Value
Properties
Count
public virtual int Count { get; }
Property Value
ErrorChannel
Gets the error channel the message is for
public virtual object ErrorChannel { get; }
Property Value
Id
Gets the ID header value
public virtual string Id { get; }
Property Value
IsFixedSize
public virtual bool IsFixedSize { get; }
Property Value
IsReadOnly
Gets a value indicating whether the IDictionary object is read-only.
public virtual bool IsReadOnly { get; }
Property Value
- bool
true if the IDictionary object is read-only; otherwise, false.
IsSynchronized
public virtual bool IsSynchronized { get; }
Property Value
this[object]
public virtual object this[object key] { get; set; }
Parameters
keyobject
Property Value
this[string]
Gets or sets the element with the specified key.
public virtual object this[string key] { get; set; }
Parameters
keystringThe key of the element to get or set.
Property Value
- object
The element with the specified key.
Exceptions
- ArgumentNullException
keyis null.- KeyNotFoundException
The property is retrieved and
keyis not found.- NotSupportedException
The property is set and the IDictionary<TKey, TValue> is read-only.
Keys
public virtual ICollection<string> Keys { get; }
Property Value
RawHeaders
protected virtual IDictionary<string, object> RawHeaders { get; }
Property Value
ReplyChannel
Gets the reply channel the message is for
public virtual object ReplyChannel { get; }
Property Value
SyncRoot
public virtual object SyncRoot { get; }
Property Value
Timestamp
Gets the timestamp header value
public virtual long? Timestamp { get; }
Property Value
- long?
Values
public virtual ICollection<object> Values { get; }
Property Value
Methods
Add(KeyValuePair<string, object>)
Adds an item to the ICollection<T>.
public virtual void Add(KeyValuePair<string, object> item)
Parameters
itemKeyValuePair<string, object>The object to add to the ICollection<T>.
Exceptions
- NotSupportedException
The ICollection<T> is read-only.
Add(object, object)
public virtual void Add(object key, object value)
Parameters
Add(string, object)
Adds an element with the provided key and value to the IDictionary<TKey, TValue>.
public virtual void Add(string key, object value)
Parameters
keystringThe object to use as the key of the element to add.
valueobjectThe object to use as the value of the element to add.
Exceptions
- ArgumentNullException
keyis null.- ArgumentException
An element with the same key already exists in the IDictionary<TKey, TValue>.
- NotSupportedException
The IDictionary<TKey, TValue> is read-only.
Clear()
Removes all elements from the IDictionary object.
public virtual void Clear()
Exceptions
- NotSupportedException
The IDictionary object is read-only.
Contains(KeyValuePair<string, object>)
Determines whether the ICollection<T> contains a specific value.
public virtual bool Contains(KeyValuePair<string, object> item)
Parameters
itemKeyValuePair<string, object>The object to locate in the ICollection<T>.
Returns
- bool
true if
itemis found in the ICollection<T>; otherwise, false.
Contains(object)
public virtual bool Contains(object key)
Parameters
keyobject
Returns
ContainsKey(string)
Determines whether the IDictionary<TKey, TValue> contains an element with the specified key.
public virtual bool ContainsKey(string key)
Parameters
keystringThe key to locate in the IDictionary<TKey, TValue>.
Returns
- bool
true if the IDictionary<TKey, TValue> contains an element with the key; otherwise, false.
Exceptions
- ArgumentNullException
keyis null.
CopyTo(Array, int)
public virtual void CopyTo(Array array, int index)
Parameters
CopyTo(KeyValuePair<string, object>[], int)
Copies the elements of the ICollection<T> to an Array, starting at a particular Array index.
public virtual void CopyTo(KeyValuePair<string, object>[] array, int arrayIndex)
Parameters
arrayKeyValuePair<string, object>[]The one-dimensional Array that is the destination of the elements copied from ICollection<T>. The Array must have zero-based indexing.
arrayIndexintThe zero-based index in
arrayat which copying begins.
Exceptions
- ArgumentNullException
arrayis null.- ArgumentOutOfRangeException
arrayIndexis less than 0.- ArgumentException
The number of elements in the source ICollection<T> is greater than the available space from
arrayIndexto the end of the destinationarray.
Equals(object)
Determines whether the specified object is equal to the current object.
public override bool Equals(object obj)
Parameters
objobjectThe object to compare with the current object.
Returns
From(MessageHeaders)
public static MessageHeaders From(MessageHeaders other)
Parameters
otherMessageHeaders
Returns
GetEnumerator()
public virtual IEnumerator<KeyValuePair<string, object>> GetEnumerator()
Returns
GetHashCode()
Serves as the default hash function.
public override int GetHashCode()
Returns
- int
A hash code for the current object.
Get<T>(string)
Gets a header value given its key
public virtual T Get<T>(string key)
Parameters
keystringthe name of the header
Returns
- T
the value or null if not found
Type Parameters
Tthe type of the value returned
Remove(KeyValuePair<string, object>)
Removes the first occurrence of a specific object from the ICollection<T>.
public virtual bool Remove(KeyValuePair<string, object> item)
Parameters
itemKeyValuePair<string, object>The object to remove from the ICollection<T>.
Returns
- bool
true if
itemwas successfully removed from the ICollection<T>; otherwise, false. This method also returns false ifitemis not found in the original ICollection<T>.
Exceptions
- NotSupportedException
The ICollection<T> is read-only.
Remove(object)
public virtual void Remove(object key)
Parameters
keyobject
Remove(string)
Removes the element with the specified key from the IDictionary<TKey, TValue>.
public virtual bool Remove(string key)
Parameters
keystringThe key of the element to remove.
Returns
- bool
true if the element is successfully removed; otherwise, false. This method also returns false if
keywas not found in the original IDictionary<TKey, TValue>.
Exceptions
- ArgumentNullException
keyis null.- NotSupportedException
The IDictionary<TKey, TValue> is read-only.
ToString()
Returns a string that represents the current object.
public override string ToString()
Returns
- string
A string that represents the current object.
TryGetValue(string, out object)
Gets the value associated with the specified key.
public virtual bool TryGetValue(string key, out object value)
Parameters
keystringThe key whose value to get.
valueobjectWhen this method returns, the value associated with the specified key, if the key is found; otherwise, the default value for the type of the
valueparameter. This parameter is passed uninitialized.
Returns
- bool
true if the object that implements IDictionary<TKey, TValue> contains an element with the specified key; otherwise, false.
Exceptions
- ArgumentNullException
keyis null.
UpdateHeaders(string, long?)
protected void UpdateHeaders(string id, long? timestamp)