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
valuesIEnumerable<T>The non-null sequence enumerated and serialized immediately in order.
bindingNamestringThe non-empty worker input name. The default is
messages.topicstringOptional topic metadata; null omits it and empty text is retained.
optionsJsonSerializerOptionsJSON 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
TThe 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
valuesIEnumerable<T>The non-null sequence enumerated and serialized immediately in order.
optionsJsonSerializerOptionsJSON 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
TThe 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
valueTThe value serialized immediately as JSON.
bindingNamestringThe non-empty worker input name. The default is
message.topicstringOptional topic metadata; null omits it and empty text is retained.
partitionKeystringOptional partition-key metadata; null omits it and empty text is retained.
optionsJsonSerializerOptionsJSON 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
TThe 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
valueTThe value serialized immediately; null is emitted when
Tpermits it.optionsJsonSerializerOptionsJSON options to use, or null for new web defaults.
Returns
- string
The serialized JSON message text.
Type Parameters
TThe message value type.