Class KafkaTriggerData

Namespace
XBullet.EasyTesting.AzureFunctions
Assembly
XBullet.EasyTesting.AzureFunctions.dll

Creates payloads for Kafka-trigger function tests.

public static class KafkaTriggerData
Inheritance
KafkaTriggerData
Inherited Members

Methods

JsonBatchTrigger<T>(IEnumerable<T>, string, string?, JsonSerializerOptions?)

Creates a JSON batch together with capturable Kafka trigger metadata.

public static TestTriggerData<string[]> JsonBatchTrigger<T>(IEnumerable<T> values, string bindingName = "messages", string? topic = null, JsonSerializerOptions? options = null)

Parameters

values IEnumerable<T>

The non-null sequence enumerated and serialized immediately in order.

bindingName string

The non-empty worker input name. The default is messages.

topic string

Optional topic metadata; null omits it and empty text is retained.

options JsonSerializerOptions

JSON options used for every item, or null for web defaults.

Returns

TestTriggerData<string[]>

New string-array trigger data with Kafka binding type and optional topic metadata.

Type Parameters

T

The message value type.

JsonBatch<T>(IEnumerable<T>, JsonSerializerOptions?)

Serializes a batch of Kafka message values as JSON strings.

public static string[] JsonBatch<T>(IEnumerable<T> values, JsonSerializerOptions? options = null)

Parameters

values IEnumerable<T>

The non-null sequence enumerated and serialized immediately in order.

options JsonSerializerOptions

JSON options to use for every value, or null for web defaults.

Returns

string[]

A newly allocated array of serialized messages; an empty sequence produces an empty array.

Type Parameters

T

The message value type.

JsonTrigger<T>(T, string, string?, string?, JsonSerializerOptions?)

Creates one JSON message together with capturable Kafka trigger metadata.

public static TestTriggerData<string> JsonTrigger<T>(T value, string bindingName = "message", string? topic = null, string? partitionKey = null, JsonSerializerOptions? options = null)

Parameters

value T

The value serialized immediately as JSON.

bindingName string

The non-empty worker input name. The default is message.

topic string

Optional topic metadata; null omits it and empty text is retained.

partitionKey string

Optional partition-key metadata; null omits it and empty text is retained.

options JsonSerializerOptions

JSON options to use, or null for web defaults.

Returns

TestTriggerData<string>

New string trigger data with Kafka binding type and the supplied optional metadata.

Type Parameters

T

The message value type.

Json<T>(T, JsonSerializerOptions?)

Serializes one Kafka message value as JSON.

public static string Json<T>(T value, JsonSerializerOptions? options = null)

Parameters

value T

The value serialized immediately; null is emitted when T permits it.

options JsonSerializerOptions

JSON options to use, or null for new web defaults.

Returns

string

The serialized JSON message text.

Type Parameters

T

The message value type.