Skip to content

Commit

Permalink
Merge pull request #15 from Nuvindu/2201.10.x
Browse files Browse the repository at this point in the history
Modify the code to support the 2201.10.0 lang version
  • Loading branch information
Nuvindu authored Sep 29, 2024
2 parents 33ea7fb + 0e9c9c5 commit 2e8b638
Show file tree
Hide file tree
Showing 9 changed files with 38 additions and 31 deletions.
8 changes: 4 additions & 4 deletions ballerina/Ballerina.toml
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
[package]
org = "ballerinax"
name = "confluent.cavroserdes"
version = "0.1.0"
version = "0.2.0"
authors = ["Ballerina"]
export=["confluent.cavroserdes"]
keywords = ["confluent", "schema_registry", "avro", "serdes"]
repository = "https://github.com/ballerina-platform/module-ballerinax-confluent.cavroserdes"
license = ["Apache-2.0"]
distribution = "2201.8.6"
distribution = "2201.10.0"

[build-options]
observabilityIncluded = true
Expand All @@ -18,5 +18,5 @@ graalvmCompatible = true
[[platform.java17.dependency]]
groupId = "io.ballerina.lib"
artifactId = "confluent.cavroserdes-native"
version = "0.1.0"
path = "../native/build/libs/confluent.cavroserdes-native-0.1.0.jar"
version = "0.2.0"
path = "../native/build/libs/confluent.cavroserdes-native-0.2.0-SNAPSHOT.jar"
39 changes: 21 additions & 18 deletions ballerina/Dependencies.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@

[ballerina]
dependencies-toml-version = "2"
distribution-version = "2201.8.6"
distribution-version = "2201.10.0"

