@Target(value=PARAMETER) @Retention(value=RUNTIME) public @interface KafkaTrigger
Place this on a parameter whose value would come from Kafka, and causing the method to run when Kafka event is consumed. The parameter type can be one of the following:
The following example shows a Java function that is invoked when messages are consumed with the specified topic, brokerList, and consumerGroup on a Kafka cluster.
@FunctionName("KafkaTrigger-Java")
public void run(
@KafkaTrigger(name = "kafkaTrigger",
topic = "users",
brokerList="broker:29092",
consumerGroup="functions")
List<Map<String, String>> kafkaEventData,
final ExecutionContext context
) {
context.getLogger().info(kafkaEventData);
}
| Modifier and Type | Required Element and Description |
|---|---|
String |
brokerList
Defines the BrokerList.
|
String |
consumerGroup
Defines the consumer group.
|
String |
name
The variable name used in function code for the request or request body.
|
String |
topic
Defines the Topic.
|
| Modifier and Type | Optional Element and Description |
|---|---|
com.microsoft.azure.functions.BrokerAuthenticationMode |
authenticationMode
SASL mechanism to use for authentication.
|
String |
avroSchema
Avro schema for generic record deserialization
default ""
|
Cardinality |
cardinality
Cardinality of the trigger input.
|
String |
dataType
Defines how Functions runtime should treat the parameter value.
|
String |
eventHubConnectionString
Defines the EventHub connection string when using KafkaOutput protocol header feature of Azure EventHubs.
|
String |
password
SASL password with the PLAIN and SASL-SCRAM-..
|
com.microsoft.azure.functions.BrokerProtocol |
protocol
Defines the security protocol used to communicate with brokers
default is NOTSET
|
String |
sslCaLocation
Path to CA certificate file for verifying the broker's certificate.
|
String |
sslCertificateLocation
Path to client's certificate.
|
String |
sslKeyLocation
Path to client's private key (PEM) used for authentication.
|
String |
sslKeyPassword
Password for client's certificate.
|
String |
username
SASL username with the PLAIN and SASL-SCRAM-..
|
public abstract String name
public abstract String topic
public abstract String brokerList
public abstract String consumerGroup
public abstract String eventHubConnectionString
public abstract Cardinality cardinality
public abstract String dataType
Defines how Functions runtime should treat the parameter value. Possible values are:
public abstract com.microsoft.azure.functions.BrokerAuthenticationMode authenticationMode
public abstract String username
public abstract String password
public abstract com.microsoft.azure.functions.BrokerProtocol protocol
public abstract String sslKeyLocation
public abstract String sslCaLocation
public abstract String sslCertificateLocation
public abstract String sslKeyPassword
public abstract String avroSchema
Copyright © 2022. All rights reserved.