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,19 @@ 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 [
1250+ Union [KafkaMessageKeyType , str ]] = KafkaMessageKeyType .STRING ,
12471251 username : Optional [str ] = None ,
12481252 password : Optional [str ] = None ,
12491253 ssl_key_location : Optional [str ] = None ,
12501254 ssl_ca_location : Optional [str ] = None ,
12511255 ssl_certificate_location : Optional [str ] = None ,
12521256 ssl_key_password : Optional [str ] = None ,
1257+ ssl_certificate_pem : Optional [str ] = None ,
1258+ ssl_key_pem : Optional [str ] = None ,
1259+ ssl_ca_pem : Optional [str ] = None ,
1260+ ssl_certificate_and_key_pem : Optional [str ] = None ,
12531261 schema_registry_url : Optional [str ] = None ,
12541262 schema_registry_username : Optional [str ] = None ,
12551263 schema_registry_password : Optional [str ] = None ,
@@ -1287,6 +1295,10 @@ def kafka_trigger(self,
12871295 Azure Event Hubs).
12881296 :param consumer_group: Kafka consumer group used by the trigger.
12891297 :param avro_schema: Used only if a generic Avro record should be generated.
1298+ :param key_avro_schema: Avro schema for the message key. Used only if a
1299+ generic Avro record should be generated for the key.
1300+ :param key_data_type: Data type of the message key. Valid values: Int, Long,
1301+ String, Binary. Default is String. Ignored if key_avro_schema is set.
12901302 :param username: SASL username for use with the PLAIN or SASL-SCRAM mechanisms.
12911303 Equivalent to 'sasl.username' in librdkafka. Default is empty string.
12921304 :param password: SASL password for use with the PLAIN or SASL-SCRAM mechanisms.
@@ -1297,8 +1309,16 @@ def kafka_trigger(self,
12971309 certificate. Equivalent to 'ssl.ca.location' in librdkafka.
12981310 :param ssl_certificate_location: Path to the client's certificate.
12991311 Equivalent to 'ssl.certificate.location' in librdkafka.
1300- :param ssl_key_password: Password for the client’ s certificate.
1312+ :param ssl_key_password: Password for the client' s certificate.
13011313 Equivalent to 'ssl.key.password' in librdkafka.
1314+ :param ssl_certificate_pem: Client certificate in PEM format.
1315+ Equivalent to 'ssl.certificate.pem' in librdkafka.
1316+ :param ssl_key_pem: Client private key in PEM format.
1317+ Equivalent to 'ssl.key.pem' in librdkafka.
1318+ :param ssl_ca_pem: CA certificate for verifying the broker's
1319+ certificate in PEM format. Equivalent to 'ssl.ca.pem' in librdkafka.
1320+ :param ssl_certificate_and_key_pem: Client certificate concatenated
1321+ with key in PEM format. Can also support KeyVault references.
13021322 :param schema_registry_url: URL of the Avro Schema Registry.
13031323 :param schema_registry_username: Username for the Schema Registry.
13041324 :param schema_registry_password: Password for the Schema Registry.
@@ -1319,6 +1339,7 @@ def kafka_trigger(self,
13191339 ScramSha256, ScramSha512. Default: Plain. Equivalent to 'sasl.mechanism'.
13201340 :param protocol: Security protocol used to communicate with brokers.
13211341 Default: plaintext. Equivalent to 'security.protocol'.
1342+ :param cardinality: Set to "many" to enable batching. Default is "One".
13221343 :param lag_threshold: Max number of unprocessed messages per worker instance.
13231344 Used in scaling logic to estimate needed worker instances. Default is 1000.
13241345 :param data_type: Defines how Functions runtime should treat the parameter value.
@@ -1338,12 +1359,19 @@ def decorator():
13381359 event_hub_connection_string = event_hub_connection_string , # noqa: E501
13391360 consumer_group = consumer_group ,
13401361 avro_schema = avro_schema ,
1362+ key_avro_schema = key_avro_schema ,
1363+ key_data_type = parse_singular_param_to_enum (
1364+ key_data_type , KafkaMessageKeyType ),
13411365 username = username ,
13421366 password = password ,
13431367 ssl_key_location = ssl_key_location ,
13441368 ssl_ca_location = ssl_ca_location ,
13451369 ssl_certificate_location = ssl_certificate_location ,
13461370 ssl_key_password = ssl_key_password ,
1371+ ssl_certificate_pem = ssl_certificate_pem ,
1372+ ssl_key_pem = ssl_key_pem ,
1373+ ssl_ca_pem = ssl_ca_pem ,
1374+ ssl_certificate_and_key_pem = ssl_certificate_and_key_pem ,
13471375 schema_registry_url = schema_registry_url ,
13481376 schema_registry_username = schema_registry_username ,
13491377 schema_registry_password = schema_registry_password ,
@@ -2646,12 +2674,19 @@ def kafka_output(self,
26462674 topic : str ,
26472675 broker_list : str ,
26482676 avro_schema : Optional [str ] = None ,
2677+ key_avro_schema : Optional [str ] = None ,
2678+ key_data_type : Optional [
2679+ Union [KafkaMessageKeyType , str ]] = KafkaMessageKeyType .STRING ,
26492680 username : Optional [str ] = None ,
26502681 password : Optional [str ] = None ,
26512682 ssl_key_location : Optional [str ] = None ,
26522683 ssl_ca_location : Optional [str ] = None ,
26532684 ssl_certificate_location : Optional [str ] = None ,
26542685 ssl_key_password : Optional [str ] = None ,
2686+ ssl_certificate_pem : Optional [str ] = None ,
2687+ ssl_key_pem : Optional [str ] = None ,
2688+ ssl_ca_pem : Optional [str ] = None ,
2689+ ssl_certificate_and_key_pem : Optional [str ] = None ,
26552690 schema_registry_url : Optional [str ] = None ,
26562691 schema_registry_username : Optional [str ] = None ,
26572692 schema_registry_password : Optional [str ] = None ,
@@ -2688,6 +2723,10 @@ def kafka_output(self,
26882723 :param topic: The Kafka topic to which messages are published.
26892724 :param broker_list: The list of Kafka brokers to which the producer connects.
26902725 :param avro_schema: Optional. Avro schema to generate a generic record.
2726+ :param key_avro_schema: Avro schema for the message key. Used only if a
2727+ generic Avro record should be generated for the key.
2728+ :param key_data_type: Data type of the message key. Valid values: Int, Long,
2729+ String, Binary. Default is String. Ignored if key_avro_schema is set.
26912730 :param username: SASL username for use with the PLAIN and SASL-SCRAM
26922731 mechanisms. Equivalent to `'sasl.username'` in librdkafka.
26932732 :param password: SASL password for use with the PLAIN and SASL-SCRAM
@@ -2700,6 +2739,14 @@ def kafka_output(self,
27002739 Equivalent to `'ssl.certificate.location'` in librdkafka.
27012740 :param ssl_key_password: Password for the client's SSL key.
27022741 Equivalent to `'ssl.key.password'` in librdkafka.
2742+ :param ssl_certificate_pem: Client certificate in PEM format.
2743+ Equivalent to 'ssl.certificate.pem' in librdkafka.
2744+ :param ssl_key_pem: Client private key in PEM format.
2745+ Equivalent to 'ssl.key.pem' in librdkafka.
2746+ :param ssl_ca_pem: CA certificate for verifying the broker's
2747+ certificate in PEM format. Equivalent to 'ssl.ca.pem' in librdkafka.
2748+ :param ssl_certificate_and_key_pem: Client certificate concatenated
2749+ with key in PEM format. Can also support KeyVault references.
27032750 :param schema_registry_url: URL of the Avro Schema Registry.
27042751 :param schema_registry_username: Username for accessing the Schema Registry.
27052752 :param schema_registry_password: Password for accessing the Schema Registry.
@@ -2753,12 +2800,19 @@ def decorator():
27532800 topic = topic ,
27542801 broker_list = broker_list ,
27552802 avro_schema = avro_schema ,
2803+ key_avro_schema = key_avro_schema ,
2804+ key_data_type = parse_singular_param_to_enum (
2805+ key_data_type , KafkaMessageKeyType ),
27562806 username = username ,
27572807 password = password ,
27582808 ssl_key_location = ssl_key_location ,
27592809 ssl_ca_location = ssl_ca_location ,
27602810 ssl_certificate_location = ssl_certificate_location ,
27612811 ssl_key_password = ssl_key_password ,
2812+ ssl_certificate_pem = ssl_certificate_pem ,
2813+ ssl_key_pem = ssl_key_pem ,
2814+ ssl_ca_pem = ssl_ca_pem ,
2815+ ssl_certificate_and_key_pem = ssl_certificate_and_key_pem ,
27622816 schema_registry_url = schema_registry_url ,
27632817 schema_registry_username = schema_registry_username ,
27642818 schema_registry_password = schema_registry_password ,
0 commit comments