Table of Contents

Method SerializeAsync

Namespace
AvroSharp.Aws.Glue
Assembly
AvroSharp.Aws.Glue.dll

SerializeAsync<T>(T, string, CancellationToken)

Writes a value.

public ValueTask<byte[]> SerializeAsync<T>(T value, string transportName, CancellationToken cancellationToken = default)

Parameters

value T

The value.

transportName string

The Kafka topic or Kinesis stream, which names the schema unless SchemaName does.

cancellationToken CancellationToken

Cancels the registry calls, if any are needed.

Returns

ValueTask<byte[]>

Type Parameters

T

The value's type: a type AvroTypes knows, GenericRecord or AvroValue.

Exceptions

InvalidOperationException

The value isn't of a type the serializer can write, or the registry has no version of its schema and auto-registration is off, or a new version didn't become available.

SerializeAsync<T>(T, string, bool, CancellationToken)

Writes a key or a value.

public ValueTask<byte[]> SerializeAsync<T>(T value, string transportName, bool isKey, CancellationToken cancellationToken = default)

Parameters

value T

The key or the value.

transportName string

The Kafka topic or Kinesis stream, which names the schema unless SchemaName does.

isKey bool

Whether it's a message key, which SchemaNameStrategy can name apart from values.

cancellationToken CancellationToken

Cancels the registry calls, if any are needed.

Returns

ValueTask<byte[]>

Type Parameters

T

The value's type: a type AvroTypes knows, GenericRecord or AvroValue.

Exceptions

InvalidOperationException

The value isn't of a type the serializer can write, or the registry has no version of its schema and auto-registration is off, or a new version didn't become available.