johanhaleby / occurrent

Unintrusive Event Sourcing Library for the JVM
https://occurrent.org
120 stars 16 forks source link

Duplicate event exception when using command composition on sequences #132

Closed chrisdginn closed 1 year ago

chrisdginn commented 1 year ago

The composeCommands function for Sequence doesn't drop the initial list events which causes a duplicate exception when working on an existing stream.

chrisdginn commented 1 year ago

I have added #131 with test cases and fix.

johanhaleby commented 1 year ago

Thanks a lot!! And thanks for your interest in occurrent :) I'd love to get feedback and thoughts.

chrisdginn commented 1 year ago

Having written a very similar implementation a few years ago, I really like your more functional approach to the problem. Using it in a project at work. Right now I'm doing some wrapping work with Arrow to add even more functional goodness to it.

Thanks for the great project!

chrisdginn commented 1 year ago

On another note, any idea when you might cut a new release with this patch? :-D

johanhaleby commented 1 year ago

@chrisdginn I've made a new release (0.16.1) now :)

Let me know if you have any comments or suggestions. I'm currently thinking about adding support for snapshots and/or "closing the books". I've also started thinking about saga/process manager support. And I'm working on a new experimental library called "Hederlig" (that is designed to potentially work with other frameworks/libraries as well). I would be happy if you would check it out: https://github.com/johanhaleby/occurrent/blob/master/library/hederlig/src/test/kotlin/org/occurrent/library/hederlig/HederligOccurrentTest.kt. It's very early atm, but I in high-level you define modules (that should be composeable) that includes features that defines your commands, queries, etc in one place.