Giter VIP home page Giter VIP logo

fmodel-spring-demo's Introduction

fmodel-spring-demo (EventSourcing)

A demo/example project for the imaginary restaurant and order management. It is backing the Fmodel Reference Guide.

It demonstrates how to run our unique domain and orchestrate it in an EventSourced/EventDriven way.

For State-Stored flavor of the system, please

check https://github.com/fraktalio/fmodel-spring-state-stored-demo,

and notice:

  • how the domain package/model is the same / state-stored system and event-sourced system share the same domain logic
  • application and adapters are different / we only choose to compose and run them differentlly

event model image this blueprint is an outcome of the event-modeling process

Fmodel

This project is using Fmodel - Kotlin, multiplatform library.

Fmodel is:

  • enabling functional, algebraic and reactive domain modeling with Kotlin programming language.
  • inspired by DDD, EventSourcing and Functional programming communities, yet implements these ideas and concepts in idiomatic Kotlin, which in turn makes our code
    • less error-prone,
    • easier to understand,
    • easier to test,
    • type-safe and
    • thread-safe.
  • enabling illustrating requirements using examples
    • the requirements are presented as scenarios.
    • a scenario is an example of the system’s behavior from the users’ perspective,
    • and they are specified using the Given-When-Then structure to create a testable/runnable specification
      • Given < some precondition(s) / events >
      • When < an action/trigger occurs / commands>
      • Then < some post condition / events >

Check the tests!

with(orderDecider) {
    givenEvents(listOf(orderCreatedEvent)) {         // PRE CONDITIONS
        whenCommand(createOrderCommand)              // ACTION
    } thenEvents listOf(orderRejectedEvent)          // POST CONDITIONS
}

Fstore-SQL

This project is using PostgreSQL powered event store, optimized for event sourcing and event streaming.

Fstore-SQL is enabling event-sourcing and pool-based event-streaming patterns by using SQL (PostgreSQL) only.

  • event-sourcing data pattern (by using PostgreSQL database) to durably store events
    • Append events to the ordered, append-only log, using entity id/decider id as a key
    • Load all the events for a single entity/decider, in an ordered sequence, using the entity id/decider id as a key
    • Support optimistic locking/concurrency
  • event-streaming to concurrently coordinate read over a streams of events from multiple consumer instances
    • Support real-time concurrent consumers to project events into view/query models

Tools

  • EventModeling - a method of describing systems using an example of how information has changed within them over time.

Patterns

  • EventSourcing
  • CQRS

Prerequisites

Technology

Spring (Reactive Web,R2DBC, RSocket)

Run & Test

This project is using Gradle as a build and automation tool.

Test:

Make sure you have Docker installed and running, as we are running integration tests as well.

./gradlew check

Run:

Make sure you have PostgreSQL installed and running. Check the connection URL and username/password in application.properties

./gradlew bootRun

Run in Docker

Make sure you have Docker installed and running.

Build OCI (docker) image:

./gradlew bootBuildImage

Run application and PostgreSQL:

docker-compose up

Explore the REST API

Explore the REST API using the test.http file.

Further Reading


Created with ❤️ by Fraktalio

Excited to launch your next IT project with us? Let's get started! Reach out to our team at [email protected] to begin the journey to success.

fmodel-spring-demo's People

Contributors

idugalic avatar renovate[bot] avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

fmodel-spring-demo's Issues

Dependency Dashboard

This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.


Warning

Renovate failed to look up the following dependencies: Failed to look up docker package docker.io/library/fmodel-spring-demo.

Files affected: docker-compose.yml


Open

These updates have all been created already. Click a checkbox below to force a retry/rebase of any.

Detected dependencies

docker-compose
docker-compose.yml
  • docker.io/library/fmodel-spring-demo 0.0.1-SNAPSHOT
github-actions
.github/workflows/build.yml
  • actions/checkout v4@b4ffde65f46336ab88eb53be808477a3936bae11
  • actions/setup-java v4
  • gradle/gradle-build-action fe59895742b4f984530980e4f693943577526b61
gradle
gradle.properties
settings.gradle.kts
build.gradle.kts
  • org.springframework.boot 3.2.4
  • io.spring.dependency-management 1.1.4
  • org.jetbrains.kotlin.jvm 1.9.23
  • org.jetbrains.kotlin.plugin.spring 1.9.23
  • org.jetbrains.kotlin.plugin.serialization 1.9.23
  • com.fraktalio.fmodel:domain 3.5.1-SNAPSHOT
  • com.fraktalio.fmodel:application-vanilla 3.5.1-SNAPSHOT
  • com.fraktalio.fmodel:application-arrow 3.5.1-SNAPSHOT
  • org.jetbrains.kotlinx:kotlinx-serialization-json 1.6.3
  • org.jetbrains.kotlinx:kotlinx-collections-immutable-jvm 0.3.7
  • io.github.microutils:kotlin-logging-jvm 3.0.5
  • org.jetbrains.kotlinx:kotlinx-coroutines-test 1.8.0
  • org.testcontainers:testcontainers-bom 1.19.7
gradle-wrapper
gradle/wrapper/gradle-wrapper.properties
  • gradle 8.7

  • Check this box to trigger a request for Renovate to run again on this repository

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.