johanhaleby / occurrent

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

Add async support for subscriptions #153

Open johanhaleby opened 7 months ago

johanhaleby commented 7 months ago

It would be nice to be able to do e.g. like this:

subscriptions.subscribeAsync<MyEvent>("id") { ctx, e -> 
   Thread.ofVirtual().start {
        log.info("Async")
        ctx.ack()
    }
}

I.e. don't store position until ctx.ack() is called