Occurrent 0.19.13 is released:

  • Improvements to view-dsl (org.occurrent:view-dsl)
    1. The update method in org.occurrent.dsl.view.MaterializedView now takes a RetryStrategy so that updates can be retried
    2. Calling the kotlin extension function materialized on a org.occurrent.dsl.view.View now takes a org.occurrent.dsl.view.SpringMongoViewConfig that allows you to configure how to handle DuplicateKeyException and OptimisticLockingFailureException thrown by Spring Repositories or MongoOperations. By default, DuplicateKeyException is ignored and OptimisticLockingFailureException’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)
      
    3. 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.
  • 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