Durable state store plugin

The durable state plugin enables storing and loading key-value entries for durable state actors.

Schema

The durable_state table and durable_state_slice_idx index need to be created in the configured database, see schema definition in Creating the schema.

The durable_state_slice_idx index is only needed if the slice based queries are used.

Configuration

To enable the journal plugin to be used by default, add the following line to your Pekko application.conf:

pekko.persistence.state.plugin = "pekko.persistence.r2dbc.state"

It can also be enabled with the durableStateStorePluginId for a specific DurableStateBehavior and multiple plugin configurations are supported.

See also Connection configuration.

Reference configuration

The following can be overridden in your application.conf for the journal specific settings:

sourcepekko.persistence.r2dbc {
  # Durable state store
  state {
    class = "org.apache.pekko.persistence.r2dbc.state.R2dbcDurableStateStoreProvider"

    table = "durable_state"

    # When this is enabled the updates verifies that the revision is +1 of
    # previous revision. There might be a small performance gain if
    # this is disabled.
    assert-single-writer = on
  }
}

Deletes

The journal supports deletes through hard deletes, which means the durable state store entries are actually deleted from the database. There is no materialized view with a copy of the state so make sure to not delete durable states too early if they are used from projections or queries.