Giter Site home page Giter Site logo

daggerok / webflux-cqrs-es Goto Github PK

View Code? Open in Web Editor NEW
2.0 3.0 0.0 71 KB

Implementing eventsourcing using JPA as event store. JPA JSON conversion. Spring Boot. Gradle Kotlin DSL. H2 tcp database, etc...

Kotlin 30.20% Java 69.80%
eventsourcing jpa json spring-data-jpa inheritance auditing audition h2-database h2-console h2-gradle-run

webflux-cqrs-es's Introduction

webflux-cqrs-es

Yep. It's in progress. Also.

run h2 database

./gradlew h2
`

## run applicatoin

```bash
./gradlew bootRun

login into h2

  • open http://127.0.0.1:8082/
  • select h2 server
  • login:
    • into jdbc:h2:tcp://127.0.0.1:9092/~/test
    • as su user
    • without password

add some events

http :8080/inheritance value1=ololo value2=trololo
HTTP/1.1 200 OK
Content-Length: 138
Content-Type: application/json;charset=UTF-8
# output:
{
    "createdDate": "2019-03-06T02:56:6",
    "data": {
        "value1": "ololo",
        "value2": "trololo"
    },
    "id": 1,
    "modifiedDate": "2019-03-06T02:56:719",
    "version": 0
}

update to test if @Version is working

http :8080/inheritance/1 value1=ololo value2='trololo11111oneoneone'
HTTP/1.1 200 OK
Content-Length: 152
Content-Type: application/json;charset=UTF-8
# output:
{
    "createdDate": "2019-03-06T02:56:6",
    "data": {
        "value1": "ololo",
        "value2": "trololo11111oneoneone"
    },
    "id": 1,
    "modifiedDate": "2019-03-06T02:57:219",
    "version": 1
}

create inherit domain events

echo '{
  "dataFieldOfEvent1": "ololo trololo!",
  "data": {
    "val1": "hello!",
    "val2": "hola!",
    "val3": "привед!"
  }
}' | http :8080/event1
HTTP/1.1 200 OK
content-length: 0
http :8080/event3 field1=one field2=two field3=three data:='{"val1":"test!"}'
HTTP/1.1 200 OK
content-length: 0

now let's look what we have....

http :8080/events
HTTP/1.1 200 OK
Content-Length: 809
Content-Type: application/json;charset=UTF-8
# output:
{
    "domainEvents": [
        {
            "createdDate": "2019-03-06T03:05:18",
            "data": {
                "val1": "hello!",
                "val2": "hola!",
                "val3": "привед!"
            },
            "dataFieldOfEvent1": "ololo trololo!",
            "id": "7218b483-aa67-4e64-8b03-d3b483c8e7b7",
            "modifiedDate": "2019-03-06T03:05:792"
        },
        {
            "createdDate": "2019-03-06T03:05:25",
            "data": {
                "val1": "test!",
                "val2": "default val 2",
                "val3": "and 3..."
            },
            "field1": "one",
            "field2": "two",
            "field3": "three",
            "id": "68bc2d3b-50be-490a-a70b-5166153a4c8e",
            "modifiedDate": "2019-03-06T03:05:447"
        }
    ],
    "events1": [
        {
            "createdDate": "2019-03-06T03:05:18",
            "data": {
                "val1": "hello!",
                "val2": "hola!",
                "val3": "привед!"
            },
            "dataFieldOfEvent1": "ololo trololo!",
            "id": "7218b483-aa67-4e64-8b03-d3b483c8e7b7",
            "modifiedDate": "2019-03-06T03:05:792"
        }
    ],
    "events2": [],
    "events3": [
        {
            "createdDate": "2019-03-06T03:05:25",
            "data": {
                "val1": "test!",
                "val2": "default val 2",
                "val3": "and 3..."
            },
            "field1": "one",
            "field2": "two",
            "field3": "three",
            "id": "68bc2d3b-50be-490a-a70b-5166153a4c8e",
            "modifiedDate": "2019-03-06T03:05:447"
        }
    ]
}

webflux-cqrs-es's People

Contributors

daggerok avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar

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.