Table of Contents

Class CloudEventExtensions

Namespace
Virtufin.Api.Services
Assembly
Virtufin.Api.dll
public static class CloudEventExtensions
Inheritance
CloudEventExtensions
Inherited Members

Methods

BuildCloudEvent(string, string, byte[], string?, DateTimeOffset?, string?)

Build a CloudEvent proto from attributes and data.

public static CloudEvent BuildCloudEvent(string type, string source, byte[] data, string? id = null, DateTimeOffset? time = null, string? topic = null)

Parameters

type string
source string
data byte[]
id string
time DateTimeOffset?
topic string

Returns

CloudEvent

ToStreamBytes(CloudEvent)

Encodes a CloudEvent for a topic's stream: as protobuf, whatever its data (binary, text or a protobuf message), with every attribute in the type it was given in. The one attribute that changes is a time given as a string, which becomes a timestamp, on ce itself too: the stream holds one form of an event's time. Every publisher of the gateway goes through here, so a stream entry is always a protobuf CloudEvent. Throws CloudEventAttributeException for an attribute the CloudEvents SDK rejects (a time that is not RFC 3339, for one).

public static byte[] ToStreamBytes(this CloudEvent ce)

Parameters

ce CloudEvent

Returns

byte[]

ValidateAttributes(CloudEvent)

Validate a CloudEvent proto's attributes with the CloudEvents SDK's typed attribute setters, without encoding it. Throws CloudEventAttributeException for an attribute the SDK rejects.

public static void ValidateAttributes(CloudEvent ce)

Parameters

ce CloudEvent