Skip to content

Commit cbd3ac4

Browse files
aloivaPranava Vedagnya Gaddam
andauthored
Additional annotations for Kafka Trigger and Output (#230)
* update kafka annotations * add avro * use java additions * Update version from 3.2.2 to 3.2.3 * update azure-functions-java-core-library version * fix build failures --------- Co-authored-by: Pranava Vedagnya Gaddam <prgaddam@microsoft.com>
1 parent bad0417 commit cbd3ac4

3 files changed

Lines changed: 247 additions & 5 deletions

File tree

pom.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<modelVersion>4.0.0</modelVersion>
55
<groupId>com.microsoft.azure.functions</groupId>
66
<artifactId>azure-functions-java-library</artifactId>
7-
<version>3.2.2</version>
7+
<version>3.2.3</version>
88
<packaging>jar</packaging>
99
<parent>
1010
<groupId>com.microsoft.maven</groupId>
@@ -76,7 +76,7 @@
7676
<dependency>
7777
<groupId>com.microsoft.azure.functions</groupId>
7878
<artifactId>azure-functions-java-core-library</artifactId>
79-
<version>1.2.0</version>
79+
<version>1.3.0</version>
8080
<scope>compile</scope>
8181
</dependency>
8282
<!-- test -->

src/main/java/com/microsoft/azure/functions/annotation/KafkaOutput.java

Lines changed: 120 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77

88
import com.microsoft.azure.functions.BrokerAuthenticationMode;
99
import com.microsoft.azure.functions.BrokerProtocol;
10+
import com.microsoft.azure.functions.KafkaMessageKeyType;
11+
import com.microsoft.azure.functions.OAuthBearerMethod;
1012

1113
import java.lang.annotation.ElementType;
1214
import java.lang.annotation.Retention;
@@ -208,6 +210,62 @@
208210
*/
209211
String avroSchema() default "";
210212

213+
/**
214+
* Gets or sets the Avro schema of message key.
215+
* Should be used only if a generic record should be generated.
216+
* default ""
217+
*
218+
* @return the avro schema for message key
219+
*/
220+
String keyAvroSchema() default "";
221+
222+
/**
223+
* Specifies the data type of the message key.
224+
* This data type will be used to serialize the key before sending it to the Kafka topic.
225+
* If KeyAvroSchema is set, this value is ignored and the key will be serialized using Avro.
226+
* The default type is String.
227+
* Default: String
228+
*
229+
* @return the data type of the message key
230+
*/
231+
KafkaMessageKeyType keyDataType() default KafkaMessageKeyType.String;
232+
233+
/**
234+
* Client certificate in PEM format.
235+
* ssl.certificate.pem in librdkafka
236+
* default ""
237+
*
238+
* @return the ssl certificate PEM
239+
*/
240+
String sslCertificatePEM() default "";
241+
242+
/**
243+
* Client Private Key in PEM format.
244+
* ssl.key.pem in librdkafka
245+
* default ""
246+
*
247+
* @return the ssl key PEM
248+
*/
249+
String sslKeyPEM() default "";
250+
251+
/**
252+
* CA certificate for verifying the broker's certificate in PEM format
253+
* ssl.ca.pem in librdkafka
254+
* default ""
255+
*
256+
* @return the ssl CA PEM
257+
*/
258+
String sslCaPEM() default "";
259+
260+
/**
261+
* Client certificate and key in PEM format.
262+
* Additional Configuration for extension as KeyVault supports uploading certificate only with private key.
263+
* default ""
264+
*
265+
* @return the ssl certificate and key PEM
266+
*/
267+
String sslCertificateandKeyPEM() default "";
268+
211269
/**
212270
* URL for the Avro Schema Registry
213271
* default ""
@@ -232,4 +290,66 @@
232290
*/
233291
String schemaRegistryPassword() default "";
234292

293+
/**
294+
* OAuth Bearer method.
295+
* Either 'default' or 'oidc'
296+
* sasl.oauthbearer in librdkafka
297+
* default ""
298+
*
299+
* @return the OAuth Bearer method
300+
*/
301+
OAuthBearerMethod oAuthBearerMethod() default OAuthBearerMethod.Default;
302+
303+
/**
304+
* OAuth Bearer Client Id
305+
* Specify only when OAuthBearerMethod is 'oidc'
306+
* sasl.oauthbearer.client.id in librdkafka
307+
* default ""
308+
*
309+
* @return the OAuth Bearer client id
310+
*/
311+
String oAuthBearerClientId() default "";
312+
313+
/**
314+
* OAuth Bearer Client Secret
315+
* Specify only when OAuthBearerMethod is 'oidc'
316+
* sasl.oauthbearer.client.secret in librdkafka
317+
* default ""
318+
*
319+
* @return the OAuth Bearer client secret
320+
*/
321+
String oAuthBearerClientSecret() default "";
322+
323+
/**
324+
* OAuth Bearer scope.
325+
* Client use this to specify the scope of the access request to the broker.
326+
* Specify only when OAuthBearerMethod is 'oidc'
327+
* sasl.oauthbearer.extensions in librdkafka
328+
* default ""
329+
*
330+
* @return the OAuth Bearer scope
331+
*/
332+
String oAuthBearerScope() default "";
333+
334+
/**
335+
* OAuth Bearer token endpoint url.
336+
* Specify only when OAuthBearerMethod is 'oidc'
337+
* sasl.oauthbearer.token.endpoint.url in librdkafka
338+
* default ""
339+
*
340+
* @return the OAuth Bearer token endpoint url
341+
*/
342+
String oAuthBearerTokenEndpointUrl() default "";
343+
344+
/**
345+
* OAuth Bearer extensions.
346+
* Allow additional information to be provided to the broker.
347+
* Comma-separated list of key=value pairs. E.g., "supportFeatureX=true,organizationId=sales-emea"
348+
* sasl.oauthbearer.extensions in librdkafka
349+
* default ""
350+
*
351+
* @return the OAuth Bearer extensions
352+
*/
353+
String oAuthBearerExtensions() default "";
354+
235355
}

