Class CloudEvent<T>
- Assembly
- Savvyio.EventDriven.Messaging.dll
Provides a default implementation of the ICloudEvent<T> interface.
public class CloudEvent<T> : CloudEvent, IEquatable<Acknowledgeable>, IEquatable<CloudEvent>, ICloudEvent<T>, IMessage<T>, IAcknowledgeable, IDictionary<string, object>, ICollection<KeyValuePair<string, object>>, IEnumerable<KeyValuePair<string, object>>, IEnumerable, IEquatable<CloudEvent<T>> where T : IIntegrationEvent
Type Parameters
T
The type of the payload constraint to the IIntegrationEvent interface.
- Inheritance
-
ObjectCloudEvent<T>
- Implements
-
IEquatable<Acknowledgeable>IEquatable<CloudEvent>ICloudEvent<T>IMessage<T>IDictionary<String, Object>ICollection<KeyValuePair<String, Object>>IEnumerable<KeyValuePair<String, Object>>IEnumerableIEquatable<CloudEvent<T>>
- Derived
- Inherited Members
- Extension Methods
Constructors
CloudEvent(IMessage<T>, String)
Initializes a new instance of the CloudEvent<T> class.
public CloudEvent(IMessage<T> message, string specversion = null)
Parameters
message
IMessage<T>The message to elevate to an ICloudEvent<T> compliance.
specversion
StringThe version of the CloudEvents specification which the event uses.
Exceptions
- System.ArgumentNullException
message
cannot be null.
Properties
Data
Gets the event payload.
public T Data { get; }
Property Value
- T
The event payload.
Remarks
Item[String]
Gets or sets the element with the specified key.
public object this[string key] { get; set; }
Parameters
key
StringThe key of the value to get or set.
Property Value
- Object
The value associated with the specified key.
Methods
Add(String, Object)
Adds an element with the provided key and value to the CloudEvent.
public 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.
Clear()
Removes all items from the CloudEvent.
public void Clear()
ContainsKey(String)
Determines whether the CloudEvent contains an element with the specified key.
public bool ContainsKey(string key)
Parameters
key
StringThe key to locate in the CloudEvent.
Returns
- Boolean
true if the CloudEvent contains an element with the key; otherwise, false.
Remove(String)
Removes the element with the specified key from the CloudEvent.
public bool Remove(string key)
Parameters
key
StringThe key of the element to remove.
Returns
- Boolean
true if the element is successfully removed; otherwise, false. This method also returns false if
key
was not found in the original CloudEvent.
TryGetValue(String, out Object)
Gets the value associated with the specified key.
public 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
- Boolean
true if the object that implements CloudEvent contains an element with the specified key; otherwise, false.
Explicit Interface Implementations
ICollection<KeyValuePair<String, Object>>.Add(KeyValuePair<String, Object>)
void ICollection<KeyValuePair<string, object>>.Add(KeyValuePair<string, object> item)
Parameters
item
KeyValuePair<String, Object>
ICollection<KeyValuePair<String, Object>>.Contains(KeyValuePair<String, Object>)
bool ICollection<KeyValuePair<string, object>>.Contains(KeyValuePair<string, object> item)
Parameters
item
KeyValuePair<String, Object>
Returns
- Boolean
ICollection<KeyValuePair<String, Object>>.CopyTo(KeyValuePair<String, Object>[], Int32)
void ICollection<KeyValuePair<string, object>>.CopyTo(KeyValuePair<string, object>[] array, int arrayIndex)
Parameters
array
KeyValuePair<String, Object>[]arrayIndex
Int32
ICollection<KeyValuePair<String, Object>>.Count
int ICollection<KeyValuePair<string, object>>.Count { get; }
Returns
- Int32
ICollection<KeyValuePair<String, Object>>.IsReadOnly
bool ICollection<KeyValuePair<string, object>>.IsReadOnly { get; }
Returns
- Boolean
ICollection<KeyValuePair<String, Object>>.Remove(KeyValuePair<String, Object>)
bool ICollection<KeyValuePair<string, object>>.Remove(KeyValuePair<string, object> item)
Parameters
item
KeyValuePair<String, Object>
Returns
- Boolean
IDictionary<String, Object>.Keys
ICollection<string> IDictionary<string, object>.Keys { get; }
Returns
- ICollection<String>
IDictionary<String, Object>.Values
ICollection<object> IDictionary<string, object>.Values { get; }
Returns
- ICollection<Object>
IEnumerable<KeyValuePair<String, Object>>.GetEnumerator()
IEnumerator<KeyValuePair<string, object>> IEnumerable<KeyValuePair<string, object>>.GetEnumerator()
Returns
- IEnumerator<KeyValuePair<String, Object>>
IEnumerable.GetEnumerator()
IEnumerator IEnumerable.GetEnumerator()
Returns
- IEnumerator