@@ -3,7 +3,7 @@ title: Apache Kafka output binding for Azure Functions
3
3
description : Use Azure Functions to write messages to an Apache Kafka stream.
4
4
ms.topic : reference
5
5
ms.custom : devx-track-extended-java, devx-track-js, devx-track-python
6
- ms.date : 05 /14/2022
6
+ ms.date : 06 /14/2024
7
7
zone_pivot_groups : programming-languages-set-functions-lang-workers
8
8
---
9
9
@@ -37,51 +37,51 @@ The attributes you use depend on the specific event provider.
37
37
38
38
The following example shows a C# function that sends a single message to a Kafka topic, using data provided in HTTP GET request.
39
39
40
- :::code language="json " source="~ /azure-functions-kafka-extension/samples/dotnet/Confluent/KafkaOutput.cs" range="12-32" :::
40
+ :::code language="csharp " source="~ /azure-functions-kafka-extension/samples/dotnet/Confluent/KafkaOutput.cs" range="12-32" :::
41
41
42
42
To send events in a batch, use an array of ` KafkaEventData ` objects, as shown in the following example:
43
43
44
- :::code language="json " source="~ /azure-functions-kafka-extension/samples/dotnet/Confluent/KafkaOutputMany.cs" range="12-30" :::
44
+ :::code language="csharp " source="~ /azure-functions-kafka-extension/samples/dotnet/Confluent/KafkaOutputMany.cs" range="12-30" :::
45
45
46
46
The following function adds headers to the Kafka output data:
47
47
48
- :::code language="json " source="~ /azure-functions-kafka-extension/samples/dotnet/Confluent/KafkaOutputWithHeaders.cs" range="11-31" :::
48
+ :::code language="csharp " source="~ /azure-functions-kafka-extension/samples/dotnet/Confluent/KafkaOutputWithHeaders.cs" range="11-31" :::
49
49
50
50
For a complete set of working .NET examples, see the [ Kafka extension repository] ( https://github.com/Azure/azure-functions-kafka-extension/blob/dev/samples/dotnet/Confluent/ ) .
51
51
52
52
# [ Event Hubs] ( #tab/event-hubs/in-process )
53
53
54
54
The following example shows a C# function that sends a single message to a Kafka topic, using data provided in HTTP GET request.
55
55
56
- :::code language="json " source="~ /azure-functions-kafka-extension/samples/dotnet/EventHub/KafkaOutput.cs" range="11-31" :::
56
+ :::code language="csharp " source="~ /azure-functions-kafka-extension/samples/dotnet/EventHub/KafkaOutput.cs" range="11-31" :::
57
57
58
58
To send events in a batch, use an array of ` KafkaEventData ` objects, as shown in the following example:
59
59
60
- :::code language="json " source="~ /azure-functions-kafka-extension/samples/dotnet/EventHub/KafkaOutputMany.cs" range="12-30" :::
60
+ :::code language="csharp " source="~ /azure-functions-kafka-extension/samples/dotnet/EventHub/KafkaOutputMany.cs" range="12-30" :::
61
61
62
62
The following function adds headers to the Kafka output data:
63
63
64
- :::code language="json " source="~ /azure-functions-kafka-extension/samples/dotnet/EventHub/KafkaOutputWithHeaders.cs" range="11-31" :::
64
+ :::code language="csharp " source="~ /azure-functions-kafka-extension/samples/dotnet/EventHub/KafkaOutputWithHeaders.cs" range="11-31" :::
65
65
66
66
For a complete set of working .NET examples, see the [ Kafka extension repository] ( https://github.com/Azure/azure-functions-kafka-extension/blob/dev/samples/dotnet/EventHub ) .
67
67
68
68
# [ Confluent] ( #tab/confluent/isolated-process )
69
69
70
70
The following example has a custom return type that is ` MultipleOutputType ` , which consists of an HTTP response and a Kafka output.
71
71
72
- :::code language="json " source="~ /azure-functions-kafka-extension/samples/dotnet-isolated/confluent/KafkaOutput.cs" range="11-31" :::
72
+ :::code language="csharp " source="~ /azure-functions-kafka-extension/samples/dotnet-isolated/confluent/KafkaOutput.cs" range="11-31" :::
73
73
74
74
In the class ` MultipleOutputType ` , ` Kevent ` is the output binding variable for the Kafka binding.
75
75
76
- :::code language="json " source="~ /azure-functions-kafka-extension/samples/dotnet-isolated/confluent/KafkaOutput.cs" range="34-46" :::
76
+ :::code language="csharp " source="~ /azure-functions-kafka-extension/samples/dotnet-isolated/confluent/KafkaOutput.cs" range="34-46" :::
77
77
78
78
To send a batch of events, pass a string array to the output type, as shown in the following example:
79
79
80
- :::code language="json " source="~ /azure-functions-kafka-extension/samples/dotnet-isolated/confluent/KafkaOutputMany.cs" range="11-30" :::
80
+ :::code language="csharp " source="~ /azure-functions-kafka-extension/samples/dotnet-isolated/confluent/KafkaOutputMany.cs" range="11-30" :::
81
81
82
82
The string array is defined as ` Kevents ` property on the class, on which the output binding is defined:
83
83
84
- :::code language="json " source="~ /azure-functions-kafka-extension/samples/dotnet-isolated/confluent/KafkaOutputMany.cs" range="33-45" :::
84
+ :::code language="csharp " source="~ /azure-functions-kafka-extension/samples/dotnet-isolated/confluent/KafkaOutputMany.cs" range="33-45" :::
85
85
86
86
The following function adds headers to the Kafka output data:
87
87
@@ -94,19 +94,19 @@ For a complete set of working .NET examples, see the [Kafka extension repository
94
94
95
95
The following example has a custom return type that is ` MultipleOutputType ` , which consists of an HTTP response and a Kafka output.
96
96
97
- :::code language="json " source="~ /azure-functions-kafka-extension/samples/dotnet-isolated/eventhub/KafkaOutput.cs" range="11-31" :::
97
+ :::code language="csharp " source="~ /azure-functions-kafka-extension/samples/dotnet-isolated/eventhub/KafkaOutput.cs" range="11-31" :::
98
98
99
99
In the class ` MultipleOutputType ` , ` Kevent ` is the output binding variable for the Kafka binding.
100
100
101
- :::code language="json " source="~ /azure-functions-kafka-extension/samples/dotnet-isolated/eventhub/KafkaOutput.cs" range="34-46" :::
101
+ :::code language="csharp " source="~ /azure-functions-kafka-extension/samples/dotnet-isolated/eventhub/KafkaOutput.cs" range="34-46" :::
102
102
103
103
To send a batch of events, pass a string array to the output type, as shown in the following example:
104
104
105
- :::code language="json " source="~ /azure-functions-kafka-extension/samples/dotnet-isolated/eventhub/KafkaOutputMany.cs" range="11-30" :::
105
+ :::code language="csharp " source="~ /azure-functions-kafka-extension/samples/dotnet-isolated/eventhub/KafkaOutputMany.cs" range="11-30" :::
106
106
107
107
The string array is defined as ` Kevents ` property on the class, on which the output binding is defined:
108
108
109
- :::code language="json " source="~ /azure-functions-kafka-extension/samples/dotnet-isolated/eventhub/KafkaOutputMany.cs" range="33-45" :::
109
+ :::code language="csharp " source="~ /azure-functions-kafka-extension/samples/dotnet-isolated/eventhub/KafkaOutputMany.cs" range="33-45" :::
110
110
111
111
The following function adds headers to the Kafka output data:
112
112
0 commit comments