Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ A very basic HTTP server is included in the SDK that can be used to return a hea

Service myServer = new SimpleRestServer.Builder()
.setListener("/health", () -> this.isHealthy())
.setListener("/metrics", () -> this.scrapeMetrics())
.setListener("/metrics", () -> this.scrapeMetrics());

myServer.start();
```
Expand All @@ -180,7 +180,7 @@ A very basic HTTP server is included in the SDK that can be used to return a hea

To initialize the SDK
```java
Sdk sdk = new Sdk.Builder().autoDetect().build()
Sdk sdk = new Sdk.Builder().autoDetect().build();
```
> This will automatically detect if the SDK needs to be initialized from 'scratch' trough environment variables given by the DSH to the container,
>or if it can be initialized from an existing configuration file that exists on the nodes
Expand All @@ -190,11 +190,11 @@ Sdk sdk = new Sdk.Builder().autoDetect().build()
from here on the `sdk` object can be used to initialize the parsers
1) to access Kafka specific configuration:
```java
KafkaConfigParser kp = KafkaConfigParser.of(sdk)
KafkaConfigParser kp = KafkaConfigParser.of(sdk);
```
2) to access stream specific config:
```java
StreamsConfigParser sp = StreamsConfigParser.of(sdk)
StreamsConfigParser sp = StreamsConfigParser.of(sdk);
```

### Standalone App
Expand All @@ -205,15 +205,15 @@ The example blow describes a simple skeleton for an application on the DSH
Sdk sdk = new Sdk.Builder().autoDetect().build();
KafkaConfigParser kafkaParser = KafkaConfigParser.of(sdk);
StreamsConfigParser streamsParser = StreamsConfigParser.of(sdk);
KafkaClientFactory clientFactory = new KafkaClientFactory(streamsParser, kafkaParser);
KafkaClientFactory clientFactory = KafkaClientFactory.of(streamsParser, kafkaParser);


// create a new kafka producer
KafkaProducer[KeyEnvelope, DataEnvelope] producer = clientFactory.createStreamProducer(null);
KafkaProducer<Envelope.KeyEnvelope, Envelope.DataEnvelope> producer = clientFactory.createStreamProducer(null);

// create a new kafka consumer
// that will be part of the same consumergroup as other instances of this application will be.
KafkaConsumer[KeyEnvelope, DataEnvelope] consumer = clientFactory.createSharedStreamConsumer(null);
KafkaConsumer<Envelope.KeyEnvelope, Envelope.DataEnvelope> consumer = clientFactory.createSharedStreamConsumer(null);

List<DataStream> myStreams = ... // streams to consume the data from
consumer.subscribe(subscriptionPatternFor(myStreams));
Expand Down
16 changes: 7 additions & 9 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,11 @@
</scm>
<properties>
<os-maven-plugin.version>1.6.2</os-maven-plugin.version>
<protobuf.version>3.21.12</protobuf.version>
<org.slf4j.version>2.0.1</org.slf4j.version>
<protobuf.version>4.35.1</protobuf.version>
<org.slf4j.version>2.0.18</org.slf4j.version>
<logback.version>1.4.12</logback.version>
<org.bouncycastle.version>1.78.1</org.bouncycastle.version>
<kafka.version>3.2.3</kafka.version>
<org.bouncycastle.version>1.84</org.bouncycastle.version>
<kafka.version>4.3.1</kafka.version>
<!-- plugins-->
<maven-compiler-plugin.version>3.8.1</maven-compiler-plugin.version>
<maven-surefire-plugin.version>2.22.2</maven-surefire-plugin.version>
Expand All @@ -40,10 +40,10 @@
<protobuf-maven-plugin.version>0.6.1</protobuf-maven-plugin.version>
<nexus-staging-maven-plugin.version>1.6.7</nexus-staging-maven-plugin.version>
<maven-assembly-plugin.version>3.2.0</maven-assembly-plugin.version>
<maven-javadoc-plugin.version>3.1.1</maven-javadoc-plugin.version>
<maven-javadoc-plugin.version>3.12.0</maven-javadoc-plugin.version>
<maven-jar-plugin.version>3.2.0</maven-jar-plugin.version>
<maven-source-plugin.version>2.3</maven-source-plugin.version>
<jacoco-maven-plugin.version>0.8.5</jacoco-maven-plugin.version>
<jacoco-maven-plugin.version>0.8.15</jacoco-maven-plugin.version>
<junit-jupiter.version>5.9.0</junit-jupiter.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
Expand Down Expand Up @@ -185,10 +185,8 @@
<artifactId>maven-compiler-plugin</artifactId>
<version>${maven-compiler-plugin.version}</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
<release>11</release>
<encoding>utf-8</encoding>
<compilerVersion>1.8</compilerVersion>
<compilerArgument>-Xlint:all</compilerArgument>
<showWarnings>true</showWarnings>
<showDeprecation>true</showDeprecation>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import dsh.messages.Envelope;
import dsh.sdk.streams.StreamsConfigParser;
import org.apache.kafka.clients.producer.Partitioner;
import org.apache.kafka.clients.producer.internals.DefaultPartitioner;
import org.apache.kafka.clients.producer.RoundRobinPartitioner;
import org.apache.kafka.common.Cluster;

import java.util.Map;
Expand All @@ -14,7 +14,7 @@
public class DynamicStreamPartitioner implements Partitioner {

private DshStreamPartitioner underlying;
private final Partitioner defaultPartitioner = new DefaultPartitioner();
private final Partitioner defaultPartitioner = new RoundRobinPartitioner();
public static final String CONFIG_KEY = "__dynamicstreampartitioner";

/**
Expand Down
4 changes: 2 additions & 2 deletions src/test/java/PartitionerTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import dsh.sdk.streams.StreamsConfigParser;
import mocks.MockKafka;
import org.apache.kafka.clients.producer.Partitioner;
import org.apache.kafka.clients.producer.internals.DefaultPartitioner;
import org.apache.kafka.clients.producer.RoundRobinPartitioner;
import org.apache.kafka.common.Cluster;
import org.apache.kafka.common.utils.Utils;
import org.junit.jupiter.api.Tag;
Expand All @@ -24,7 +24,7 @@
public class PartitionerTest {

private Partitioner dynamicPartitioner = new DynamicStreamPartitioner();
private Partitioner defaultPartitioner = new DefaultPartitioner();
private Partitioner defaultPartitioner = new RoundRobinPartitioner();
private Cluster mockCluster = MockKafka.clusterFor("stream.my-topic", 24);

@Test
Expand Down
Loading