-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add experimental support for KVP format and subscription to regex
- Loading branch information
1 parent
9b60c71
commit 5c14cf7
Showing
62 changed files
with
2,149 additions
and
54 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
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
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
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
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
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,3 @@ | ||
# Quick Start | ||
|
||
This folder contains all the resources needed to launch the _Quick Start_ app. See the [Quick Start](../../README.md#quick-start-set-up-in-5-minutes) section for more details. |
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,46 @@ | ||
<?xml version="1.0"?> | ||
|
||
<!-- Mandatory. Define the Kafka Connector Adapter Set and its unique ID. --> | ||
<adapters_conf id="KafkaConnector"> | ||
<metadata_provider> | ||
<adapter_class>com.lightstreamer.kafka.adapters.pub.KafkaConnectorMetadataAdapter</adapter_class> | ||
<param name="logging.configuration.path">log4j.properties</param> | ||
</metadata_provider> | ||
|
||
<data_provider name="prices"> | ||
<adapter_class>com.lightstreamer.kafka.adapters.KafkaConnectorDataAdapter</adapter_class> | ||
|
||
<param name="bootstrap.servers">broker:29092</param> | ||
|
||
<param name="group.id">quick-start-group</param> | ||
|
||
<param name="record.key.evaluator.type">STRING</param> | ||
<param name="record.value.evaluator.type">KVP</param> | ||
|
||
<param name="item-template.quotes">quote-#{topic=TOPIC}</param> | ||
|
||
<param name="map.MPDF.SIT.DATA.QUOTE.SAMA.(\d+).to">item-template.quotes</param> | ||
<!-- | ||
<param name="map.MPDF.SIT.DATA.QUOTE.SAMA.(\d+)_15m.to">quotes_15m</param> | ||
<param name="map.MPDF.SIT.DATA.QUOTE.SAMA.(\d+)_SABE.to">quotes_sabe</param> | ||
<param name="map.MPDF.SIT.DATA.QUOTE.SAMA.(\d+)_SABE_15m.to">quotes_sabe_15m</param> | ||
--> | ||
|
||
<param name="field.SYMBOL">#{VALUE.NAME}</param> | ||
<param name="field.QCHARTTOT">#{VALUE.QCHARTTOT}</param> | ||
<param name="field.TRow">#{VALUE.TRow}</param> | ||
<param name="field.TMSTMP">#{VALUE.TMSTMP}</param> | ||
<param name="field.QCHART">#{VALUE.QCHART}</param> | ||
<param name="field.VTOT">#{VALUE.VTOT}</param> | ||
<param name="field.QTOT">#{VALUE.QTOT}</param> | ||
<param name="field.QA">#{VALUE.QA}</param> | ||
<param name="field.Q">#{VALUE.Q}</param> | ||
<param name="field.PA">#{VALUE.PA}</param> | ||
<param name="field.PCHART">#{VALUE.PCHART}</param> | ||
<param name="field.NTRAD">#{VALUE.NTRAD}</param> | ||
<param name="field.PLIM_MIN">#{VALUE.PLIM_MIN}</param> | ||
<param name="field.PLIM_MAX">#{VALUE.PLIM_MAX}</param> | ||
|
||
</data_provider> | ||
|
||
</adapters_conf> |
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 @@ | ||
../compose-templates/docker |
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,50 @@ | ||
--- | ||
name: quickstart-kafka-connector | ||
services: | ||
kafka-connector: | ||
container_name: kafka-connector | ||
image: lightstreamer-kafka-connector-${version} | ||
depends_on: | ||
- broker | ||
- producer | ||
ports: | ||
- 8080:8080 | ||
volumes: | ||
- ./web:/lightstreamer/pages/QuickStart | ||
- ./adapters.xml:/lightstreamer/adapters/lightstreamer-kafka-connector-${version}/adapters.xml | ||
- ./log4j.properties:/lightstreamer/adapters/lightstreamer-kafka-connector-${version}/log4j.properties | ||
|
||
producer: | ||
container_name: producer | ||
depends_on: | ||
- broker | ||
build: | ||
context: ./producer | ||
args: | ||
VERSION: ${version} | ||
command: ["--bootstrap-servers", "broker:29092"] | ||
|
||
broker: | ||
image: apache/kafka | ||
hostname: broker | ||
container_name: broker | ||
ports: | ||
- "9092:9092" | ||
- "8082:8082" | ||
environment: | ||
KAFKA_NODE_ID: 1 | ||
KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: 'CONTROLLER:PLAINTEXT,PLAINTEXT:PLAINTEXT,PLAINTEXT_HOST:PLAINTEXT' | ||
KAFKA_ADVERTISED_LISTENERS: 'PLAINTEXT://broker:29092,PLAINTEXT_HOST://localhost:9092' | ||
KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 1 | ||
KAFKA_GROUP_INITIAL_REBALANCE_DELAY_MS: 0 | ||
KAFKA_TRANSACTION_STATE_LOG_MIN_ISR: 1 | ||
KAFKA_TRANSACTION_STATE_LOG_REPLICATION_FACTOR: 1 | ||
KAFKA_PROCESS_ROLES: 'broker,controller' | ||
KAFKA_CONTROLLER_QUORUM_VOTERS: '1@broker:29093' | ||
KAFKA_LISTENERS: 'PLAINTEXT://broker:29092,CONTROLLER://broker:29093,PLAINTEXT_HOST://0.0.0.0:9092' | ||
KAFKA_INTER_BROKER_LISTENER_NAME: 'PLAINTEXT' | ||
KAFKA_CONTROLLER_LISTENER_NAMES: 'CONTROLLER' | ||
KAFKA_LOG_DIRS: '/tmp/kraft-combined-logs' | ||
KAFKA_REST_HOST_NAME: rest-proxy | ||
KAFKA_REST_BOOTSTRAP_SERVERS: 'broker:29092' | ||
KAFKA_REST_LISTENERS: 'http://0.0.0.0:8082' |
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 @@ | ||
../compose-templates/helpers.sh |
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,24 @@ | ||
# Licensed to the Apache Software Foundation (ASF) under one or more | ||
# contributor license agreements. See the NOTICE file distributed with | ||
# this work for additional information regarding copyright ownership. | ||
# The ASF 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. | ||
|
||
log4j.logger.com.lightstreamer.kafka.adapters.pub.KafkaConnectorMetadataAdapter | ||
log4j.logger.org.apache.kafka=WARN, stdout | ||
log4j.appender.stdout=org.apache.log4j.ConsoleAppender | ||
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout | ||
log4j.appender.stdout.layout.ConversionPattern=[%d] [%-20t] [%-10c{1}] %-5p %m%n | ||
log4j.appender.stdout.Target=System.out | ||
|
||
# prices logger | ||
log4j.logger.prices=INFO, stdout |
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,23 @@ | ||
# Use the offical Gradle Docker image as builder | ||
FROM gradle:jdk17 AS builder | ||
|
||
# Set the working directory | ||
WORKDIR /app | ||
|
||
# Copy the project resources | ||
COPY src ./src | ||
COPY build.gradle . | ||
COPY gradlew . | ||
COPY settings.gradle . | ||
COPY gradle.properties . | ||
|
||
# Generate the jar file | ||
RUN gradle build | ||
|
||
# Use the official Eclipse Temuring image | ||
FROM eclipse-temurin:21-jdk | ||
|
||
# Copy the Producer jar from the previuos build stage | ||
COPY --from=builder /app/build/libs/quickstart-producer-all.jar /usr/app/producer.jar | ||
|
||
ENTRYPOINT ["java", "-jar", "/usr/app/producer.jar"] |
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,17 @@ | ||
# Producer for the Quick Start App | ||
|
||
This folder contains the Gradle project of the Kafka native producer used for the _Quick Start_ App. See the [Quick Start](../../README.md#quick-start-set-up-in-5-minutes) section for more details. | ||
|
||
To build the producer: | ||
|
||
```sh | ||
$ ./gradlew build | ||
``` | ||
|
||
which generates the `quickstart-producer-all.jar` file under the `build/libs` folder. | ||
|
||
To run it: | ||
|
||
```sh | ||
$ java -jar build/libs/quickstart-producer-all.jar --bootstrap-servers <kafka.connection.string> --topic stocks | ||
``` |
Binary file added
BIN
+1.5 KB
...ucer/bin/main/com/lightstreamer/kafka/examples/quick_start/producer/FeedSimulator$1.class
Binary file not shown.
Binary file added
BIN
+406 Bytes
...ightstreamer/kafka/examples/quick_start/producer/FeedSimulator$ExternalFeedListener.class
Binary file not shown.
Binary file added
BIN
+2.01 KB
.../bin/main/com/lightstreamer/kafka/examples/quick_start/producer/FeedSimulator$FIELD.class
Binary file not shown.
Binary file added
BIN
+3.56 KB
...n/com/lightstreamer/kafka/examples/quick_start/producer/FeedSimulator$QuoteProducer.class
Binary file not shown.
Binary file added
BIN
+7.47 KB
...oducer/bin/main/com/lightstreamer/kafka/examples/quick_start/producer/FeedSimulator.class
Binary file not shown.
Binary file added
BIN
+2.46 KB
.../producer/bin/main/com/lightstreamer/kafka/examples/quick_start/producer/Producer$1.class
Binary file not shown.
Binary file added
BIN
+5.08 KB
...mo/producer/bin/main/com/lightstreamer/kafka/examples/quick_start/producer/Producer.class
Binary file not shown.
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,26 @@ | ||
# Licensed to the Apache Software Foundation (ASF) under one or more | ||
# contributor license agreements. See the NOTICE file distributed with | ||
# this work for additional information regarding copyright ownership. | ||
# The ASF 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. | ||
|
||
log4j.rootLogger=WARN, stdout | ||
|
||
log4j.appender.stdout=org.apache.log4j.ConsoleAppender | ||
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout | ||
log4j.appender.stdout.layout.ConversionPattern=[%d] [%-10c{1}] %-5p %m%n | ||
log4j.appender.stdout.Target=System.out | ||
|
||
log4j.appender.stderr=org.apache.log4j.ConsoleAppender | ||
log4j.appender.stderr.layout=org.apache.log4j.PatternLayout | ||
log4j.appender.stderr.layout.ConversionPattern=[%d] [%t-%c] %p %m%n | ||
log4j.appender.stderr.Target=System.err |
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,73 @@ | ||
plugins { | ||
id 'java' | ||
id 'maven-publish' | ||
} | ||
|
||
repositories { | ||
mavenCentral() | ||
maven { | ||
url "https://packages.confluent.io/maven" | ||
} | ||
} | ||
|
||
dependencies { | ||
implementation group: 'info.picocli', name:'picocli', version:'4.7.5' | ||
|
||
implementation group: 'org.slf4j', name: 'slf4j-reload4j', 'version': '2.0.10' | ||
implementation group: 'org.apache.kafka', name:'kafka-clients', version:'7.7.0-ccs' | ||
implementation group: 'io.confluent', name: 'kafka-avro-serializer', version:'7.7.0' | ||
implementation group: 'io.confluent', name: 'kafka-json-serializer', version:'7.7.0' | ||
implementation group: 'io.confluent', name: 'kafka-json-schema-serializer', version:'7.7.0' | ||
} | ||
|
||
ext { | ||
appendix = 'all' | ||
} | ||
|
||
group = 'com.lightstreamer.kafka' | ||
version = '1.0.0' | ||
|
||
java { | ||
toolchain { | ||
languageVersion = JavaLanguageVersion.of(17) | ||
} | ||
} | ||
|
||
tasks.withType(JavaCompile) { | ||
options.encoding = 'UTF-8' | ||
} | ||
|
||
tasks.withType(Javadoc) { | ||
options.encoding = 'UTF-8' | ||
} | ||
|
||
jar { | ||
manifest { | ||
attributes 'Main-Class': "com.lightstreamer.kafka.examples.quick_start.producer.Producer" | ||
} | ||
archiveAppendix = appendix | ||
archiveVersion = '' | ||
|
||
duplicatesStrategy = DuplicatesStrategy.EXCLUDE | ||
from configurations.runtimeClasspath.collect { it.isDirectory() ? it : zipTree(it) } | ||
} | ||
|
||
publishing { | ||
repositories { | ||
maven { | ||
name = "GitHubPackages" | ||
url = uri("https://maven.pkg.github.com/lightstreamer/Lightstreamer-kafka-connector") | ||
credentials { | ||
username = project.findProperty("gpr.user") ?: System.getenv("USERNAME") | ||
password = project.findProperty("gpr.key") ?: System.getenv("TOKEN") | ||
} | ||
} | ||
} | ||
publications { | ||
gpr(MavenPublication) { | ||
artifactId project.name + '-' + appendix | ||
version = version | ||
artifact jar | ||
} | ||
} | ||
} |
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 @@ | ||
deployDirName=deploy |
Binary file not shown.
7 changes: 7 additions & 0 deletions
7
examples/kvp-demo/producer/gradle/wrapper/gradle-wrapper.properties
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,7 @@ | ||
distributionBase=GRADLE_USER_HOME | ||
distributionPath=wrapper/dists | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.10-bin.zip | ||
networkTimeout=10000 | ||
validateDistributionUrl=true | ||
zipStoreBase=GRADLE_USER_HOME | ||
zipStorePath=wrapper/dists |
Oops, something went wrong.