Skip to content

v3.3.0

Compare
Choose a tag to compare
@idugalic idugalic released this 30 Dec 11:29
· 320 commits to main since this release

Version 3.3.0 is a reactive and a multiplatform version of fmodel libraries optimized for Event sourcing, CQRS, and Domain Modeling.

Maven coordinates

 <dependency>
    <groupId>com.fraktalio.fmodel</groupId>
    <artifactId>domain</artifactId>
    <version>3.3.0</version>
 </dependency>

 <dependency>
    <groupId>com.fraktalio.fmodel</groupId>
    <artifactId>application-vanilla</artifactId>
    <version>3.3.0</version>
 </dependency>
 
 <dependency>
    <groupId>com.fraktalio.fmodel</groupId>
    <artifactId>application-arrow</artifactId>
    <version>3.3.0</version>
 </dependency>

A convenient DSL (builder) for the domain components:

For example:

fun evenNumberDecider(): Decider<EvenNumberCommand?, EvenNumberState, EvenNumberEvent?> =
    decider {
        initialState {
            evenNumberState {
                descriptionString { "Initial state" }
                valueInt { 0 }
            }
        }
        decide { c, s ->
            when (c) {
                is AddEvenNumber -> flowOf(
                    evenNumberAdded {
                        description { c.description }
                        value { s.value + c.value }
                    }
                )

                is SubtractEvenNumber -> flowOf(
                    evenNumberSubtracted {
                        description { c.description }
                        value { s.value - c.value }
                    }
                )

                null -> emptyFlow()
            }
        }
        evolve { s, e ->
            when (e) {
                is EvenNumberAdded ->
                    evenNumberState {
                        description { s.description + e.description }
                        value { e.value }
                    }

                is EvenNumberSubtracted ->
                    evenNumberState {
                        description { s.description - e.description }
                        value { e.value }
                    }

                null -> s
            }
        }
    }

Minimizing the API

  • _Decider<C, Si, So, Ei, Eo> is internal now
  • _View<Si, So, E> is internal now

There was no true usage of this API, so we have chosen to make it internal, in favor of Decider<C, S, E> and View<S, E>.
Previously, Decider was just a type alias of _Decider, but these are different types actually and we want to promote that.

We hope to minimize the complexity of the API and make the right thing to do the easy thing to do.

What's Changed

Full Changelog: v3.2.0...v3.3.0