[[package]]
org = "ballerina"
name = "auth"
version = "2.10.0"
version = "2.12.0"
scope = "testOnly"
dependencies = [
{org = "ballerina", name = "crypto"},
Expand All @@ -23,7 +23,7 @@ dependencies = [
[[package]]
org = "ballerina"
name = "avro"
version = "0.1.1"
version = "1.0.0"
dependencies = [
{org = "ballerina", name = "jballerina.java"}
]
Expand All @@ -34,7 +34,7 @@ modules = [
[[package]]
org = "ballerina"
name = "cache"
version = "3.7.1"
version = "3.8.0"
scope = "testOnly"
dependencies = [
{org = "ballerina", name = "constraint"},
Expand All @@ -46,7 +46,7 @@ dependencies = [
[[package]]
org = "ballerina"
name = "constraint"
version = "1.4.0"
version = "1.5.0"
scope = "testOnly"
dependencies = [
{org = "ballerina", name = "jballerina.java"}
Expand All @@ -55,7 +55,7 @@ dependencies = [
[[package]]
org = "ballerina"
name = "crypto"
version = "2.5.0"
version = "2.7.2"
scope = "testOnly"
dependencies = [
{org = "ballerina", name = "jballerina.java"},
Expand All @@ -65,7 +65,7 @@ dependencies = [
[[package]]
org = "ballerina"
name = "file"
version = "1.9.0"
version = "1.10.0"
scope = "testOnly"
dependencies = [
{org = "ballerina", name = "io"},
Expand All @@ -77,7 +77,7 @@ dependencies = [
[[package]]
org = "ballerina"
name = "http"
version = "2.10.12"
version = "2.12.1"
scope = "testOnly"
dependencies = [
{org = "ballerina", name = "auth"},
Expand Down Expand Up @@ -110,7 +110,7 @@ modules = [
[[package]]
org = "ballerina"
name = "io"
version = "1.6.0"
version = "1.6.1"
scope = "testOnly"
dependencies = [
{org = "ballerina", name = "jballerina.java"},
Expand All @@ -128,11 +128,12 @@ modules = [
[[package]]
org = "ballerina"
name = "jwt"
version = "2.10.0"
version = "2.13.0"
scope = "testOnly"
dependencies = [
{org = "ballerina", name = "cache"},
{org = "ballerina", name = "crypto"},
{org = "ballerina", name = "io"},
{org = "ballerina", name = "jballerina.java"},
{org = "ballerina", name = "lang.int"},
{org = "ballerina", name = "lang.string"},
Expand Down Expand Up @@ -235,7 +236,7 @@ dependencies = [
[[package]]
org = "ballerina"
name = "log"
version = "2.9.0"
version = "2.10.0"
scope = "testOnly"
dependencies = [
{org = "ballerina", name = "io"},
Expand All @@ -247,18 +248,19 @@ dependencies = [
[[package]]
org = "ballerina"
name = "mime"
version = "2.9.0"
version = "2.10.0"
scope = "testOnly"
dependencies = [
{org = "ballerina", name = "io"},
{org = "ballerina", name = "jballerina.java"},
{org = "ballerina", name = "lang.int"}
{org = "ballerina", name = "lang.int"},
{org = "ballerina", name = "log"}
]

[[package]]
org = "ballerina"
name = "oauth2"
version = "2.10.0"
version = "2.12.0"
scope = "testOnly"
dependencies = [
{org = "ballerina", name = "cache"},
Expand All @@ -272,7 +274,7 @@ dependencies = [
[[package]]
org = "ballerina"
name = "observe"
version = "1.2.2"
version = "1.3.0"
dependencies = [
{org = "ballerina", name = "jballerina.java"}
]
Expand Down Expand Up @@ -304,6 +306,7 @@ version = "0.0.0"
scope = "testOnly"
dependencies = [
{org = "ballerina", name = "jballerina.java"},
{org = "ballerina", name = "lang.array"},
{org = "ballerina", name = "lang.error"}
]
modules = [
Expand All @@ -313,7 +316,7 @@ modules = [
[[package]]
org = "ballerina"
name = "time"
version = "2.4.0"
version = "2.5.0"
scope = "testOnly"
dependencies = [
{org = "ballerina", name = "jballerina.java"}
Expand Down Expand Up @@ -343,7 +346,7 @@ modules = [
[[package]]
org = "ballerinax"
name = "confluent.cavroserdes"
version = "0.1.0"
version = "0.2.0"
dependencies = [
{org = "ballerina", name = "avro"},
{org = "ballerina", name = "http"},
Expand All @@ -359,7 +362,7 @@ modules = [
[[package]]
org = "ballerinax"
name = "confluent.cregistry"
version = "0.1.1"
version = "0.2.0"
dependencies = [
{org = "ballerina", name = "jballerina.java"}
]
Expand Down
4 changes: 2 additions & 2 deletions ballerina/client.bal
Original file line number Diff line number Diff line change
Expand Up @@ -59,12 +59,12 @@ isolated function getId(byte[] bytes) returns int = @java:Method {
} external;

class Deserializer {
isolated function deserializeData(cregistry:Client registry, byte[] data) returns anydata|Error {
isolated function deserializeData(cregistry:Client registry, byte[] data, typedesc<anydata> targetType) returns anydata|Error {
do {
int schemaId = getId(data.slice(1, 5));
string retrievedSchema = check registry->getSchemaById(schemaId);
avro:Schema avroClient = check new (retrievedSchema);
anydata deserializedData = check avroClient.fromAvro(data.slice(5, data.length()));
anydata deserializedData = check avroClient.fromAvro(data.slice(5, data.length()), targetType);
return deserializedData;
} on fail error e {
return error Error(DESERIALIZATION_ERROR, e);
Expand Down
2 changes: 1 addition & 1 deletion build-config/resources/Ballerina.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export=["confluent.cavroserdes"]
keywords = ["confluent", "schema_registry", "avro", "serdes"]
repository = "https://github.com/ballerina-platform/module-ballerinax-confluent.cavroserdes"
license = ["Apache-2.0"]
distribution = "2201.8.6"
distribution = "2201.10.0"

[build-options]
observabilityIncluded = true
Expand Down
2 changes: 2 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,8 @@ subprojects {
}

ballerinaStdLibs "io.ballerina.stdlib:io-ballerina:${stdlibIoVersion}"
ballerinaStdLibs "io.ballerina.lib:avro-ballerina:${stdlibAvroVersion}"
ballerinaStdLibs "io.ballerina.stdlib:http-ballerina:${stdlibHttpVersion}"
}
}

Expand Down
2 changes: 1 addition & 1 deletion examples/kafka-avro-consumer/Ballerina.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
org = "wso2"
name = "kafka_avro_consumer"
version = "0.1.0"
distribution = "2201.8.6"
distribution = "2201.10.0"

[build-options]
observabilityIncluded = true
2 changes: 1 addition & 1 deletion examples/kafka-avro-producer/Ballerina.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
org = "wso2"
name = "kafka_avro_producer"
version = "0.1.0"
distribution = "2201.8.6"
distribution = "2201.10.0"

[build-options]
observabilityIncluded = true
8 changes: 5 additions & 3 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
org.gradle.caching=true
group=io.ballerina.lib
version=0.1.1-SNAPSHOT
ballerinaLangVersion=2201.8.6
version=0.2.0-SNAPSHOT
ballerinaLangVersion=2201.10.0

checkstylePluginVersion=10.12.0
spotbugsPluginVersion=5.0.14
shadowJarPluginVersion=8.1.1
downloadPluginVersion=5.4.0
releasePluginVersion=2.8.0
ballerinaGradlePluginVersion=2.2.4
ballerinaGradlePluginVersion=3.0.0
jacocoVersion=0.8.10

slf4jVersion=1.7.21
Expand All @@ -21,3 +21,5 @@ commonConfigVersion=4.1.0
commonUtilsVersion=5.3.0

stdlibIoVersion=1.6.0
stdlibAvroVersion=1.0.0
stdlibHttpVersion=2.12.1
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public static Object deserialize(Environment env, BObject registry, BArray data,
BObject deserializer = ValueCreator.createObjectValue(getModule(), DESERIALIZER, null, null);
Future future = env.markAsync();
ExecutionCallback executionCallback = new ExecutionCallback(future, typeDesc);
Object[] arguments = new Object[]{registry, true, data, true};
Object[] arguments = new Object[]{registry, true, data, true, typeDesc, true};
UnionType typeUnion = TypeCreator.createUnionType(PredefinedTypes.TYPE_ANYDATA_ARRAY,
PredefinedTypes.TYPE_ERROR);
env.getRuntime()
Expand Down

0 comments on commit 2e8b638

Please sign in to comment.