Skip to content

Commit

Permalink
Improve README with gif animations (#93)
Browse files Browse the repository at this point in the history
* Add introduction sentence to present the library

* Add gifs and fill getting started section

* Enrich documentation with pom dependencies

* Add introduction sentence to present the library

* Add gifs and fill getting started section

* Enrich documentation with pom dependencies

* Update gifs accordingly to the last kstreamplify version 1.0.0

* PR review

* Gif update

* Add new gif for java code

* Bump crazy-max/ghaction-import-gpg from 5 to 6 (#95)

Bumps [crazy-max/ghaction-import-gpg](https://github.com/crazy-max/ghaction-import-gpg) from 5 to 6.
- [Release notes](https://github.com/crazy-max/ghaction-import-gpg/releases)
- [Commits](crazy-max/ghaction-import-gpg@v5...v6)

---
updated-dependencies:
- dependency-name: crazy-max/ghaction-import-gpg
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Bump mikepenz/action-junit-report from 3 to 4 (#94)

Bumps [mikepenz/action-junit-report](https://github.com/mikepenz/action-junit-report) from 3 to 4.
- [Release notes](https://github.com/mikepenz/action-junit-report/releases)
- [Commits](mikepenz/action-junit-report@v3...v4)

---
updated-dependencies:
- dependency-name: mikepenz/action-junit-report
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Improve javadoc (#36) (#68)

* improve javadoc (#36)

* fix MR

---------

Co-authored-by: Sebastien Viale <[email protected]>

* Add documentation for interactive queries (#91)

* Add documentation for interactive queries

* Update interactive queries documentation

* Add Check Style (#92)

* Add Check Style

* Fix code smells

* Switch check style and build steps

* Fix lint

* Bump org.apache.maven.plugins:maven-javadoc-plugin from 3.5.0 to 3.6.0 (#96)

Bumps [org.apache.maven.plugins:maven-javadoc-plugin](https://github.com/apache/maven-javadoc-plugin) from 3.5.0 to 3.6.0.
- [Release notes](https://github.com/apache/maven-javadoc-plugin/releases)
- [Commits](apache/maven-javadoc-plugin@maven-javadoc-plugin-3.5.0...maven-javadoc-plugin-3.6.0)

---
updated-dependencies:
- dependency-name: org.apache.maven.plugins:maven-javadoc-plugin
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Add unit tests coverage (#62)

* add TU

* fix conflicts

* add TU

* add TU

* remove code smells

* remove code smells

* remove code smells

* remove code smells

* Update unit tests

* Fix lint

* Add tests for kafka Streams initializer

---------

Co-authored-by: Loïc Greffier <[email protected]>

* Move gifs to readme folder

* Add gifs and fill getting started section

* Add new gif for java code

* Move gifs to readme folder

* Remove conflicted tests

---------

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: FP17000 <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Sebastien Viale <[email protected]>
Co-authored-by: Sebastien Viale <[email protected]>
Co-authored-by: Loïc GREFFIER <[email protected]>
Co-authored-by: adriencalime <[email protected]>
  • Loading branch information
7 people authored Sep 26, 2023
1 parent ff82273 commit 5b10086
Show file tree
Hide file tree
Showing 8 changed files with 27 additions and 86 deletions.
Binary file added .readme/gif/dlq.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added .readme/gif/full-topology.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added .readme/gif/on-start.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added .readme/gif/serdes.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added .readme/gif/test.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added .readme/gif/topology-bean.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added .readme/gif/topology.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
113 changes: 27 additions & 86 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,15 @@
[![SonarCloud Coverage](https://img.shields.io/sonar/coverage/michelin_kstreamplify?logo=sonarcloud&server=https%3A%2F%2Fsonarcloud.io&style=for-the-badge)](https://sonarcloud.io/component_measures?id=michelin_kstreamplify&metric=coverage&view=list)
[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg?logo=apache&style=for-the-badge)](https://opensource.org/licenses/Apache-2.0)

Kstreamplify is a Java library that brings new features on top of Kafka Streams.
Are you looking to enhance your development experience and accelerate the implementation of Kafka Streams? Look no further – Kstreamplify is tailor-made for you!

**Kstreamplify** is a Java library that empowers you to swiftly create Kafka Streams-based applications, offering a host of additional advanced features.

With Kstreamplify, you can declare your KafkaStreams class and define your topology with minimal effort. Here's all you need to do:

<p align="center">
<img src=".readme/gif/topology.gif" />
</p>

## Table of Contents

Expand Down Expand Up @@ -43,7 +51,7 @@ Kstreamplify is a Java library that brings new features on top of Kafka Streams.

Kstreamplify provides three dependencies.

### Java SE
### Java

These dependencies are compatible with Java Standard Edition (SE).

Expand All @@ -62,6 +70,7 @@ These dependencies are compatible with Java Standard Edition (SE).
</dependency>
```


### Spring Boot

If you are using Spring Boot, you can use the following dependency to integrate Kstreamplify with your Spring Boot application:
Expand All @@ -72,34 +81,29 @@ If you are using Spring Boot, you can use the following dependency to integrate
<artifactId>kstreamplify-spring-boot</artifactId>
<version>${kstreamplify.version}</version>
</dependency>

<dependency>
<groupId>com.michelin</groupId>
<artifactId>kstreamplify-core-test</artifactId>
<version>${kstreamplify.version}</version>
<scope>test</scope>
</dependency>
```

The dependency is compatible with Spring Boot 3.


## Getting Started

To begin using Kstreamplify, you simply need to set up a `KafkaStreamsStarter` bean within you Spring Boot context, overriding the `topology` method.
To begin using Kstreamplify, you simply need to set up a `KafkaStreamsStarter` bean within you Spring Boot context, overriding the `topology` method.

For instance, you can start by creating a class annotated with `@Component`:

```java
@Component
public class MyKafkaStreams extends KafkaStreamsStarter {
@Override
public void topology(StreamsBuilder streamsBuilder) {
// Your topology here
}
}
```
![](.readme/gif/topology.gif "Topology gif")

Alternatively, you can annotate a method that returns a `KafkaStreamsStarter` with `@Bean`:

```java
@Bean
public KafkaStreamsStarter kafkaStreamsStarter() {
return streamsBuilder -> streamsBuilder.map(...).to(...); // Your topology here
}
```
![](.readme/gif/topology-bean.gif "Topology bean gif")

### Properties Injection

Expand Down Expand Up @@ -136,34 +140,15 @@ SerdesUtils.<MyAvroValue>getSerdesForKey()

Here's an example of using these methods in your topology:

```java
@Override
public void topology(StreamsBuilder streamsBuilder) {
streamsBuilder
.stream("inputTopic", Consumed.with(Serdes.String(), SerdesUtils.<MyAvroValue>getSerdesForValue()))
// ...
.to("outputTopic", Produced.with(Serdes.String(), SerdesUtils.<MyAvroValue>getSerdesForValue()));
}
```
![](.readme/gif/serdes.gif "Serdes gif")

### Error Handling

The library provides the ability to handle errors that may occur in your topology as well as during the production or deserialization of records and route them to a dead-letter queue (DLQ) topic.

To do this, the first step is to override the `dlqTopic` method and return the name of your DLQ topic:

```java
@Component
public class MyKafkaStreams extends KafkaStreamsStarter {
@Override
public void topology(StreamsBuilder streamsBuilder) { //... }
@Override
public String dlqTopic() {
return "myDlqTopic";
}
}
```
![](.readme/gif/dlq.gif "DLQ topic gif")

#### Topology

Expand All @@ -173,36 +158,7 @@ The principle is simple: whenever you perform transformations on stream values,

Here is a complete example of how to do this:

```java
@Component
public class MyKafkaStreams extends KafkaStreamsStarter {
@Override
public void topology(StreamsBuilder streamsBuilder) {
KStream<String, MyAvroValue> myStream = streamsBuilder
.stream("inputTopic",
Consumed.with(Serdes.String(), SerdesUtils.<MyAvroValue>getSerdesForValue()));
TopologyErrorHandler
.catchErrors(myStream.mapValues(MyKafkaStreams::toUpperCase))
.to("outputTopic",
Produced.with(Serdes.String(), SerdesUtils.<MyAvroValue>getSerdesForValue()));
}
@Override
public String dlqTopic() {
return "myDlqTopic";
}
private static ProcessingResult<MyAvroValue, MyAvroValue> toUpperCase(MyAvroValue value) {
try {
value.setValue(value.getValue().toUpperCase());
return ProcessingResult.success(value);
} catch (Exception ex) {
return ProcessingResult.fail(ex, value, "An error occurred during the upper case map values process");
}
}
}
```
![](.readme/gif/full-topology.gif "Full topology example gif")

The first step is during the map values processing. The operation should return a new value of type `ProcessingResult<V, V2>`.
The first templatized parameter is the type of the new value after a successful transformation.
Expand Down Expand Up @@ -263,15 +219,7 @@ Kstreamplify offers the flexibility to execute custom code through hooks. These

The `On Start` hook allows you to execute code right after the Kafka Streams instantiation. It provides the Kafka Streams instance as a parameter.

```java
@Component
public class MyKafkaStreams extends KafkaStreamsStarter {
@Override
public void onStart(KafkaStreams kafkaStreams) {
// Your code here
}
}
```
![](.readme/gif/on-start.gif)

You can use this hook to perform any custom initialization or setup tasks for your Kafka Streams application.

Expand Down Expand Up @@ -316,14 +264,7 @@ For testing, you can create a test class that implements `KafkaStreamsStarterTes

Here is an example:

```java
public class MyKafkaStreamsTest extends KafkaStreamsStarterTest {
@Override
public void topology(StreamsBuilder streamsBuilder) {
new MyKafkaStreams().topology(streamsBuilder);
}
}
```
![](.readme/gif/test.gif "Test class gif")

## Motivation

Expand Down

0 comments on commit 5b10086

Please sign in to comment.