From ccef7eae92f7f5c5ff3e0bdeb658daee7e7d85fc Mon Sep 17 00:00:00 2001 From: "Miroslav Chomut (CZ)" Date: Wed, 9 Oct 2024 15:07:40 +0200 Subject: [PATCH 1/3] #21 README extension --- README.md | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 514ef08..0a03794 100644 --- a/README.md +++ b/README.md @@ -51,4 +51,28 @@ Note: - use *WriteSync* instead, which calls *Flush* after each message ### Examples -Sample usage of the library can be observed in Examples module \ No newline at end of file +Sample usage of the library can be observed in Examples module + +Whole module showcases simple scenario how to use writer as well as reader. Each scenario is showcased in 3 different flavors. +- ManualResourceHandling + - User is expected to manually dispose of resource after using it +- CustomResourceHandling + - custom code encapsulating resource usage is used +- UsingsResourceHandling + - Usings paradigm is used, note, this requires scala version 3 + +Simply executing example module as is, demonstrates usage in following order: +- 0 part before the main method collects necessary requirements (message class, settings etc...) which user is expected to obtain from its application/config + - these are hard-coded value in this example, in real world use case, these would be sourced by the application utilizing this library +- 1 demonstration of using Writer by means of ManualResourceHandling + - writes two messages and closes resource manually +- 2 demonstration of using Writer by means of CustomResourceHandling + - writes two messages and exits block closing resource +- 3 demonstration of using Writer by means of UsinsResourceHandling - only for Scala3 + - writes two messages and exits Using block, thus closing resource +- 4 demonstration of using Reader by means of ManualResourceHandling + - prints each message available in the topic and finishes, closes resource manually +- 5 demonstration of using Reader by means of CustomResourceHandling + - prints each message available in the topic and finishes, exits block closing resource +- 6 demonstration of using Reader by means of UsinsResourceHandling - only for Scala3 + - prints each message available in the topic and finishes, exits Using block, thus closing resource From 481c9e7d96949b9548688d2876473bb4a0137934 Mon Sep 17 00:00:00 2001 From: "Miroslav Chomut (CZ)" Date: Wed, 9 Oct 2024 15:33:40 +0200 Subject: [PATCH 2/3] added sbt commands --- README.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/README.md b/README.md index 0a03794..8eb946f 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,7 @@ Adapter for communicating from Scala with Kafka via case classes +- [Running](#running) - [Architecture](#architecture) - [Models](#models) - [Reader](#reader) @@ -9,6 +10,15 @@ Adapter for communicating from Scala with Kafka via case classes - [Examples](#examples) +## Running +First, you need to have installed Java and sbt + +To run unit tests cross-scala versions on clean build, run: +`sbt +clean +test` + +To run examples, run: +`sbt "project examples" run` + ## Architecture Project consists of 4 separate modules From f0373c8a0e3242fb8087d39c1642a32296d03f79 Mon Sep 17 00:00:00 2001 From: "Miroslav Chomut (CZ)" Date: Thu, 10 Oct 2024 14:17:47 +0200 Subject: [PATCH 3/3] review takeaway --- README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 8eb946f..eb4ad54 100644 --- a/README.md +++ b/README.md @@ -18,6 +18,7 @@ To run unit tests cross-scala versions on clean build, run: To run examples, run: `sbt "project examples" run` +It might be worthwhile to change the main (examples module KafkaCase main class), to only run the part you are copy-pasting into your implementation so you can watch and debug that one ## Architecture @@ -65,11 +66,12 @@ Sample usage of the library can be observed in Examples module Whole module showcases simple scenario how to use writer as well as reader. Each scenario is showcased in 3 different flavors. - ManualResourceHandling - - User is expected to manually dispose of resource after using it + - User is expected to manually dispose of resource after using it - CustomResourceHandling - custom code encapsulating resource usage is used - UsingsResourceHandling - Usings paradigm is used, note, this requires scala version 3 + - Samples are in scala3 specific folder due to compiler reasons for scala 2 Simply executing example module as is, demonstrates usage in following order: - 0 part before the main method collects necessary requirements (message class, settings etc...) which user is expected to obtain from its application/config