src/main/java/com/microsoft/azure/functions/annotation/KafkaTrigger.java

Lines changed: 125 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77

88
import com.microsoft.azure.functions.BrokerAuthenticationMode;
99
import com.microsoft.azure.functions.BrokerProtocol;
10+
import com.microsoft.azure.functions.KafkaMessageKeyType;
11+
import com.microsoft.azure.functions.OAuthBearerMethod;
1012

1113
import java.lang.annotation.ElementType;
1214
import java.lang.annotation.Retention;
@@ -182,10 +184,130 @@
182184
*/
183185
String avroSchema() default "";
184186

185-
/***
187+
/**
188+
* Gets or sets the Avro schema of message key.
189+
* Should be used only if a generic record should be generated.
190+
* default ""
191+
*
192+
* @return the avro schema for message key
193+
*/
194+
String keyAvroSchema() default "";
195+
196+
/**
197+
* Specifies the data type of the message key that will be deserialized from the Kafka topic.
198+
* If KeyAvroSchema is set, this value is ignored and the key will be generated as a generic record.
199+
* The default type is String.
200+
* Default: String
201+
*
202+
* @return the data type of the message key
203+
*/
204+
KafkaMessageKeyType keyDataType() default KafkaMessageKeyType.String;
205+
206+
/**
207+
* Client certificate in PEM format.
208+
* ssl.certificate.pem in librdkafka
209+
* default ""
210+
*
211+
* @return the ssl certificate PEM
212+
*/
213+
String sslCertificatePEM() default "";
214+
215+
/**
216+
* Client Private Key in PEM format.
217+
* ssl.key.pem in librdkafka
218+
* default ""
219+
*
220+
* @return the ssl key PEM
221+
*/
222+
String sslKeyPEM() default "";
223+
224+
/**
225+
* CA certificate for verifying the broker's certificate in PEM format
226+
* ssl.ca.pem in librdkafka
227+
* default ""
228+
*
229+
* @return the ssl CA PEM
230+
*/
231+
String sslCaPEM() default "";
232+
233+
/**
234+
* Client certificate and key in PEM format.
235+
* Additional Configuration for extension as KeyVault supports uploading certificate only with private key.
236+
* default ""
237+
*
238+
* @return the ssl certificate and key PEM
239+
*/
240+
String sslCertificateandKeyPEM() default "";
241+
242+
/**
243+
* OAuth Bearer method.
244+
* Either 'default' or 'oidc'
245+
* sasl.oauthbearer in librdkafka
246+
* default ""
247+
*
248+
* @return the OAuth Bearer method
249+
*/
250+
OAuthBearerMethod oAuthBearerMethod() default OAuthBearerMethod.Default;
251+
252+
/**
253+
* OAuth Bearer Client Id
254+
* Specify only when OAuthBearerMethod is 'oidc'
255+
* sasl.oauthbearer.client.id in librdkafka
256+
* default ""
257+
*
258+
* @return the OAuth Bearer client id
259+
*/
260+
String oAuthBearerClientId() default "";
261+
262+
/**
263+
* OAuth Bearer Client Secret
264+
* Specify only when OAuthBearerMethod is 'oidc'
265+
* sasl.oauthbearer.client.secret in librdkafka
266+
* default ""
267+
*
268+
* @return the OAuth Bearer client secret
269+
*/
270+
String oAuthBearerClientSecret() default "";
271+
272+
/**
273+
* OAuth Bearer scope.
274+
* Client use this to specify the scope of the access request to the broker.
275+
* Specify only when OAuthBearerMethod is 'oidc'
276+
* sasl.oauthbearer.extensions in librdkafka
277+
* default ""
278+
*
279+
* @return the OAuth Bearer scope
280+
*/
281+
String oAuthBearerScope() default "";
282+
283+
/**
284+
* OAuth Bearer token endpoint url.
285+
* Specify only when OAuthBearerMethod is 'oidc'
286+
* sasl.oauthbearer.token.endpoint.url in librdkafka
287+
* default ""
288+
*
289+
* @return the OAuth Bearer token endpoint url
290+
*/
291+
String oAuthBearerTokenEndpointUrl() default "";
292+
293+
/**
294+
* OAuth Bearer extensions.
295+
* Allow additional information to be provided to the broker.
296+
* Comma-separated list of key=value pairs. E.g., "supportFeatureX=true,organizationId=sales-emea"
297+
* sasl.oauthbearer.extensions in librdkafka
298+
* default ""
299+
*
300+
* @return the OAuth Bearer extensions
301+
*/
302+
String oAuthBearerExtensions() default "";
303+
304+
/**
305+
* Maximum number of unprocessed messages a worker is expected to have at an instance.
306+
* When target-based scaling is not disabled, this is used to divide total unprocessed event count to determine the number of worker instances, which will then be rounded up to a worker instance count that creates a balanced partition distribution.
307+
* Default: 1000
186308
*
187-
* @return
188-
*/
309+
* @return the lag threshold
310+
*/
189311
int lagThreshold() default 1000;
190312

191313
/**

0 commit comments

Comments
 (0)