Occurrent 0.7.4 is now available. It’s another small, but important, release.

Changelog:

  • Added better logging to SpringMongoSubscriptionModel, it’ll now include the subscription id if an error occurs.
  • If there’s not enough history available in the mongodb oplog to resume a subscription created from a SpringMongoSubscriptionModel, this subscription model now supports restarting the subscription from the current time automatically. This is only of concern when an application is restarted, and the subscriptions are configured to start from a position in the oplog that is no longer available. It’s disabled by default since it might not be 100% safe (meaning that you can miss some events when the subscription is restarted). It’s not 100% safe if you run subscriptions in a different process than the event store and you have lot’s of writes happening to the event store. It’s safe if you run the subscription in the same process as the writes to the event store if you make sure that the subscription is started before you accept writes to the event store on startup. To enable automatic restart, you can do like this:

    var subscriptionModel = new SpringMongoSubscriptionModel(mongoTemplate, SpringSubscriptionModelConfig.withConfig("events", TimeRepresentation.RFC_3339_STRING).restartSubscriptionsOnChangeStreamHistoryLost(true));
    

    An alternative approach to restarting automatically is to use a catch-up subscription and restart the subscription from an earlier date.

  • Better shutdown handling of all executor services used by subscription models.
  • Don’t log to error when a SpringMongoSubscriptionModel subscription is paused right after it was created, leading to a race condition. This is not an error. It’s now logged in “debug” mode instead.