From 0894b5cd19ba304bf63cc4b642da3ec0bb611533 Mon Sep 17 00:00:00 2001 From: Nuvindu Date: Wed, 10 Apr 2024 20:33:59 +0530 Subject: [PATCH 01/15] Update Gradle files to build examples --- build.gradle | 1 + examples/build.gradle | 76 +++++++++++++++++++++++++++++++++++++++++++ examples/build.sh | 55 +++++++++++++++++++++++++++++++ settings.gradle | 2 ++ 4 files changed, 134 insertions(+) create mode 100644 examples/build.gradle create mode 100755 examples/build.sh diff --git a/build.gradle b/build.gradle index 7301168..40c1e4e 100644 --- a/build.gradle +++ b/build.gradle @@ -82,6 +82,7 @@ subprojects { task build { dependsOn(":confluent.cavroserdes-native:build") dependsOn(":confluent.cavroserdes-ballerina:build") + dependsOn(":confluent.cavroserdes-examples:build") } def moduleVersion = project.version.replace("-SNAPSHOT", "") diff --git a/examples/build.gradle b/examples/build.gradle new file mode 100644 index 0000000..eba5913 --- /dev/null +++ b/examples/build.gradle @@ -0,0 +1,76 @@ +/* + * Copyright (c) 2024, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. + * + * WSO2 Inc. licenses this file to you under the Apache License, + * Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import org.apache.tools.ant.taskdefs.condition.Os + +def graalvmFlag = "" + +task testExamples { + if (project.hasProperty("balGraalVMTest")) { + graalvmFlag = "--graalvm" + } + doLast { + try { + exec { + workingDir project.projectDir + println("Working dir: ${workingDir}") + if (Os.isFamily(Os.FAMILY_WINDOWS)) { + commandLine 'sh', "/c", "chmod +x ./build.sh && ./build.sh run && exit %%ERRORLEVEL%%" + } else { + commandLine 'sh', "-c", "chmod +x ./build.sh && ./build.sh run" + } + } + } catch (Exception e) { + println("Example Build failed: " + e.message) + throw e + } + } +} + +task buildExamples { + gradle.taskGraph.whenReady { graph -> + if (graph.hasTask(":confluent.cregistry-examples:test")) { + buildExamples.enabled = false + } else { + testExamples.enabled = false + } + } + doLast { + try { + exec { + workingDir project.projectDir + println("Working dir: ${workingDir}") + if (Os.isFamily(Os.FAMILY_WINDOWS)) { + commandLine 'sh', "/c", "chmod +x ./build.sh && ./build.sh build && exit %%ERRORLEVEL%%" + } else { + commandLine 'sh', "-c", "chmod +x ./build.sh && ./build.sh build" + } + } + } catch (Exception e) { + println("Example Build failed: " + e.message) + throw e + } + } +} + +task build { + dependsOn buildExamples +} + +buildExamples.dependsOn ":confluent.cavroserdes-ballerina:build" +testExamples.dependsOn ":confluent.cavroserdes-ballerina:build" diff --git a/examples/build.sh b/examples/build.sh new file mode 100755 index 0000000..e2659d3 --- /dev/null +++ b/examples/build.sh @@ -0,0 +1,55 @@ +#!/bin/bash + +BAL_EXAMPLES_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +BAL_CENTRAL_DIR="$HOME/.ballerina/repositories/central.ballerina.io/" +BAL_HOME_DIR="$BAL_EXAMPLES_DIR/../ballerina" + +set -e + +case "$1" in +build) + BAL_CMD="build" + ;; +run) + BAL_CMD="run" + ;; +*) + echo "Invalid command provided: '$1'. Please provide 'build' or 'run' as the command." + exit 1 + ;; +esac + +# Read Ballerina package name +BAL_PACKAGE_NAME=$(awk -F'"' '/^name/ {print $2}' "$BAL_HOME_DIR/Ballerina.toml") + +# Push the package to the local repository +cd "$BAL_HOME_DIR" && + bal pack && + bal push --repository=local + +# Remove the cache directories in the repositories +rm -rf "$BAL_CENTRAL_DIR/cache-*" + +# Update the central repository +BAL_DESTINATION_DIR="$HOME/.ballerina/repositories/central.ballerina.io/bala/ballerinax" +BAL_SOURCE_DIR="$HOME/.ballerina/repositories/local/bala/ballerinax/$BAL_PACKAGE_NAME" + +mkdir -p "$BAL_DESTINATION_DIR" + +[ -d "$BAL_SOURCE_DIR" ] && cp -r "$BAL_SOURCE_DIR" "$BAL_DESTINATION_DIR" +echo "Successfully updated the local central repositories" + +# Loop through examples in the examples directory +cd "$BAL_EXAMPLES_DIR" +for dir in $(find "$BAL_EXAMPLES_DIR" -type d -maxdepth 1 -mindepth 1); do + # Skip the build directory + if [[ "$dir" == *build ]]; then + continue + fi + (cd "$dir" && bal "$BAL_CMD" --offline && cd ..); +done + +# Remove generated JAR files +find "$BAL_HOME_DIR" -maxdepth 1 -type f -name "*.jar" | while read -r JAR_FILE; do + rm "$JAR_FILE" +done diff --git a/settings.gradle b/settings.gradle index 819974b..11475e4 100644 --- a/settings.gradle +++ b/settings.gradle @@ -47,10 +47,12 @@ rootProject.name = "ballerinax-${projectName}" include ":checkstyle" include ":${projectName}-native" include ":${projectName}-ballerina" +include ":${projectName}-examples" project(':checkstyle').projectDir = file("build-config${File.separator}checkstyle") project(":${projectName}-native").projectDir = file('native') project(":${projectName}-ballerina").projectDir = file('ballerina') +project(":${projectName}-examples").projectDir = file('examples') gradleEnterprise { buildScan { From 6960d8533b8fb6e56e7edc62cfcd4bb4bdeca0bd Mon Sep 17 00:00:00 2001 From: Nuvindu Date: Wed, 10 Apr 2024 20:35:10 +0530 Subject: [PATCH 02/15] Add necessary files run a Kafka server on docker --- examples/docker-compose.yaml | 53 ++++++++++++++++++ .../secrets/certsandkeys/broker.public.crt | 20 +++++++ .../secrets/certsandkeys/client.private.key | 28 +++++++++ .../secrets/certsandkeys/client.public.crt | 20 +++++++ .../kafka.client.keystore.jks | Bin 0 -> 4623 bytes .../kafka.client.truststore.jks | Bin 0 -> 1210 bytes .../broker_keystore_creds | 1 + .../trustoresandkeystores/broker_sslkey_creds | 1 + .../broker_truststore_creds | 1 + .../kafka.broker.keystore.jks | Bin 0 -> 4623 bytes .../kafka.broker.truststore.jks | Bin 0 -> 2146 bytes .../kafka.client.keystore.jks | Bin 0 -> 4623 bytes .../kafka.client.truststore.jks | Bin 0 -> 1210 bytes 13 files changed, 124 insertions(+) create mode 100644 examples/docker-compose.yaml create mode 100644 examples/secrets/certsandkeys/broker.public.crt create mode 100644 examples/secrets/certsandkeys/client.private.key create mode 100644 examples/secrets/certsandkeys/client.public.crt create mode 100644 examples/secrets/incorrecttrustoresandkeystores/kafka.client.keystore.jks create mode 100644 examples/secrets/incorrecttrustoresandkeystores/kafka.client.truststore.jks create mode 100644 examples/secrets/trustoresandkeystores/broker_keystore_creds create mode 100644 examples/secrets/trustoresandkeystores/broker_sslkey_creds create mode 100644 examples/secrets/trustoresandkeystores/broker_truststore_creds create mode 100644 examples/secrets/trustoresandkeystores/kafka.broker.keystore.jks create mode 100644 examples/secrets/trustoresandkeystores/kafka.broker.truststore.jks create mode 100644 examples/secrets/trustoresandkeystores/kafka.client.keystore.jks create mode 100644 examples/secrets/trustoresandkeystores/kafka.client.truststore.jks diff --git a/examples/docker-compose.yaml b/examples/docker-compose.yaml new file mode 100644 index 0000000..6abf120 --- /dev/null +++ b/examples/docker-compose.yaml @@ -0,0 +1,53 @@ +version: '2' + +services: + zookeeper: + image: 'confluentinc/cp-zookeeper:latest' + hostname: zookeeper + container_name: kafka-test-zookeeper + ports: + - '2181:2181' + environment: + ZOOKEEPER_CLIENT_PORT: 2181 + ZOOKEEPER_TICK_TIME: 2000 + KAFKA_OPTS: '-Djava.security.auth.login.config=/opt/confluentinc/kafka/config/zookeeper_jaas.conf' + volumes: + - ./configs/zookeeper_jaas.conf:/opt/confluentinc/kafka/config/zookeeper_jaas.conf + broker: + image: 'confluentinc/cp-server:latest' + hostname: broker + container_name: kafka-test-broker + depends_on: + - zookeeper + ports: + - '9092:9092' + - '9093:9093' + - '9094:9094' + - '9095:9095' + environment: + KAFKA_BROKER_ID: 1 + KAFKA_ZOOKEEPER_CONNECT: 'zookeeper:2181' + KAFKA_SASL_ENABLED_MECHANISMS: PLAIN + KAFKA_SECURITY_INTER_BROKER_PROTOCOL: PLAINTEXT + KAFKA_SSL_CLIENT_AUTH: "requested" + KAFKA_ADVERTISED_LISTENERS: PLAINTEXT://broker:29092,EX_PLAINTEXT://localhost:9092,EX_SASL_PLAINTEXT://localhost:9093,EX_SSL://localhost:9094,EX_SASL_SSL://localhost:9095 + KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: PLAINTEXT:PLAINTEXT,EX_PLAINTEXT:PLAINTEXT,EX_SASL_PLAINTEXT:SASL_PLAINTEXT,EX_SSL:SSL,EX_SASL_SSL:SASL_SSL + KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 1 + KAFKA_GROUP_INITIAL_REBALANCE_DELAY_MS: 0 + KAFKA_CONFLUENT_LICENSE_TOPIC_REPLICATION_FACTOR: 1 + KAFKA_CONFLUENT_BALANCER_TOPIC_REPLICATION_FACTOR: 1 + KAFKA_TRANSACTION_STATE_LOG_MIN_ISR: 1 + KAFKA_TRANSACTION_STATE_LOG_REPLICATION_FACTOR: 1 + KAFKA_SSL_KEYSTORE_FILENAME: kafka.broker.keystore.jks + KAFKA_SSL_KEYSTORE_CREDENTIALS: broker_keystore_creds + KAFKA_SSL_KEY_CREDENTIALS: broker_sslkey_creds + KAFKA_SSL_TRUSTSTORE_FILENAME: kafka.broker.truststore.jks + KAFKA_SSL_TRUSTSTORE_CREDENTIALS: broker_truststore_creds + KAFKA_OPTS: '-Djava.security.auth.login.config=/opt/confluentinc/kafka/config/kafka_server_jaas.conf' + volumes: + - ./secrets/trustoresandkeystores/broker_keystore_creds:/etc/kafka/secrets/broker_keystore_creds + - ./secrets/trustoresandkeystores/broker_sslkey_creds:/etc/kafka/secrets/broker_sslkey_creds + - ./secrets/trustoresandkeystores/broker_truststore_creds:/etc/kafka/secrets/broker_truststore_creds + - ./secrets/trustoresandkeystores/kafka.broker.keystore.jks:/etc/kafka/secrets/kafka.broker.keystore.jks + - ./secrets/trustoresandkeystores/kafka.broker.truststore.jks:/etc/kafka/secrets/kafka.broker.truststore.jks + - ./configs/kafka_server_jaas.conf:/opt/confluentinc/kafka/config/kafka_server_jaas.conf diff --git a/examples/secrets/certsandkeys/broker.public.crt b/examples/secrets/certsandkeys/broker.public.crt new file mode 100644 index 0000000..490b946 --- /dev/null +++ b/examples/secrets/certsandkeys/broker.public.crt @@ -0,0 +1,20 @@ +-----BEGIN CERTIFICATE----- +MIIDRjCCAi4CFEtcpjpBgELtRhMH0wWKPrzTmmnuMA0GCSqGSIb3DQEBCwUAMFYx +EjAQBgNVBAMMCWxvY2FsaG9zdDENMAsGA1UECwwEVEVTVDESMBAGA1UECgwJQ09O +RkxVRU5UMRAwDgYDVQQHDAdDb2xvbWJvMQswCQYDVQQGEwJMSzAeFw0yMTA2MDIx +MzM5MDlaFw0zMTA1MzExMzM5MDlaMGkxCzAJBgNVBAYTAkxLMREwDwYDVQQIEwhT +b3V0aGVybjEQMA4GA1UEBxMHQ29sb21ibzESMBAGA1UEChMJQ09ORkxVRU5UMQ0w +CwYDVQQLEwRURVNUMRIwEAYDVQQDEwlsb2NhbGhvc3QwggEiMA0GCSqGSIb3DQEB +AQUAA4IBDwAwggEKAoIBAQCc7D71QMmwi98ra+l5OGZM3UNPdT4vkJ9iUGo4w8kr +mTZHJCGmc3//CE/oi+YtkOnDokNe0F5kyYl3Sq8jAMNhOYT6IBjR6sDkljqNx/IC +mEiI10EgCS2oV6ntG5YWjK1EQh3dnYxoSfwbzV+HbvUwqSbhNRRqJQkH/vb4foY/ +VcXvjf2uVf5IjlbvfpD8ZSVL6fp99+daUw10o4MLbxowysWauZnPuFCy8UjDDYVW +V/IYlEpnDHbhl4Gea8kUsfdxP/6XRB4FODoTkZX9nVdStIICqErXr9coLFwPVntd +3eSEfu7hWvWtz3J7NMPjE6D3s/PwL+H9UR2x2niiU7MDAgMBAAEwDQYJKoZIhvcN +AQELBQADggEBAMNRaAA3bkk6pAJ2bA9P+rj7IIMRx+PjamSLS8iWvDJ0BOANxMzS +rvxoqGgbnIrNAoHSr4Pa5o2zBcb1E4pDHPqNS1SVDY1Mz/rGa291VKClxqzEd3n8 +7LDnJm3FOSFv5/p7fTlgW6IZGn9O6DNiwhURPcGwyTSmGtE+OcVyzugOOR0zH4MO +GlfK3sG86M2+bTzkMgJDk99vTuogpwaddj0d67ra3TwCkma1Vk0D0MM+7Cplxh9g +9msJTe5K7Zluy2J2KR7WK5uliXO/bwCJYgfyF0U8rBOHDd50BFxqujHybTZLKlaE +pnbOGLjLOistRjnpaKbdzUIejaKd1NT518Y= +-----END CERTIFICATE----- diff --git a/examples/secrets/certsandkeys/client.private.key b/examples/secrets/certsandkeys/client.private.key new file mode 100644 index 0000000..58b04d9 --- /dev/null +++ b/examples/secrets/certsandkeys/client.private.key @@ -0,0 +1,28 @@ +-----BEGIN PRIVATE KEY----- +MIIEvwIBADANBgkqhkiG9w0BAQEFAASCBKkwggSlAgEAAoIBAQDAk7ToFYTNSYyQ +QGI0l2PxuvY5W/UO+KoOXLAGVpEXfTwbzoZT8VWSATv4ez6q+lTDo0pbYqbYRaNn +5El+dEOFEMbHWgxhGmZVOmkD8wYT+3HD57NJVCl7tnJI2I0akjAqiiljTf2rD/Wm +aN9yNTGsRcZaIv5HMO9dK+5yhCvVJ30NKD5fGYSkluIJsT5bYut+o9ZXTp20Z8ST +vOPtAYrHaM4nUFzTVnEVJNM70f6wa6hMvzpNuXOY4BY1A3z04EB1AQe/9ECFV04X +Dt7wisYxD1n1VfAqwbcWLJH+Y+3fe6+bYRIOk3LHO/lMEVqAEoMTkeplwGDB3Uh7 +6GkR/SrVAgMBAAECggEBALBWEC77lVEM6eMksUgK3/92/QNkyq5c0Aq6oIwNNGpX +yHSF1caDk6FP9AQBhk61Tmyd1vZ7DN+4VHpLNWjPOQxdYkckk3VO4SllhMeS/pvJ +gFCslySsJhgb5eYCNKKB/gzV2jQONBsxT/SCzygawVNHyOq8ZC34BxY/peXCVQil +uYYRj8pYJhVLqZPt2jUJFENk0W/K2Yr5xHcvX4ZckeHGMloEuI0u/jFCYI4tPXSi +0GyuUnZ2TFjMC/WEW5crbWEHZOZkskagdnlcU/QfvwwabXtJEPBfqjoJR3dwpbWa +ORukAOW8uZh4opoH76c0d6012DT0jNK6FBHe46X1JLkCgYEA9Exd6KYvPGmB+Tx3 +BgtD8XVM9qK3a2SIJcU4Wl6R6ulYLqCzGh79I+mGFFEzEOGM5DK/syBQ5TR7ctTc +Npt0tJm9XZrokb5uKU5CqafI4RotIfj7epOrjajIUCb17Ac4UkU/CMa9Cog9THzk +tNwpaC0h1QT7/V1KntBVDdzwi68CgYEAyc0fdVVddgytfYgc4v11VvbLfjVr1xbt +Cx2BwL3uyqUdNQnDI8s1MENhCQW1488ou7D1Z4DqX9QvYPcOVNAaaf3MVm41YBTf +Rq6x9VgZW+n5UytuG3yvrrbPkt2zP06+/1uoKgTHP7SzOQdE+Q1Jpf9NRpqM8Lfx +YXKjWN2pfrsCgYEA6nQf7BcRXjkjs76DvBkzq5eXtVuUDEz/HMCZxKDeCUTIjHdN +a9QxvTVwqC8Fgz3zqU3LDG4HNPGZSCtg7EdlSa4CPsNcUAMiViH1eDy+XMpyZhg9 +wPXXvqwtEj9R5KNJOiuawyF4a5M0wSNbmvdwBbrKrVWLQS03YBMwjY1sjaECgYBr +4sLnurydqQdzbjprTC/YT1bZYXwG4NXXtG2y+pfYNM/ZlB+EWlZUOCF/blMguJbB +SUjZjf0/QDQYNdyukRceBTaiGodkl6QKqMixLulXz02hHj3eahmOYWO109rJhLLt +2DWeSTGwqE2Mtos0TttJ6KSKk4O4Cc79VwlnMBI2kwKBgQC7FfnLYhPZ+QrluCYA +62rs+BNI8QzoDv3btY0skn/MueE1py6lsUX1BtaV8AKY6hx4woQSCHx2zJIg/FhG +j4nMlYSlPk5heueSG19jznS/ASPskh0BbVGmwJgrIMc+643LA7GJig8HlBNUvtux +jb/DNrHu4wWp5yxqS+kJ3VX4Hw== +-----END PRIVATE KEY----- diff --git a/examples/secrets/certsandkeys/client.public.crt b/examples/secrets/certsandkeys/client.public.crt new file mode 100644 index 0000000..810e573 --- /dev/null +++ b/examples/secrets/certsandkeys/client.public.crt @@ -0,0 +1,20 @@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tCWQAzrRU2rupndZHLImPzy/tGQBA/61ICDa80VMVggmQkzo3FjtuU9PCY +SFeMnPiWSaMeDTBKZg== +-----END CERTIFICATE----- diff --git a/examples/secrets/incorrecttrustoresandkeystores/kafka.client.keystore.jks b/examples/secrets/incorrecttrustoresandkeystores/kafka.client.keystore.jks new file mode 100644 index 0000000000000000000000000000000000000000..f2edd525d8a9e68ee4b0c63f88f785a2f4b2509b GIT binary patch literal 4623 zcmY+EWmFW5wuXnH8%dFn9@-&>ZjjEQMY=;^0O`&Fq)Qs4b5K&cyFsM8LmH&dckjCQ zoOOQewby#yckiDMIG7L{h=dFde$|VH$r>&nev6BQj+7Vtsvafy)%SmJ6*w5x_P-+3 z4=BN?I{#qkKck9<{eM?DSV+LUV3Y@NFv=~M1r6)}@juTgP>69Ck<012KkgB(ih|@< zql5TmjY@&YfF5;}V3ff(MlmP>uKEdtmRpBg$|@j{Zglh+_N29#{klX6?Fx3B=zEdu z3~|P9y5GG+_F|Q+7bUKn;R^RFK%RLws2i1H9k-aSglB?}{0V9bcXOr9ef9 zHm?n0Rz8wuD=4*rrAekI)%?$sbLi}LEYREE%`No@GFh}jkvs{CGj^@k(8+C104g7M z6FQJrTDJBrkmsO-NuU~P|A#pd;qUIiB|<8+PmaxqsU~RjeXy2jAS7@3eu-Ck-EBSmC7Z6;2Lyh<)gUp5wGoTD+L_A9?5jEVg zs37(nHKg;2Rhe5)(RzXa4RTr;kOf_9^!3$@472oQkhXHr?H{%oIx88p{7j2Q|AHZ5 zv2t&3s#V8b-vs@vv?jLWK)&A->uHK+(v|TZSC@WMlTBQcfeaPeWv1}*@h7jfz=6n= zF$BNdF|xd>2mPM~vfZ44QIw4VCggbHocurSh%K!cSh5ZC6wi*AW5ri*pv~Tp_Z2|~ zs%+4Oh@>O%pgd7Hg3rdyA~F7FK>s$cQ+;9T0H>4=OpxC;dm;0z_AmyU;8B*k_a2qB;sB($CALWX9v&PlzPU_eYY8Pi0K$!@hEaq}HN^(IJ9$HL zr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NX4R)%PX>wyMK z^B!I9EWRTqb8=fz&+o8UTAR814=KVLRlc6z8_;B?h4_p9^*}$#$_Rp{b<8D0^Zh)d zNRaNjQBUs%K80a_6XH(1rXM{D=n(VJ>N6VI)$;51nVd0OnlNG7j`+x&i}Lvm-G&7d zHSx2}-+cD%qX`tm(8(RAg45Qo*8_K{K*=fdv_|Fzn>~pRjq<*3Ett&*yYOId0%tSO zjx+*F!o!%U4V5%?(tDLGURLau5?;qZ9d_;yU6s<|<*iGVh~Ivv>G$3`T+b!**FjLb z;{2~la$alYu*p%!A7*8p?ar9@;qVEIV6)kJGsS^PA$j7U@q$qzNq`&J!JF|0O zs8cRedatrp3Sid1&u9u|7C2PIS>)JlqNc%OU|KLH8Y&weGVl#50EKv0-eSw{QCmI^ rKz%rm_BDJvHGCe0n1JZ(SrQ~7zvBtp&`jyg$vaWf0w6L{c;3GNSizzD literal 0 HcmV?d00001 diff --git a/examples/secrets/incorrecttrustoresandkeystores/kafka.client.truststore.jks b/examples/secrets/incorrecttrustoresandkeystores/kafka.client.truststore.jks new file mode 100644 index 0000000000000000000000000000000000000000..aaa2f68b8522ae2694a953d1475612184677fe48 GIT binary patch literal 1210 zcmV;r1V#HWf&{h#0Ru3C1aAfjDuzgg_YDCD0ic2eU<85$Trh$JSTKSFR0atuhDe6@ z4FLxRpn?QNFoFa@0s#Opf&@AS2`Yw2hW8Bt2LUiC1_~;MNQU_6jM z_FJ2(WH6*Kx{f}MTkUs#K!b$+pk_HMYVx z1oeG4LIE|kfUk}uIjf0MBGrD}(DJNx*WWs#!zUJ5o&pWtrgx@Uh%($&cw&z&&@otC z2M4uheIMBM{^G?6cc=OFTTNTcSQHlZF8Q&csKS<>X}jH}#}j*C@ZxCyl*sNm$zAt$vo;BK8fe%I7j;kQvyLkQO%} ztN0?pU_%Q1XXk6|I@dZdR(%bJ!$!J~>3kX#3DY3Dtd(eJP4!gGfa1xXz)w&*f^vMK zGo&b1=Mvof0G#Qmo+ipr1P_^n10NhfYgF40iO~I?bY!hiR=oRu(2|~+aYtsd zK|>F4c9vzfUS&gPQkcLFu(0QGVY*QnvuqL4_KGLrTCt>d>V$h*MIdb*upK@9$(VO7 zvhbr$^Nj8I`eKJNOvKou2i8K&Kz)|O9};iZiE;ObDsz$LbrH?`+8(SXNrF)}$ADJt zcKxNaB?4;?i5fV6YIkS0rPM$0&{zHp3usZH^KK@hLW!F2mMctggKYHN2I zS5tDEcF{YS>xWs9yOX9Wb@kx&jWTJD|GKpLW$ht(-Z8dH@{!GD9K~d~hg@o$yE0pK z5VOO;^}Bonz|zL0ZAN@(fVEtBy4I$gykh->o+#JhWr|g@d~(idQuP++(KmlmhlR@w zULG-`J9Uam*iM2vmAx4Dx{CfWX2N|*?>$~r#O{E@2$g7iQtLh1X9WI&v?skIC<=3R zMz$ zER(dskw%6J^jtuwX#wWTOzYj9Ldm;9s*w3H0Gc5R2Js~|RuWY32di#spGxHtUM)}K zv8InM!%JG3@o(pkW*>rjcXBvY6`xuz$3|#V=HMIqIk!ZkWiBv6dh1LrLHG(FkH4=B z(i)6%X-Ay4p5<~vZakKg93k-egLW?jt~;D~M2@r+t4kB?mBN<^#BWj6W*9L`ha~fw zffnnrWYc*kV|M#eAs#Ug_6{;rZ(T)zk2!CX@-J385njRqq7-)%1X0T@-nW%rI~ySC zT7?H|)AP%5%`iSNAutIB1uG5%0vZJX1QdU|USHijuf7MX7?XIE_LuFWnQ;UZ^Y^~H Y6-MXHE_uIfTh_r?74F``0s{etpzI7RR{#J2 literal 0 HcmV?d00001 diff --git a/examples/secrets/trustoresandkeystores/broker_keystore_creds b/examples/secrets/trustoresandkeystores/broker_keystore_creds new file mode 100644 index 0000000..f3097ab --- /dev/null +++ b/examples/secrets/trustoresandkeystores/broker_keystore_creds @@ -0,0 +1 @@ +password diff --git a/examples/secrets/trustoresandkeystores/broker_sslkey_creds b/examples/secrets/trustoresandkeystores/broker_sslkey_creds new file mode 100644 index 0000000..f3097ab --- /dev/null +++ b/examples/secrets/trustoresandkeystores/broker_sslkey_creds @@ -0,0 +1 @@ +password diff --git a/examples/secrets/trustoresandkeystores/broker_truststore_creds b/examples/secrets/trustoresandkeystores/broker_truststore_creds new file mode 100644 index 0000000..f3097ab --- /dev/null +++ b/examples/secrets/trustoresandkeystores/broker_truststore_creds @@ -0,0 +1 @@ +password diff --git a/examples/secrets/trustoresandkeystores/kafka.broker.keystore.jks b/examples/secrets/trustoresandkeystores/kafka.broker.keystore.jks new file mode 100644 index 0000000000000000000000000000000000000000..5bd0ed7ef5157ff92d4a47172397e325661a538e GIT binary patch literal 4623 zcmY+EWmFW5wuWICx?uq6lCB{|8AcEg>F$tLN@f7*7zPPR3F#c#p=&6mQ;~3}A*Cfn zDG52>z3bj{*7>p5Uh8?^y?;JnBpo>bp8$-c9UvkVj(!$>L5WX{UxcJ>0U~J|{=qe1 zB%$knMTC|>B%$d)*zljxB_jX7D+)4vKoJsn4MqYlz(Pc1|BwH9&I$xcYPIvuL5Mfo ztx0eXaSJj0e>w^P1bF@WKqPR)@yv$qLiEU$n4jh9wJ?=mvGdPi@hjCa`0y3_#+%y%G!Sn^iZ&>o2o2g$l00IZEh%F?(kf3?mlxp{H z^-LnHFOZ@t3rY*u(B`n4s7=-M?~%29LCwe zR8GjveXEcI!~q4)qOagRwXO_L(QHfmK-pvRf_jJvK|YLE)`Tqyf1YewN>XC*Ygp7T zU|%klaj>K_H|wNK(@SZ*_qP0jU!v)y--e@y2vhR>i7b{WRJps64VI|b1&qw%{>|a~ z<}HPvtJ&rNl$V$IluLZf@pNXSYo>1HPx$nrsCW%r(*xjsfN8Rt*o&(}$l5RQs4`64 zE%zAT4(3<1vo2!x`7FD7`pvm2-}7WafKw@3PO?k<_t5RBmA`Cw;eklz(vu3qxAxEabN-8jH+=V|Qt0XV9fN*3{Zv+=sTU#20^e_yP?e-;+xV*WCCSg-GJL1tSS6p?b#h1vxEJ&KJnnh;J2Vi%IEgQzBRdrM#O( zl6lw%oL}}#Y5!s6w!v_?+$mqOS_D;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=HZMnDhF@OL+y69iul)BIW literal 0 HcmV?d00001 diff --git a/examples/secrets/trustoresandkeystores/kafka.broker.truststore.jks b/examples/secrets/trustoresandkeystores/kafka.broker.truststore.jks new file mode 100644 index 0000000000000000000000000000000000000000..4b732b8a1ae18343aa6bde7b72e0f4687aaafe48 GIT binary patch literal 2146 zcmV-o2%YyZf(Tv$0Ru3C2p0wkDuzgg_YDCD0ic2i2n2!%1TcaK05F0F{00dshDe6@ z4FLxRpn?bOFoFl^0s#Opf(POT2`Yw2hW8Bt2LUiC1_~;MNQUL<7jxD%`gbSihs@0Zy5aNDr3 z48C*M(Q{vbn*((>(3#t_CPBU{k7TTH?;||j+tj#gKB-KmyuRfU1D6pwN{ozQx0)}g z6&q*DY(qE1u5C7XU%ha52bW@5Rmu45@Y}M#9kn${h#fCQ_5@5<)B?*@+vJ3Y$DD5{ zo{hS7;;pP&N$P_k_MV7oSey5<=2*dAgn~^@=N)-NKs`{D?^U|@j>Fz_Y|@9Kx4aUM zOR|U;Jy<_0aqXGE;gm&n&K;IgiW<8`uLtPFX1{Mhf2DXc>ZW{zGaVhLCdj%PSB>D) zacw?}Xf36`u`ea|yS7rkcTRZ-4W9=7xJq`Ib?Z)So~;Xgf6!JZ7pW>w_e!3+Hff#! zy);PD9_Or$eg{i7Qpj5$=vAAxRHNMQCugxB$`hCK5}fo)N2CgXRl9-+Ex&a3l?XWaoLDwfjWlgVWYk7#APDw$3O);Bk+^P*+6$a! zW6X8a9}Ts!OtOCEbzB#_fnDHth>PC^d0yc;03sj8cI8AEnF)DZ=skyTbn9-cmm@jC z0vv2Q*laS35E&DdRPf!+_Y2%1jA5*e^;iJ94(xlIqrX0+?V5SGaK-!y%_N z@X~E{Ihh9Sd}{M9j;!f_We%@`(G#K9IDs<=$*qH|97rdQw_gFU@ui&8D?I1VWH-Dp zOrPUfnQtqIrbqZ$acFQzW2!FOtFHGqt*X8UTWhx*j@46EBU267mjwnEa`tE|6a~J| z9)q$nQh)z269=u%sX0S58M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>v4UI}j}`d+J30_#0_{_}XAmYb zzkM{G6u}!d_AVIjrPj!yp=s{s8ZaXIL1MIuxc*rPLyMoXCo-VE z1TBenuzUR`_^^W~{YXF%V?tXQT|1tH=!u`osIl)UN4uN`ePGLzaSbLRtNZ5HEV=cw z;O`Y~>Omb3?qsjX{C`3)F(|5&WZwyW`}`(Z5ZK0Aw=NJ8;?b)Ul!A@1d`>FOd!}Wh zMd(W+QS7~<38_P0-NF+WS?(Rj#?w+%vvS>u|Qk<>9t zX?jfK{v63(6B7d~p$%+HO6aDZWXjf$c-~9X*5SL0qVE78`lTz8#$+BCj)3&T1%zh( z?xv@ULsy-k!8~d~obH?l;N|*}s|Y4wq;$pt7H-b9gD|P7mf!L#^ubtWf;sjP$%e*G z8*ux6G!?FH)A0BHgvfwrBA3)_MMCb)^@pO_c_$gF#Pd>Cxqrz|Cc-`%Zx`rX#TF(@^Uh)h%P2A^??NB-ZHG}LIxkly5qw{0P<@EYqI2BE znh+w9+bbB3E56Cf%TciYvJ**RI&j1{wX728U9d^3#QDr?Aa-~d($Dp~kIyc7 zYG8GpOQ1rQ9PA!UG*x1T91Q_@2o8MXI%y7OSkQTScQCJ>^dg0t_YSJGhnc=7S-?pV z{h{+teO?Vu!Olt}Zh63li7VV_*YOZ436W8aiZqW+bSy2v?Zj)2I_iy3+ACck& z$A1BiChN+Gk|ldKEp0me>HCoYQ;LS=~FUc8HW@_xn&xJi6EhR_uz}#dl3r^{5m#VTTxvxHz;)^+I8#psZ?6 zF1i7-AeAutIB1uG5%0vZJX1QetFASiZw@AD2p4LSbo9r6pVRfz-?OZ%RC YGrIYd&K_&kRH_0ad|zgk0s{etpr-3LCjbBd literal 0 HcmV?d00001 From 61cb19a0750a3e44471f54f77390f3e7b2a2516c Mon Sep 17 00:00:00 2001 From: Nuvindu Date: Wed, 10 Apr 2024 20:36:47 +0530 Subject: [PATCH 03/15] Add example for Avro serializer with Kafka producer --- examples/kafka-avro-producer/Ballerina.toml | 8 +++ examples/kafka-avro-producer/main.bal | 61 +++++++++++++++++++++ 2 files changed, 69 insertions(+) create mode 100644 examples/kafka-avro-producer/Ballerina.toml create mode 100644 examples/kafka-avro-producer/main.bal diff --git a/examples/kafka-avro-producer/Ballerina.toml b/examples/kafka-avro-producer/Ballerina.toml new file mode 100644 index 0000000..7b9c9e1 --- /dev/null +++ b/examples/kafka-avro-producer/Ballerina.toml @@ -0,0 +1,8 @@ +[package] +org = "wso2" +name = "kafka_avro_serdes_test" +version = "0.1.0" +distribution = "2201.8.6" + +[build-options] +observabilityIncluded = true diff --git a/examples/kafka-avro-producer/main.bal b/examples/kafka-avro-producer/main.bal new file mode 100644 index 0000000..9e9fc9f --- /dev/null +++ b/examples/kafka-avro-producer/main.bal @@ -0,0 +1,61 @@ +// Copyright (c) 2024, WSO2 LLC. (http://www.wso2.com) +// +// WSO2 LLC. licenses this file to you under the Apache License, +// Version 2.0 (the "License"); you may not use this file except +// in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +import ballerina/http; +import ballerinax/confluent.cavroserdes; +import ballerinax/kafka; + +configurable string baseUrl = ?; +configurable map originals = ?; +configurable map headers = ?; + +type Order readonly & record { + int orderId; + string productName; +}; + +service / on new http:Listener(9090) { + private final kafka:Producer orderProducer; + private final cavroserdes:Client registry; + + function init() returns error? { + self.orderProducer = check new (kafka:DEFAULT_URL); + self.registry = check new ({ + baseUrl, + originals, + headers + }); + } + + resource function post orders(Order newOrder) returns http:Accepted|error { + string schema = string ` + { + "namespace": "example.avro", + "type": "record", + "name": "Order", + "fields": [ + {"name": "orderId", "type": "int"}, + {"name": "productName", "type": "string"} + ] + }`; + byte[] byteValue = check self.registry->serialize(schema, newOrder, "new-subject"); + check self.orderProducer->send({ + topic: "test-topic", + value: byteValue + }); + return http:ACCEPTED; + } +} From 8c7a3e3f2add1f05bfa1de38c1b01001a71e0a15 Mon Sep 17 00:00:00 2001 From: Nuvindu Date: Wed, 10 Apr 2024 20:37:07 +0530 Subject: [PATCH 04/15] Add example for Avro serializer with Kafka consumer --- examples/kafka-avro-consumer/Ballerina.toml | 8 ++++ examples/kafka-avro-consumer/main.bal | 50 +++++++++++++++++++++ 2 files changed, 58 insertions(+) create mode 100644 examples/kafka-avro-consumer/Ballerina.toml create mode 100644 examples/kafka-avro-consumer/main.bal diff --git a/examples/kafka-avro-consumer/Ballerina.toml b/examples/kafka-avro-consumer/Ballerina.toml new file mode 100644 index 0000000..7b9c9e1 --- /dev/null +++ b/examples/kafka-avro-consumer/Ballerina.toml @@ -0,0 +1,8 @@ +[package] +org = "wso2" +name = "kafka_avro_serdes_test" +version = "0.1.0" +distribution = "2201.8.6" + +[build-options] +observabilityIncluded = true diff --git a/examples/kafka-avro-consumer/main.bal b/examples/kafka-avro-consumer/main.bal new file mode 100644 index 0000000..18d76f1 --- /dev/null +++ b/examples/kafka-avro-consumer/main.bal @@ -0,0 +1,50 @@ +// Copyright (c) 2024, WSO2 LLC. (http://www.wso2.com) +// +// WSO2 LLC. licenses this file to you under the Apache License, +// Version 2.0 (the "License"); you may not use this file except +// in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +import ballerina/io; +import ballerinax/confluent.cavroserdes; +import ballerinax/kafka; + +type Order readonly & record { + int orderId; + string productName; +}; + +configurable string baseUrl = ?; +configurable int identityMapCapacity = ?; +configurable map originals = ?; +configurable map headers = ?; + +public function main() returns error? { + kafka:Consumer orderConsumer = check new (kafka:DEFAULT_URL, { + groupId: "test-topic-id", + topics: "test-topic" + }); + + cavroserdes:Client registry = check new ({ + baseUrl, + identityMapCapacity, + originals, + headers + }); + + while true { + kafka:AnydataConsumerRecord[] getValues = check orderConsumer->poll(60); + byte[] orderData = getValues[0].value; + Order getOrder = check registry->deserialize(orderData); + io:println("Order : ", getOrder); + } +} From b7569436c74ce34e23304a386238b35dd224647e Mon Sep 17 00:00:00 2001 From: Nuvindu Date: Wed, 10 Apr 2024 20:38:11 +0530 Subject: [PATCH 05/15] Exclue examples in dev release workflow --- .github/workflows/dev-stg-release.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/dev-stg-release.yml b/.github/workflows/dev-stg-release.yml index 49d6f52..f9d6e5e 100644 --- a/.github/workflows/dev-stg-release.yml +++ b/.github/workflows/dev-stg-release.yml @@ -19,3 +19,4 @@ jobs: secrets: inherit with: environment: ${{ github.event.inputs.environment }} + additional-publish-flags: "-x :confluent.cavroserdes-examples:build" From 587625f29d76f9197c013133803289b15d6ac747 Mon Sep 17 00:00:00 2001 From: Nuvindu Date: Wed, 10 Apr 2024 20:38:37 +0530 Subject: [PATCH 06/15] Add necessary files to run Kafka server on docker --- examples/configs/kafka_server_jaas.conf | 14 ++++++++++++++ examples/configs/zookeeper_jaas.conf | 5 +++++ 2 files changed, 19 insertions(+) create mode 100644 examples/configs/kafka_server_jaas.conf create mode 100644 examples/configs/zookeeper_jaas.conf diff --git a/examples/configs/kafka_server_jaas.conf b/examples/configs/kafka_server_jaas.conf new file mode 100644 index 0000000..cb79601 --- /dev/null +++ b/examples/configs/kafka_server_jaas.conf @@ -0,0 +1,14 @@ +KafkaServer { + org.apache.kafka.common.security.plain.PlainLoginModule required + serviceName="test-service" + username="admin" + password="password" + user_admin="password" + user_client="client-secret"; +}; + +Client { + org.apache.zookeeper.server.auth.DigestLoginModule required + username="admin" + password="password"; +}; diff --git a/examples/configs/zookeeper_jaas.conf b/examples/configs/zookeeper_jaas.conf new file mode 100644 index 0000000..0158eb4 --- /dev/null +++ b/examples/configs/zookeeper_jaas.conf @@ -0,0 +1,5 @@ +Server { + org.apache.zookeeper.server.auth.DigestLoginModule required + user_super="admin-secret" + user_admin="password"; +}; From e2e1c621febd82313beeecde549ee9675816cac3 Mon Sep 17 00:00:00 2001 From: Nuvindu Date: Wed, 10 Apr 2024 20:39:00 +0530 Subject: [PATCH 07/15] Add README.md to run the examples --- ballerina/Dependencies.toml | 4 +- examples/README.md | 76 +++++++++++++++++++++++++++++++++++++ 2 files changed, 78 insertions(+), 2 deletions(-) create mode 100644 examples/README.md diff --git a/ballerina/Dependencies.toml b/ballerina/Dependencies.toml index e844b6f..d74b27f 100644 --- a/ballerina/Dependencies.toml +++ b/ballerina/Dependencies.toml @@ -23,7 +23,7 @@ dependencies = [ [[package]] org = "ballerina" name = "avro" -version = "0.1.0" +version = "0.1.1" dependencies = [ {org = "ballerina", name = "jballerina.java"} ] @@ -359,7 +359,7 @@ modules = [ [[package]] org = "ballerinax" name = "confluent.cregistry" -version = "0.1.0" +version = "0.1.1" dependencies = [ {org = "ballerina", name = "jballerina.java"} ] diff --git a/examples/README.md b/examples/README.md new file mode 100644 index 0000000..46489bf --- /dev/null +++ b/examples/README.md @@ -0,0 +1,76 @@ +## Examples + +The Ballerina Avro Serializer/Deserializer connector for Confluent Schema Registry provides practical examples illustrating usage in various scenarios. Explore these [examples](https://github.com/ballerina-platform/module-ballerinax-confluent.cavroserdes/tree/main/examples). + +1. [Kafka Avro producer](https://github.com/ballerina-platform/module-ballerinax-confluent.cavroserdes/tree/main/examples/kafka-avro-producer) + This example shows how to publish Avro serialized data to a Kafka topic. + +2. [Kafka Avro consumer](https://github.com/ballerina-platform/module-ballerinax-confluent.cavroserdes/tree/main/examples/kafka-avro-consumer) + This example shows how to consume data in the correct format from a Kafka topic. + +## Prerequisites + +Create a `Config.toml` file with the base URL, schema capacity, subject, connection configurations and header values. Here's an example of how your `Config.toml` file should look: + + ```toml + baseUrl = + identityMapCapacity = + subject = + + [originals] + "schema.registry.url" = + "basic.auth.credentials.source" = "USER_INFO" + "bootstrap.servers" = ":" + "schema.registry.basic.auth.user.info" = ":" + + [headers] + ``` + +## Running an Example + +Execute the following commands to build an example from the source: + +* To build an example: + + ```bash + bal build + ``` + +* To run an example: + + ```bash + bal run + ``` + + +## Step 01: Start a Kafka Server + +Execute the following docker command to start the Kafka server. + +```bash +sudo docker-compose -f docker-compose.yaml up -d +``` + +## Step 02: Start the Kafka Producer + +Go to the [kafka-avro-producer](https://github.com/ballerina-platform/module-ballerinax-confluent.cavroserdes/tree/main/examples/kafka-avro-producer) directory and start the Ballerina service. + +```bash +bal run +``` + +## Step 03: Run the Kafka Consumer + +Go to the [kafka-avro-consumer](https://github.com/ballerina-platform/module-ballerinax-confluent.cavroserdes/tree/main/examples/kafka-avro-consumer) directory and execute the following command. + +```bash +bal run +``` + +## Step 04: Execute the cURL command + +Execute the following curl command in a terminal. + +```curl +curl http://localhost:9090/orders -H "Content-type:application/json" -d "{\"orderId\": 1, \"productName\": \"sport-shoes\"}" +``` From 859f663c5c6dc8f39fffe6b2c157dbd707cfd053 Mon Sep 17 00:00:00 2001 From: Nuvindu Date: Wed, 10 Apr 2024 20:40:24 +0530 Subject: [PATCH 08/15] Fix license header --- examples/build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/build.gradle b/examples/build.gradle index eba5913..1b84a26 100644 --- a/examples/build.gradle +++ b/examples/build.gradle @@ -1,5 +1,5 @@ /* - * Copyright (c) 2024, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. + * Copyright (c) 2024, WSO2 Inc. (http://www.wso2.com). * * WSO2 Inc. licenses this file to you under the Apache License, * Version 2.0 (the "License"); you may not use this file except From 0762ae2433c46d13c83c9f9fb2b11b2c28794d7f Mon Sep 17 00:00:00 2001 From: Nuvindu Date: Wed, 10 Apr 2024 20:59:58 +0530 Subject: [PATCH 09/15] Fix building all the directoris in exmaples --- examples/build.sh | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/examples/build.sh b/examples/build.sh index e2659d3..4166236 100755 --- a/examples/build.sh +++ b/examples/build.sh @@ -46,6 +46,12 @@ for dir in $(find "$BAL_EXAMPLES_DIR" -type d -maxdepth 1 -mindepth 1); do if [[ "$dir" == *build ]]; then continue fi + if [[ "$dir" == *configs ]]; then + continue + fi + if [[ "$dir" == *secrets ]]; then + continue + fi (cd "$dir" && bal "$BAL_CMD" --offline && cd ..); done From e8f091bf68365332949cfb79f27c4af9a3f22315 Mon Sep 17 00:00:00 2001 From: Nuvindu Date: Wed, 10 Apr 2024 21:00:09 +0530 Subject: [PATCH 10/15] Update README.md in examples --- examples/README.md | 15 +-------------- 1 file changed, 1 insertion(+), 14 deletions(-) diff --git a/examples/README.md b/examples/README.md index 46489bf..ed603b6 100644 --- a/examples/README.md +++ b/examples/README.md @@ -28,20 +28,7 @@ Create a `Config.toml` file with the base URL, schema capacity, subject, connect ## Running an Example -Execute the following commands to build an example from the source: - -* To build an example: - - ```bash - bal build - ``` - -* To run an example: - - ```bash - bal run - ``` - +Follow these steps to run the examples. ## Step 01: Start a Kafka Server From e3d2ccda2dc45b0f5ef3c49e09c225f97017764e Mon Sep 17 00:00:00 2001 From: Nuvindu Date: Wed, 10 Apr 2024 21:10:03 +0530 Subject: [PATCH 11/15] Update example directory names --- examples/kafka-avro-consumer/Ballerina.toml | 2 +- examples/kafka-avro-producer/Ballerina.toml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/kafka-avro-consumer/Ballerina.toml b/examples/kafka-avro-consumer/Ballerina.toml index 7b9c9e1..61d615f 100644 --- a/examples/kafka-avro-consumer/Ballerina.toml +++ b/examples/kafka-avro-consumer/Ballerina.toml @@ -1,6 +1,6 @@ [package] org = "wso2" -name = "kafka_avro_serdes_test" +name = "kafka_avro_consumer" version = "0.1.0" distribution = "2201.8.6" diff --git a/examples/kafka-avro-producer/Ballerina.toml b/examples/kafka-avro-producer/Ballerina.toml index 7b9c9e1..78ab3ba 100644 --- a/examples/kafka-avro-producer/Ballerina.toml +++ b/examples/kafka-avro-producer/Ballerina.toml @@ -1,6 +1,6 @@ [package] org = "wso2" -name = "kafka_avro_serdes_test" +name = "kafka_avro_producer" version = "0.1.0" distribution = "2201.8.6" From 9a01503a90d061de67d47ad344ab743383f958b2 Mon Sep 17 00:00:00 2001 From: Nuvindu Date: Wed, 10 Apr 2024 21:12:22 +0530 Subject: [PATCH 12/15] Fix not importing kafka module to build examples --- examples/build.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/build.sh b/examples/build.sh index 4166236..121920f 100755 --- a/examples/build.sh +++ b/examples/build.sh @@ -52,7 +52,7 @@ for dir in $(find "$BAL_EXAMPLES_DIR" -type d -maxdepth 1 -mindepth 1); do if [[ "$dir" == *secrets ]]; then continue fi - (cd "$dir" && bal "$BAL_CMD" --offline && cd ..); + (cd "$dir" && bal "$BAL_CMD" && cd ..); done # Remove generated JAR files From ed4d366d1492df0865f83756d20b2d42d9559a6c Mon Sep 17 00:00:00 2001 From: Nuvindu Date: Wed, 10 Apr 2024 21:21:17 +0530 Subject: [PATCH 13/15] Add symlinks to example directories --- examples/README.md | 2 +- .../kafka-avro-consumer/.github/README.md | 1 + .../kafka-avro-consumer.md | 31 +++++++++++++++++++ .../kafka-avro-producer/.github/README.md | 1 + .../kafka-avro-producer.md | 31 +++++++++++++++++++ 5 files changed, 65 insertions(+), 1 deletion(-) create mode 120000 examples/kafka-avro-consumer/.github/README.md create mode 100644 examples/kafka-avro-consumer/kafka-avro-consumer.md create mode 120000 examples/kafka-avro-producer/.github/README.md create mode 100644 examples/kafka-avro-producer/kafka-avro-producer.md diff --git a/examples/README.md b/examples/README.md index ed603b6..8900398 100644 --- a/examples/README.md +++ b/examples/README.md @@ -6,7 +6,7 @@ The Ballerina Avro Serializer/Deserializer connector for Confluent Schema Regist This example shows how to publish Avro serialized data to a Kafka topic. 2. [Kafka Avro consumer](https://github.com/ballerina-platform/module-ballerinax-confluent.cavroserdes/tree/main/examples/kafka-avro-consumer) - This example shows how to consume data in the correct format from a Kafka topic. + This guide demonstrates how to consume data in the correct format according to Avro schema from a Kafka topic. ## Prerequisites diff --git a/examples/kafka-avro-consumer/.github/README.md b/examples/kafka-avro-consumer/.github/README.md new file mode 120000 index 0000000..254e554 --- /dev/null +++ b/examples/kafka-avro-consumer/.github/README.md @@ -0,0 +1 @@ +../kafka-avro-consumer.md \ No newline at end of file diff --git a/examples/kafka-avro-consumer/kafka-avro-consumer.md b/examples/kafka-avro-consumer/kafka-avro-consumer.md new file mode 100644 index 0000000..b7b2ca8 --- /dev/null +++ b/examples/kafka-avro-consumer/kafka-avro-consumer.md @@ -0,0 +1,31 @@ +# Consume Avro Serialized Data from a Kafka Topic + +## Introduction + +This guide demonstrates how to consume data in the correct format according to Avro schema from a Kafka topic. + +### Configuration + +Configure the followings in Config.toml in the example directory. + +```toml +baseUrl = +identityMapCapacity = +subject = + +[originals] +"schema.registry.url" = +"basic.auth.credentials.source" = "USER_INFO" +"bootstrap.servers" = ":" +"schema.registry.basic.auth.user.info" = ":" + +[headers] +``` + +## Run the example + +Execute the following command to run the example. + +```ballerina +bal run +``` diff --git a/examples/kafka-avro-producer/.github/README.md b/examples/kafka-avro-producer/.github/README.md new file mode 120000 index 0000000..2b1897f --- /dev/null +++ b/examples/kafka-avro-producer/.github/README.md @@ -0,0 +1 @@ +../kafka-avro-producer.md \ No newline at end of file diff --git a/examples/kafka-avro-producer/kafka-avro-producer.md b/examples/kafka-avro-producer/kafka-avro-producer.md new file mode 100644 index 0000000..01f1fd4 --- /dev/null +++ b/examples/kafka-avro-producer/kafka-avro-producer.md @@ -0,0 +1,31 @@ +# Publish Avro Serialized Data to a Kafka Topic + +## Introduction + +This guide demonstrates how to publish Avro serialized data to a Kafka topic. + +### Configuration + +Configure the followings in Config.toml in the example directory. + +```toml +baseUrl = +identityMapCapacity = +subject = + +[originals] +"schema.registry.url" = +"basic.auth.credentials.source" = "USER_INFO" +"bootstrap.servers" = ":" +"schema.registry.basic.auth.user.info" = ":" + +[headers] +``` + +## Run the example + +Execute the following command to run the example. + +```ballerina +bal run +``` From 0d3672740c11bbb3fc1b7305edba8ede0cf56a12 Mon Sep 17 00:00:00 2001 From: Nuvindu Date: Wed, 10 Apr 2024 21:26:49 +0530 Subject: [PATCH 14/15] Update config values in description --- examples/README.md | 6 +++--- examples/kafka-avro-consumer/kafka-avro-consumer.md | 8 ++++---- examples/kafka-avro-producer/kafka-avro-producer.md | 8 ++++---- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/examples/README.md b/examples/README.md index 8900398..f0bd8e6 100644 --- a/examples/README.md +++ b/examples/README.md @@ -13,12 +13,12 @@ The Ballerina Avro Serializer/Deserializer connector for Confluent Schema Regist Create a `Config.toml` file with the base URL, schema capacity, subject, connection configurations and header values. Here's an example of how your `Config.toml` file should look: ```toml - baseUrl = + baseUrl = "" identityMapCapacity = - subject = + subject = "" [originals] - "schema.registry.url" = + "schema.registry.url" = "" "basic.auth.credentials.source" = "USER_INFO" "bootstrap.servers" = ":" "schema.registry.basic.auth.user.info" = ":" diff --git a/examples/kafka-avro-consumer/kafka-avro-consumer.md b/examples/kafka-avro-consumer/kafka-avro-consumer.md index b7b2ca8..a0df137 100644 --- a/examples/kafka-avro-consumer/kafka-avro-consumer.md +++ b/examples/kafka-avro-consumer/kafka-avro-consumer.md @@ -6,15 +6,15 @@ This guide demonstrates how to consume data in the correct format according to A ### Configuration -Configure the followings in Config.toml in the example directory. +Configure the followings in `Config.toml` in the directory. ```toml -baseUrl = +baseUrl = "" identityMapCapacity = -subject = +subject = "" [originals] -"schema.registry.url" = +"schema.registry.url" = "" "basic.auth.credentials.source" = "USER_INFO" "bootstrap.servers" = ":" "schema.registry.basic.auth.user.info" = ":" diff --git a/examples/kafka-avro-producer/kafka-avro-producer.md b/examples/kafka-avro-producer/kafka-avro-producer.md index 01f1fd4..e5b20e5 100644 --- a/examples/kafka-avro-producer/kafka-avro-producer.md +++ b/examples/kafka-avro-producer/kafka-avro-producer.md @@ -6,15 +6,15 @@ This guide demonstrates how to publish Avro serialized data to a Kafka topic. ### Configuration -Configure the followings in Config.toml in the example directory. +Configure the followings in `Config.toml` in the directory. ```toml -baseUrl = +baseUrl = "" identityMapCapacity = -subject = +subject = "" [originals] -"schema.registry.url" = +"schema.registry.url" = "" "basic.auth.credentials.source" = "USER_INFO" "bootstrap.servers" = ":" "schema.registry.basic.auth.user.info" = ":" From ac798816a43928a12c599a9c24f672def5b82e81 Mon Sep 17 00:00:00 2001 From: Nuvindu Nirmana <63797478+Nuvindu@users.noreply.github.com> Date: Wed, 10 Apr 2024 21:27:24 +0530 Subject: [PATCH 15/15] Remove the `sudo` command Co-authored-by: Thisaru Guruge --- examples/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/README.md b/examples/README.md index f0bd8e6..2355afb 100644 --- a/examples/README.md +++ b/examples/README.md @@ -35,7 +35,7 @@ Follow these steps to run the examples. Execute the following docker command to start the Kafka server. ```bash -sudo docker-compose -f docker-compose.yaml up -d +docker-compose -f docker-compose.yaml up -d ``` ## Step 02: Start the Kafka Producer