Class MessageHeaders
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
other
MessageHeaders
MessageHeaders(IDictionary<string, object>)
public MessageHeaders(IDictionary<string, object> headers = null)
Parameters
headers
IDictionary<string, object>
MessageHeaders(IDictionary<string, object>, string, long?)
public MessageHeaders(IDictionary<string, object> headers, string id, long? timestamp)
Parameters
headers
IDictionary<string, object>id
stringtimestamp
long?
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
key
object
Property Value
this[string]
Gets or sets the element with the specified key.
public virtual object this[string key] { get; set; }
Parameters
key
stringThe key of the element to get or set.
Property Value
- object
The element with the specified key.
Exceptions
- ArgumentNullException
key
is null.- KeyNotFoundException
The property is retrieved and
key
is 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
item
KeyValuePair<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
key
stringThe object to use as the key of the element to add.
value
objectThe object to use as the value of the element to add.
Exceptions
- ArgumentNullException
key
is 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
item
KeyValuePair<string, object>The object to locate in the ICollection<T>.
Returns
- bool
true if
item
is found in the ICollection<T>; otherwise, false.
Contains(object)
public virtual bool Contains(object key)
Parameters
key
object
Returns
ContainsKey(string)
Determines whether the IDictionary<TKey, TValue> contains an element with the specified key.
public virtual bool ContainsKey(string key)
Parameters
key
stringThe 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
key
is 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
array
KeyValuePair<string, object>[]The one-dimensional Array that is the destination of the elements copied from ICollection<T>. The Array must have zero-based indexing.
arrayIndex
intThe zero-based index in
array
at which copying begins.
Exceptions
- ArgumentNullException
array
is null.- ArgumentOutOfRangeException
arrayIndex
is less than 0.- ArgumentException
The number of elements in the source ICollection<T> is greater than the available space from
arrayIndex
to 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
obj
objectThe object to compare with the current object.
Returns
From(MessageHeaders)
public static MessageHeaders From(MessageHeaders other)
Parameters
other
MessageHeaders
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
key
stringthe name of the header
Returns
- T
the value or null if not found
Type Parameters
T
the 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
item
KeyValuePair<string, object>The object to remove from the ICollection<T>.
Returns
- bool
true if
item
was successfully removed from the ICollection<T>; otherwise, false. This method also returns false ifitem
is not found in the original ICollection<T>.
Exceptions
- NotSupportedException
The ICollection<T> is read-only.
Remove(object)
public virtual void Remove(object key)
Parameters
key
object
Remove(string)
Removes the element with the specified key from the IDictionary<TKey, TValue>.
public virtual bool Remove(string key)
Parameters
key
stringThe key of the element to remove.
Returns
- bool
true if the element is successfully removed; otherwise, false. This method also returns false if
key
was not found in the original IDictionary<TKey, TValue>.
Exceptions
- ArgumentNullException
key
is 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
key
stringThe key whose value to get.
value
objectWhen this method returns, the value associated with the specified key, if the key is found; otherwise, the default value for the type of the
value
parameter. 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
key
is null.
UpdateHeaders(string, long?)
protected void UpdateHeaders(string id, long? timestamp)