Class CloudEvent<T>
- Namespace
- Savvyio.EventDriven.Messaging.CloudEvents
- Assembly
- Savvyio.EventDriven.Messaging.dll
Provides a default implementation of the ICloudEvent<T> interface.
public record 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
TThe type of the payload constraint to the IIntegrationEvent interface.
- Inheritance
-
objectCloudEvent<T>
- Implements
-
ICloudEvent<T>IMessage<T>IEquatable<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
messageIMessage<T>The message to elevate to an ICloudEvent<T> compliance.
specversionstringThe version of the CloudEvents specification which the event uses.
Exceptions
- ArgumentNullException
messagecannot be null.
Properties
Data
Gets the event payload.
public T Data { get; }
Property Value
- T
The event payload.
Remarks
this[string]
Gets or sets the element with the specified key.
public object this[string key] { get; set; }
Parameters
keystringThe 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
keystringThe object to use as the key of the element to add.
valueobjectThe 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
keystringThe key to locate in the CloudEvent.
Returns
- bool
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
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 CloudEvent.
TryGetValue(string, out object)
Gets the value associated with the specified key.
public 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 CloudEvent contains an element with the specified key; otherwise, false.