Occurrent 0.19.13 is released:
- Improvements to view-dsl (
org.occurrent:view-dsl
)- The
update
method inorg.occurrent.dsl.view.MaterializedView
now takes aRetryStrategy
so that updates can be retried - Calling the kotlin extension function
materialized
on aorg.occurrent.dsl.view.View
now takes aorg.occurrent.dsl.view.SpringMongoViewConfig
that allows you to configure how to handleDuplicateKeyException
andOptimisticLockingFailureException
thrown by Spring Repositories orMongoOperations
. By default,DuplicateKeyException
is ignored andOptimisticLockingFailureException
’s are retried with exponential backoff between 100 ms to 5s. This can be configured, for example:@Document(collection = "name-state") @TypeAlias("NameState") data class NameState(@Id val userId: String, val name: String, @Version val version: Long? = null) val mongoOperations = .. val nameView = view<NameState?, DomainEvent>(null) { s, e -> when (e) { is NameDefined -> NameState(e.userId(), e.name) is NameWasChanged -> s!!.copy(name = e.name) } } val config = SpringMongoViewConfig.config(duplicateKeyHandling = ignore(), optimisticLockingHandling = rethrow()) val materializedNameView = nameView.materialized(mongoOperations, config, DomainEvent::userId) // Now you can do this to update the view in the MongoDB database from an event val e = NameChangedEvent(..) materializedNameView.update(e)
- Several new overloaded evolve methods to make it easier to evolve the view from multiple events and not just one. Also, new kotlin extension functions for this defined in
org.occurrent.dsl.view.ViewExtensions.kt
.
- The
- Replaced recursive retry logic with iterative loop in the
retry
module - Migrated from jetbrains annotations to jspecify and introduce jspecify to almost all modules and API’s (and fixed some bugs detected while introducing JSpecify)
- Upgraded spring-boot from 3.4.2 to 3.5.6
- Upgraded spring-data-mongodb from 4.4.2 to 4.4.3
- Upgraded mongodb-driver-sync from 5.3.1 to 5.6.1
- Upgraded jobrunr from 7.4.0 to 8.1.0
- Upgraded kotlin from 2.1.10 to 2.2.20
- Upgraded project reactor from 2024.0.3 to 2024.0.10
- Upgraded jackson from 2.18.2 to 2.19.2