3030from azure .functions .decorators .http import HttpTrigger , HttpOutput , \
3131 HttpMethod
3232from azure .functions .decorators .kafka import KafkaTrigger , KafkaOutput , \
33- BrokerAuthenticationMode , BrokerProtocol , OAuthBearerMethod
33+ BrokerAuthenticationMode , BrokerProtocol , OAuthBearerMethod , \
34+ KafkaMessageKeyType
3435from azure .functions .decorators .queue import QueueTrigger , QueueOutput
3536from azure .functions .decorators .servicebus import ServiceBusQueueTrigger , \
3637 ServiceBusQueueOutput , ServiceBusTopicTrigger , \
@@ -1244,12 +1245,18 @@ def kafka_trigger(self,
12441245 event_hub_connection_string : Optional [str ] = None ,
12451246 consumer_group : Optional [str ] = None ,
12461247 avro_schema : Optional [str ] = None ,
1248+ key_avro_schema : Optional [str ] = None ,
1249+ key_data_type : Optional [Union [KafkaMessageKeyType , str ]] = None ,
12471250 username : Optional [str ] = None ,
12481251 password : Optional [str ] = None ,
12491252 ssl_key_location : Optional [str ] = None ,
12501253 ssl_ca_location : Optional [str ] = None ,
12511254 ssl_certificate_location : Optional [str ] = None ,
12521255 ssl_key_password : Optional [str ] = None ,
1256+ ssl_certificate_pem : Optional [str ] = None ,
1257+ ssl_key_pem : Optional [str ] = None ,
1258+ ssl_ca_pem : Optional [str ] = None ,
1259+ ssl_certificate_and_key_pem : Optional [str ] = None ,
12531260 schema_registry_url : Optional [str ] = None ,
12541261 schema_registry_username : Optional [str ] = None ,
12551262 schema_registry_password : Optional [str ] = None ,
@@ -1287,6 +1294,10 @@ def kafka_trigger(self,
12871294 Azure Event Hubs).
12881295 :param consumer_group: Kafka consumer group used by the trigger.
12891296 :param avro_schema: Used only if a generic Avro record should be generated.
1297+ :param key_avro_schema: Avro schema for the message key. Used only if a
1298+ generic Avro record should be generated for the key.
1299+ :param key_data_type: Data type of the message key. Valid values: Int, Long,
1300+ String, Binary. Default is String. Ignored if key_avro_schema is set.
12901301 :param username: SASL username for use with the PLAIN or SASL-SCRAM mechanisms.
12911302 Equivalent to 'sasl.username' in librdkafka. Default is empty string.
12921303 :param password: SASL password for use with the PLAIN or SASL-SCRAM mechanisms.
@@ -1338,12 +1349,19 @@ def decorator():
13381349 event_hub_connection_string = event_hub_connection_string , # noqa: E501
13391350 consumer_group = consumer_group ,
13401351 avro_schema = avro_schema ,
1352+ key_avro_schema = key_avro_schema ,
1353+ key_data_type = parse_singular_param_to_enum (
1354+ key_data_type , KafkaMessageKeyType ),
13411355 username = username ,
13421356 password = password ,
13431357 ssl_key_location = ssl_key_location ,
13441358 ssl_ca_location = ssl_ca_location ,
13451359 ssl_certificate_location = ssl_certificate_location ,
13461360 ssl_key_password = ssl_key_password ,
1361+ ssl_certificate_pem = ssl_certificate_pem ,
1362+ ssl_key_pem = ssl_key_pem ,
1363+ ssl_ca_pem = ssl_ca_pem ,
1364+ ssl_certificate_and_key_pem = ssl_certificate_and_key_pem ,
13471365 schema_registry_url = schema_registry_url ,
13481366 schema_registry_username = schema_registry_username ,
13491367 schema_registry_password = schema_registry_password ,
@@ -2588,12 +2606,18 @@ def kafka_output(self,
25882606 topic : str ,
25892607 broker_list : str ,
25902608 avro_schema : Optional [str ] = None ,
2609+ key_avro_schema : Optional [str ] = None ,
2610+ key_data_type : Optional [Union [KafkaMessageKeyType , str ]] = None ,
25912611 username : Optional [str ] = None ,
25922612 password : Optional [str ] = None ,
25932613 ssl_key_location : Optional [str ] = None ,
25942614 ssl_ca_location : Optional [str ] = None ,
25952615 ssl_certificate_location : Optional [str ] = None ,
25962616 ssl_key_password : Optional [str ] = None ,
2617+ ssl_certificate_pem : Optional [str ] = None ,
2618+ ssl_key_pem : Optional [str ] = None ,
2619+ ssl_ca_pem : Optional [str ] = None ,
2620+ ssl_certificate_and_key_pem : Optional [str ] = None ,
25972621 schema_registry_url : Optional [str ] = None ,
25982622 schema_registry_username : Optional [str ] = None ,
25992623 schema_registry_password : Optional [str ] = None ,
@@ -2630,6 +2654,10 @@ def kafka_output(self,
26302654 :param topic: The Kafka topic to which messages are published.
26312655 :param broker_list: The list of Kafka brokers to which the producer connects.
26322656 :param avro_schema: Optional. Avro schema to generate a generic record.
2657+ :param key_avro_schema: Avro schema for the message key. Used only if a
2658+ generic Avro record should be generated for the key.
2659+ :param key_data_type: Data type of the message key. Valid values: Int, Long,
2660+ String, Binary. Default is String. Ignored if key_avro_schema is set.
26332661 :param username: SASL username for use with the PLAIN and SASL-SCRAM
26342662 mechanisms. Equivalent to `'sasl.username'` in librdkafka.
26352663 :param password: SASL password for use with the PLAIN and SASL-SCRAM
@@ -2642,6 +2670,14 @@ def kafka_output(self,
26422670 Equivalent to `'ssl.certificate.location'` in librdkafka.
26432671 :param ssl_key_password: Password for the client's SSL key.
26442672 Equivalent to `'ssl.key.password'` in librdkafka.
2673+ :param ssl_certificate_pem: Client certificate in PEM format.
2674+ Equivalent to 'ssl.certificate.pem' in librdkafka.
2675+ :param ssl_key_pem: Client private key in PEM format.
2676+ Equivalent to 'ssl.key.pem' in librdkafka.
2677+ :param ssl_ca_pem: CA certificate for verifying the broker's certificate in PEM format.
2678+ Equivalent to 'ssl.ca.pem' in librdkafka.
2679+ :param ssl_certificate_and_key_pem: Client certificate and key in PEM format.
2680+ Additional configuration for KeyVault support (certificate with private key).
26452681 :param schema_registry_url: URL of the Avro Schema Registry.
26462682 :param schema_registry_username: Username for accessing the Schema Registry.
26472683 :param schema_registry_password: Password for accessing the Schema Registry.
@@ -2695,12 +2731,19 @@ def decorator():
26952731 topic = topic ,
26962732 broker_list = broker_list ,
26972733 avro_schema = avro_schema ,
2734+ key_avro_schema = key_avro_schema ,
2735+ key_data_type = parse_singular_param_to_enum (
2736+ key_data_type , KafkaMessageKeyType ),
26982737 username = username ,
26992738 password = password ,
27002739 ssl_key_location = ssl_key_location ,
27012740 ssl_ca_location = ssl_ca_location ,
27022741 ssl_certificate_location = ssl_certificate_location ,
27032742 ssl_key_password = ssl_key_password ,
2743+ ssl_certificate_pem = ssl_certificate_pem ,
2744+ ssl_key_pem = ssl_key_pem ,
2745+ ssl_ca_pem = ssl_ca_pem ,
2746+ ssl_certificate_and_key_pem = ssl_certificate_and_key_pem ,
27042747 schema_registry_url = schema_registry_url ,
27052748 schema_registry_username = schema_registry_username ,
27062749 schema_registry_password = schema_registry_password ,
0 commit comments