-
Notifications
You must be signed in to change notification settings - Fork 76
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
initial on goging java implementation for share
- Loading branch information
1 parent
941a625
commit 03e5985
Showing
7 changed files
with
418 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,119 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<groupId>com.microsoft.azure.functions</groupId> | ||
<artifactId>azure-functions-java-library-kafka</artifactId> | ||
<version>1.0.0</version> | ||
<packaging>jar</packaging> | ||
|
||
<name>Microsoft Azure Functions Java Kafka Types</name> | ||
<description>This package contains all Java interfaces and annotations to interact with Microsoft Azure functions runtime for Kafka binding extensions.</description> | ||
<url>https://github.com/Azure/azure-functions-kafka-extension</url> | ||
<organization> | ||
<name>Microsoft Azure</name> | ||
<url>https://azure.microsoft.com</url> | ||
</organization> | ||
|
||
<properties> | ||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> | ||
<maven-compiler.version>3.8.0</maven-compiler.version> | ||
<maven-source.version>3.0.1</maven-source.version> | ||
<maven-javadoc.version>3.0.1</maven-javadoc.version> | ||
<maven.compiler.source>1.8</maven.compiler.source> | ||
<maven.compiler.target>1.8</maven.compiler.target> | ||
<azure.functions.java.library.version>1.3.0</azure.functions.java.library.version> | ||
</properties> | ||
|
||
<licenses> | ||
<license> | ||
<name>MIT License</name> | ||
<url>https://opensource.org/licenses/MIT</url> | ||
<distribution>repo</distribution> | ||
</license> | ||
</licenses> | ||
|
||
<scm> | ||
<connection>scm:git:https://github.com/Azure/azure-functions-kafka-extension</connection> | ||
<developerConnection>scm:git:git@github.com:Azure/azure-functions-kafka-extension</developerConnection> | ||
<url>https://github.com/Azure/azure-functions-kafka-extension</url> | ||
<tag>HEAD</tag> | ||
</scm> | ||
|
||
<distributionManagement> | ||
<snapshotRepository> | ||
<id>ossrh</id> | ||
<name>Sonatype Snapshots</name> | ||
<url>https://oss.sonatype.org/content/repositories/snapshots/</url> | ||
<uniqueVersion>true</uniqueVersion> | ||
<layout>default</layout> | ||
</snapshotRepository> | ||
</distributionManagement> | ||
|
||
<developers> | ||
<developer> | ||
<id>TsuyoshiUshio</id> | ||
<name>Tsuyoshi Ushio</name> | ||
<email>tsushi@microsoft.com</email> | ||
</developer> | ||
</developers> | ||
|
||
<repositories> | ||
<repository> | ||
<id>maven.snapshots</id> | ||
<name>Maven Central Snapshot Repository</name> | ||
<url>https://oss.sonatype.org/content/repositories/snapshots/</url> | ||
<releases> | ||
<enabled>false</enabled> | ||
</releases> | ||
<snapshots> | ||
<enabled>true</enabled> | ||
</snapshots> | ||
</repository> | ||
</repositories> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>com.microsoft.azure.functions</groupId> | ||
<artifactId>azure-functions-java-library</artifactId> | ||
<version>${azure.functions.java.library.version}</version> | ||
</dependency> | ||
</dependencies> | ||
|
||
<build> | ||
<plugins> | ||
<plugin> | ||
<artifactId>maven-compiler-plugin</artifactId> | ||
<version>${maven-compiler.version}</version> | ||
</plugin> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-source-plugin</artifactId> | ||
<version>${maven-source.version}</version> | ||
<executions> | ||
<execution> | ||
<id>attach-sources</id> | ||
<goals> | ||
<goal>jar</goal> | ||
</goals> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-javadoc-plugin</artifactId> | ||
<version>${maven-javadoc.version}</version> | ||
<executions> | ||
<execution> | ||
<id>attach-javadocs</id> | ||
<goals> | ||
<goal>jar</goal> | ||
</goals> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
</project> |
25 changes: 25 additions & 0 deletions
25
...g-library/java/src/main/com/microsoft/azure/functions/kafka/BrokerAuthenticationMode.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
/** | ||
* Copyright (c) Microsoft Corporation. All rights reserved. | ||
* Licensed under the MIT License. See License.txt in the project root for | ||
* license information. | ||
*/ | ||
package main.com.microsoft.azure.functions.kafka; | ||
|
||
/** | ||
* Defines the broker authentication modes | ||
*/ | ||
public enum BrokerAuthenticationMode { | ||
NOTSET(-1), | ||
GSSAPI(0), | ||
PLAIN(1), | ||
SCRAMSHA256(2), | ||
SCRAMSHA512(3); | ||
|
||
private final int value; | ||
|
||
BrokerAuthenticationMode(final int value) { | ||
this.value = value; | ||
} | ||
|
||
public int getValue() { return value; } | ||
} |
19 changes: 19 additions & 0 deletions
19
binding-library/java/src/main/com/microsoft/azure/functions/kafka/BrokerProtocol.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
/** | ||
* Copyright (c) Microsoft Corporation. All rights reserved. | ||
* Licensed under the MIT License. See License.txt in the project root for | ||
* license information. | ||
*/ | ||
package main.com.microsoft.azure.functions.kafka; | ||
|
||
public enum BrokerProtocol { | ||
NOTSET(-1), | ||
PLAINTEXT(0), | ||
SSL(1), | ||
SASLPLAINTEXT(2), | ||
SASLSSL(3); | ||
|
||
private int value; | ||
BrokerProtocol(final int value) { | ||
this.value = value; | ||
} | ||
} |
33 changes: 33 additions & 0 deletions
33
binding-library/java/src/main/com/microsoft/azure/functions/kafka/KafkaEventData.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
/** | ||
* Copyright (c) Microsoft Corporation. All rights reserved. | ||
* Licensed under the MIT License. See License.txt in the project root for | ||
* license information. | ||
*/ | ||
package main.com.microsoft.azure.functions.kafka; | ||
|
||
/** | ||
* Kafka Event Data to use with Kafka binding | ||
*/ | ||
public class KafkaEventData { | ||
/** | ||
* Constructor | ||
*/ | ||
public KafkaEventData() { | ||
|
||
} | ||
|
||
// .NET has other constructor which has an interface called IConsumerResultData. | ||
|
||
public Object key; | ||
|
||
public long offset; | ||
|
||
public int partition; | ||
|
||
public String topic; | ||
|
||
public String timestamp; // TODO this is DateTime in C#. Can we use Date for this? or String? | ||
|
||
public Object value; | ||
|
||
} |
115 changes: 115 additions & 0 deletions
115
binding-library/java/src/main/com/microsoft/azure/functions/kafka/annotation/Kafka.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,115 @@ | ||
/** | ||
* Copyright (c) Microsoft Corporation. All rights reserved. | ||
* Licensed under the MIT License. See License.txt in the project root for | ||
* license information. | ||
*/ | ||
package main.com.microsoft.azure.functions.kafka.annotation; | ||
|
||
import com.microsoft.azure.functions.annotation.CustomBinding; | ||
import main.com.microsoft.azure.functions.kafka.BrokerAuthenticationMode; | ||
import main.com.microsoft.azure.functions.kafka.BrokerProtocol; | ||
|
||
import java.lang.annotation.ElementType; | ||
import java.lang.annotation.Retention; | ||
import java.lang.annotation.RetentionPolicy; | ||
import java.lang.annotation.Target; | ||
|
||
@Target(ElementType.PARAMETER) | ||
@Retention(RetentionPolicy.RUNTIME) | ||
@CustomBinding(direction = "in", name = "", type = "Kafka") | ||
public @interface Kafka { // TODO Should I name it as KafkaOutput? | ||
/** | ||
* Gets the Topic. | ||
* @return | ||
*/ | ||
String topic(); | ||
|
||
/** | ||
* Gets or sets the BrokerList. | ||
*/ | ||
String brokerList(); | ||
|
||
/** | ||
* Gets or sets the KeyType | ||
* This method is used internally. Don't pass the value to this method. | ||
*/ | ||
String keyType(); // TODO Originally Type type. Should I pass the serialized value for them? | ||
|
||
/** | ||
* Gets or sets the ValueType | ||
* This method is used internally. Don't pass the value to this method. | ||
*/ | ||
String valueType(); // TODO Originally Type type. Should I pass the serialized value for them? | ||
|
||
/** | ||
* Gets or sets the Avro schema. | ||
* Json format | ||
* Default: Plain* | ||
*/ | ||
String AvroScema(); | ||
|
||
/** | ||
* Gets or sets the Maximum transmit message size. Default: 1MB | ||
*/ | ||
int maxMessageBytes(); | ||
|
||
/** | ||
* Maximum number of messages batched in one MessageSet. default: 10000 | ||
*/ | ||
int batchSize(); | ||
|
||
/** | ||
* When set to `true`, the producer will ensure that messages are successfully produced exactly once and in the original produce order. default: false | ||
*/ | ||
boolean enableIdempotence(); | ||
|
||
/** | ||
* Local message timeout. This value is only enforced locally and limits the time a produced message waits for successful delivery. A time of 0 is infinite. This is the maximum time used to deliver a message (including retries). Delivery error occurs when either the retry count or the message timeout are exceeded. default: 300000 | ||
*/ | ||
int messageTimeoutMs(); | ||
|
||
/** | ||
* The ack timeout of the producer request in milliseconds. default: 5000 | ||
*/ | ||
int requestTimeoutMs(); | ||
|
||
/** | ||
* How many times to retry sending a failing Message. **Note:** default: 2 | ||
* Retrying may cause reordering unless EnableIdempotence is set to true. | ||
* @see #enableIdempotence() | ||
*/ | ||
int maxRetries(); | ||
|
||
/** | ||
* SASL mechanism to use for authentication. | ||
* Default: PLAIN | ||
*/ | ||
BrokerAuthenticationMode authenticationMode(); // TODO double check if it is OK | ||
|
||
/** | ||
* SASL username with the PLAIN and SASL-SCRAM-.. mechanisms | ||
* Default: "" | ||
*/ | ||
String username(); | ||
|
||
/** | ||
* SASL password with the PLAIN and SASL-SCRAM-.. mechanisms | ||
* Default is plaintext | ||
* | ||
* security.protocol in librdkafka | ||
*/ | ||
String password(); | ||
|
||
/** | ||
* Gets or sets the security protocol used to communicate with brokers | ||
* default is PLAINTEXT | ||
*/ | ||
BrokerProtocol protocol(); | ||
|
||
/** | ||
* Path to client's private key (PEM) used for authentication. | ||
* Default "" | ||
* ssl.key.location in librdkafka | ||
*/ | ||
String sslKeyLocation(); | ||
} |
Oops, something went wrong.