From 6ec45fc9dbb4eed8e6d7c66dd84ea2c93fd48ebc Mon Sep 17 00:00:00 2001 From: Fabrice Lecomte Date: Thu, 27 Mar 2025 11:58:43 +0100 Subject: [PATCH] add some documentation --- README.md | 46 ++++++++++++++++++- .../eventDemo/libs/FrameChannelConverter.kt | 9 +++- 2 files changed, 51 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index d360b12..8bd9016 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,11 @@ Event demo ========== +- [Installation](#installation) +- [What's in this demo](#whats-in-this-demo) + + +Installation +------------ To run the stack: @@ -8,7 +14,43 @@ docker compose -f docker\docker-compose.yaml -p event-demo up -d ``` Admin service URL: - - [Traefik](http://pgadmin.traefik.me/) + - [Træfik](http://pgadmin.traefik.me/) - [Redis](http://pgadmin.traefik.me/) - [pgAdmin](http://pgadmin.traefik.me/) - - [API](http://api.traefik.me/) \ No newline at end of file + - [API](http://api.traefik.me/) + +What's in this demo +------------------- + +- The **event sourcing** pattern. +- The **event driven** pattern. +- The **CQRS** pattern with **command** and **query**. +- A fully **asynchronous** architecture.Concurently process. +- A **pure Kotlin** implementation of **readmodel**/**projection**. +- A **Redis** implementation of **readmodel**/**projection**. +- A **pure Kotlin** implementation of **Event Store**. +- A **Postgresql** implementation of **Event Store**. +- A **pure Kotlin** implementation of **Event Bus**. +- A **RabbitMQ** implementation of **Event Bus**. +- A **Hexagonal** architecture. +- Use of **Web Sockets**. +- Use of the classic **Rest** route. +- Simple usage of the **JWT**. +- The **Ktor** framework. +- The **Koin** Dependency Injection framework +- Concurrently process. +- Use of coroutines. +- Using **docker compose** for the stack with **traefik**. +- Use of **flyway** to migrate the postgresql schema. + +The stack +--------- + +- Kotlin +- Ktor +- Postgresql +- Redis +- RabbitMQ +- Docker +- Træfik +- Flyway \ No newline at end of file diff --git a/src/main/kotlin/eventDemo/libs/FrameChannelConverter.kt b/src/main/kotlin/eventDemo/libs/FrameChannelConverter.kt index 16f3f65..e51fd3d 100644 --- a/src/main/kotlin/eventDemo/libs/FrameChannelConverter.kt +++ b/src/main/kotlin/eventDemo/libs/FrameChannelConverter.kt @@ -5,7 +5,6 @@ import io.ktor.websocket.Frame import io.ktor.websocket.readText import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.ExperimentalCoroutinesApi -import kotlinx.coroutines.InternalCoroutinesApi import kotlinx.coroutines.channels.Channel import kotlinx.coroutines.channels.ReceiveChannel import kotlinx.coroutines.channels.SendChannel @@ -14,7 +13,10 @@ import kotlinx.coroutines.channels.produce import kotlinx.coroutines.launch import kotlinx.serialization.json.Json -@OptIn(ExperimentalCoroutinesApi::class, InternalCoroutinesApi::class) +/** + * Convert a [ReceiveChannel] of [Frame] to another [ReceiveChannel] of [object][T] + */ +@OptIn(ExperimentalCoroutinesApi::class) inline fun CoroutineScope.toObjectChannel( frames: ReceiveChannel, bufferSize: Int = 0, @@ -32,6 +34,9 @@ inline fun CoroutineScope.toObjectChannel( } } +/** + * Convert a [SendChannel] of [Frame] to another [SendChannel] of [object][T] + */ inline fun CoroutineScope.fromFrameChannel(frames: SendChannel): SendChannel { val channel = Channel() launch {