add some documentation
This commit is contained in:
44
README.md
44
README.md
@@ -1,5 +1,11 @@
|
|||||||
Event demo
|
Event demo
|
||||||
==========
|
==========
|
||||||
|
- [Installation](#installation)
|
||||||
|
- [What's in this demo](#whats-in-this-demo)
|
||||||
|
|
||||||
|
|
||||||
|
Installation
|
||||||
|
------------
|
||||||
|
|
||||||
To run the stack:
|
To run the stack:
|
||||||
|
|
||||||
@@ -8,7 +14,43 @@ docker compose -f docker\docker-compose.yaml -p event-demo up -d
|
|||||||
```
|
```
|
||||||
|
|
||||||
Admin service URL:
|
Admin service URL:
|
||||||
- [Traefik](http://pgadmin.traefik.me/)
|
- [Træfik](http://pgadmin.traefik.me/)
|
||||||
- [Redis](http://pgadmin.traefik.me/)
|
- [Redis](http://pgadmin.traefik.me/)
|
||||||
- [pgAdmin](http://pgadmin.traefik.me/)
|
- [pgAdmin](http://pgadmin.traefik.me/)
|
||||||
- [API](http://api.traefik.me/)
|
- [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
|
||||||
@@ -5,7 +5,6 @@ import io.ktor.websocket.Frame
|
|||||||
import io.ktor.websocket.readText
|
import io.ktor.websocket.readText
|
||||||
import kotlinx.coroutines.CoroutineScope
|
import kotlinx.coroutines.CoroutineScope
|
||||||
import kotlinx.coroutines.ExperimentalCoroutinesApi
|
import kotlinx.coroutines.ExperimentalCoroutinesApi
|
||||||
import kotlinx.coroutines.InternalCoroutinesApi
|
|
||||||
import kotlinx.coroutines.channels.Channel
|
import kotlinx.coroutines.channels.Channel
|
||||||
import kotlinx.coroutines.channels.ReceiveChannel
|
import kotlinx.coroutines.channels.ReceiveChannel
|
||||||
import kotlinx.coroutines.channels.SendChannel
|
import kotlinx.coroutines.channels.SendChannel
|
||||||
@@ -14,7 +13,10 @@ import kotlinx.coroutines.channels.produce
|
|||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
import kotlinx.serialization.json.Json
|
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 <reified T> CoroutineScope.toObjectChannel(
|
inline fun <reified T> CoroutineScope.toObjectChannel(
|
||||||
frames: ReceiveChannel<Frame>,
|
frames: ReceiveChannel<Frame>,
|
||||||
bufferSize: Int = 0,
|
bufferSize: Int = 0,
|
||||||
@@ -32,6 +34,9 @@ inline fun <reified T> CoroutineScope.toObjectChannel(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Convert a [SendChannel] of [Frame] to another [SendChannel] of [object][T]
|
||||||
|
*/
|
||||||
inline fun <reified T> CoroutineScope.fromFrameChannel(frames: SendChannel<Frame>): SendChannel<T> {
|
inline fun <reified T> CoroutineScope.fromFrameChannel(frames: SendChannel<Frame>): SendChannel<T> {
|
||||||
val channel = Channel<T>()
|
val channel = Channel<T>()
|
||||||
launch {
|
launch {
|
||||||
|
|||||||
Reference in New Issue
Block a user