How to migrate KafkaTrigger from in-process to isolated when using schema registry and AVRO

Greg Moyer 1 Reputation point
2024-07-17T16:48:17.22+00:00

Microsoft is recommending migrating Function apps from in-process to isolated which I am doing in dotnet8. The in-process KafkaTrigger is returning KafkaEventData<byte[]>. With dotnet-isolated it uses Microsoft.Azure.Functions.Worker.Extensions.Kafka that does not contain KafkaEventData. I see in the trigger that there are properties for SchemaRegistryUrl, and AvroSchema but they don't seem to work. The examples in the documentation show the event return type as either a string or a string array (if IsBatched = true). What are all the different return types? I see that byte[] works, but IEnumerable<byte[]> does not work.

Can someone please provide dotnet8 samples of KafkaTrigger that show how to get events batched and not batched, how to use the schema registry, and how to deserialize from AVRO. I am only using Value, but would be nice to also know if Key is supported also. Also if using SslCaLocation if that will also apply to the SchemaRegistryUrl (assuming that works).

Azure Functions
Azure Functions
An Azure service that provides an event-driven serverless compute platform.
4,669 questions
C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
10,643 questions
0 comments No comments
{count} votes