pjfanning opened a new pull request, #377: URL: https://github.com/apache/pekko-persistence-r2dbc/pull/377
copies https://github.com/akka/akka-persistence-r2dbc/pull/344 which is now available under Apache License, version 2.0 ## Changes ### New API (adapted from akka → pekko) - **`AdditionalColumn[A, B]`** (scaladsl + javadsl) – extract fields from durable state values and store them in additional database columns (for secondary indexes) - **`ChangeHandler[A]`** (scaladsl + javadsl) – run additional processing in the same transaction as a durable state upsert or delete - **`ChangeHandlerException`** – thrown when a change handler fails - **`R2dbcSession`** (scaladsl + javadsl) – gives change handlers access to the current connection/transaction ### New internal utilities - **`AdditionalColumnFactory`** – instantiates `AdditionalColumn` implementations (scaladsl or javadsl) via Pekko's dynamic access - **`ChangeHandlerFactory`** – instantiates `ChangeHandler` implementations (scaladsl or javadsl) via Pekko's dynamic access ### Modified - **`StateSettings`** – added `additional-columns`, `custom-table`, and `change-handler` config keys; added `getDurableStateTableWithSchema(entityType)` method - **`DurableStateDao`** – `upsertState` now accepts the raw value (for change handlers / additional columns); `deleteStateForRevision` renamed to `deleteState` and now invokes change handlers in the same transaction; SQL methods are now per-entity-type (supports custom tables); `persistenceIds(afterId, limit)` queries all configured tables - **`R2dbcDurableStateStore`** – passes value to `upsertState`; `currentPersistenceIds()` iterates over default + custom tables sequentially - **`DurableStateCleanup`** – updated to call the renamed `deleteState` method - **`reference.conf`** – added `additional-columns`, `custom-table`, `change-handler` config blocks under `pekko.persistence.r2dbc.state` ### Tests - `DurableStateStoreAdditionalColumnSpec` – tests BindValue, BindNull, Skip with scala and javadsl columns in a custom table - `DurableStateStoreChangeHandlerSpec` – tests insert, update, delete change handlers and transaction rollback on failure, for both scala and javadsl - `CurrentPersistenceIdsQuerySpec` – extended with custom table persistence-id query tests - `JavadslChangeHandler.java` / `JavadslColumn.java` – Java test helpers -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
