Skip to content

mvlbarcelos/myeslib2

 
 

Repository files navigation

Build Status

Getting Started

This project is a work in progress so until any published release you may use https://jitpack.io

  1. Create a maven project for you first API then add this to your pom.xml. You may have myeslib-example-api as template. Mandatory dependency:
<dependency>
    <groupId>com.github.rodolfodpk</groupId>
    <artifactId>myeslib2.myeslib2-core</artifactId>
    <version>${myeslib2.version}</version>
</dependency>

On this project you will create your aggregate root and the respectives commands, events and command handlers. Try to minimize the dependencies here. The example uses:

Role implementation
logging sl4j
DI javax.inject
validation guava preconditions
fixjava lombok and autoValue (TODO decide about this)
  1. Then create another project for your API client. You may have myeslib-example-client as template. Mandatory dependencies: your api project and also:
<dependency>
    <groupId>com.github.rodolfodpk</groupId>
    <artifactId>myeslib2.myeslib2-stack1</artifactId>
    <version>${myeslib2.version}</version>
</dependency>

On this kind of project you will select your stack for things like JSON serialization, the target database and the dependency injection. For example, myeslib-example-client is using:

Role implementation
logging impl slf4j-simple
sql dao h2 in memory if using Stack1JdbiDao
json serializ gson (necessary only if using Stack1JdbiDao)
in memory dao guava's LinkedListMultimap if using Stack1MemDao
DI impl guice
crqs/es myeslib2-stack1

myeslib-stack1 is currently the only myeslib-core implementation. It has these dependencies:

Role implementation
logging sl4j
DI javax.inject
jdbc lib jdbi
local cache guava
eventbus guava

Testing

The example-client project has a Spock test for InventoryItem aggregate root. Please note this class is just an example, not a real world model. See: rodolfodpk#10

This test will exercise all features: your domain events will be persisted as JSON into your database of choice. Please note: the database must have a trigger to control concurrency in optimistic mode. If you want try Oracle instead of H2, you may use this trigger as template.

Here is the InventoryItemTest written in Spock

About

Another event sourcing experiment leveraging previous work on https://github.com/rodolfodpk/myeslib

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Java 97.1%
  • Groovy 2.9%