You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@pekko.apache.org by "He-Pin (via GitHub)" <gi...@apache.org> on 2026/06/30 06:55:49 UTC
[PR] docs: how to write a custom Durable State store plugin [pekko]
He-Pin opened a new pull request, #3274:
URL: https://github.com/apache/pekko/pull/3274
### Motivation
Pekko Persistence supports pluggable Durable State storage backends, but there was no documentation explaining how to implement one. Plugin authors had to read the source to discover the `DurableStateUpdateStore` and `DurableStateStoreProvider` SPI.
### Modification
Add a "Building a storage backend for Durable State" paradox page with Scala and Java examples (plugin API, provider, and minimal activation configuration), backed by a runnable doc spec. Also fix a stale scaladoc on `DurableStateStoreProvider.scaladslDurableStateStore` that referred to `ReadJournal` instead of `DurableStateStore`.
New files:
- `docs/src/main/paradox/durable-state/state-store-plugin.md` (+ index link)
- `docs/src/main/scala/docs/persistence/state/MyStateStore.scala`
- `docs/src/main/java/docs/persistence/state/MyJavaStateStore.java`, `MyJavaStateStoreProvider.java`
- `docs/src/test/scala/docs/persistence/state/PersistenceStatePluginDocSpec.scala`
**Improvements over the upstream example:**
- `MyJavaStateStore.upsertObject` uses the generic type parameter `A` instead of `Object`, so the snippet is a correct, type-safe template when adapted to a concrete state type.
- The provider uses the diamond operator instead of raw types.
- Fixed an upstream grammar typo ("described" → "describes").
**Intentional divergence from upstream:** Pekko's `DurableStateUpdateStore` already documents `@param revision` (richer than the upstream `@param seqNr` fix), and the upstream `//#plugin-api` markers on the real trait are not referenced by the docs (the snippet is taken from the example file), so they are omitted to avoid leaking rendering markers into production sources.
### Result
Durable State plugin authors have a step-by-step guide with compiling, tested Scala and Java examples.
which is now Apache licensed
### Tests
- `sbt "docs/testOnly docs.persistence.state.PersistenceStatePluginDocSpec"` (2/2 passed)
- `sbt "docs/paradox"` (success; all snippets resolve)
### References
Ports [akka/akka-core@1ce8748](https://github.com/akka/akka-core/commit/1ce8748239e968f1fba15d23213130e5be98945b) (akka#31973), which is now Apache licensed.
--
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: notifications-unsubscribe@pekko.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org
For additional commands, e-mail: notifications-help@pekko.apache.org
Re: [PR] docs: how to write a custom Durable State store plugin [pekko]
Posted by "pjfanning (via GitHub)" <gi...@apache.org>.
pjfanning commented on code in PR #3274:
URL: https://github.com/apache/pekko/pull/3274#discussion_r3504616043
##########
docs/src/main/scala/docs/persistence/state/MyStateStore.scala:
##########
@@ -0,0 +1,68 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * license agreements; and to You under the Apache License, version 2.0:
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * This file is part of the Apache Pekko project, which was derived from Akka.
+ */
+
+/*
+ * Copyright (C) 2023 Lightbend Inc. <https://www.lightbend.com>
+ */
+
+package docs.persistence.state
+
+import org.apache.pekko.Done
Review Comment:
in the 2 new scala specs in this PR, could you import org.apache.pekko and change the others to start with `import pekko.`?
--
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: notifications-unsubscribe@pekko.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org
For additional commands, e-mail: notifications-help@pekko.apache.org
Re: [PR] docs: how to write a custom Durable State store plugin [pekko]
Posted by "pjfanning (via GitHub)" <gi...@apache.org>.
pjfanning commented on code in PR #3274:
URL: https://github.com/apache/pekko/pull/3274#discussion_r3504616043
##########
docs/src/main/scala/docs/persistence/state/MyStateStore.scala:
##########
@@ -0,0 +1,68 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * license agreements; and to You under the Apache License, version 2.0:
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * This file is part of the Apache Pekko project, which was derived from Akka.
+ */
+
+/*
+ * Copyright (C) 2023 Lightbend Inc. <https://www.lightbend.com>
+ */
+
+package docs.persistence.state
+
+import org.apache.pekko.Done
Review Comment:
in the 2 new scala files in this PR, could you import org.apache.pekko and change the others to start with `import pekko.`?
--
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: notifications-unsubscribe@pekko.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org
For additional commands, e-mail: notifications-help@pekko.apache.org
Re: [PR] docs: how to write a custom Durable State store plugin [pekko]
Posted by "He-Pin (via GitHub)" <gi...@apache.org>.
He-Pin merged PR #3274:
URL: https://github.com/apache/pekko/pull/3274
--
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: notifications-unsubscribe@pekko.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org
For additional commands, e-mail: notifications-help@pekko.apache.org
Re: [PR] docs: how to write a custom Durable State store plugin [pekko]
Posted by "pjfanning (via GitHub)" <gi...@apache.org>.
pjfanning commented on code in PR #3274:
URL: https://github.com/apache/pekko/pull/3274#discussion_r3504621470
##########
docs/src/main/scala/docs/persistence/state/MyStateStore.scala:
##########
@@ -0,0 +1,68 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * license agreements; and to You under the Apache License, version 2.0:
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * This file is part of the Apache Pekko project, which was derived from Akka.
+ */
+
+/*
+ * Copyright (C) 2023 Lightbend Inc. <https://www.lightbend.com>
+ */
+
+package docs.persistence.state
+
+import org.apache.pekko.Done
+import org.apache.pekko.actor.ExtendedActorSystem
+import org.apache.pekko.persistence.state.{ DurableStateStoreProvider, DurableStateStoreRegistry }
+import org.apache.pekko.persistence.state.scaladsl.{ DurableStateStore, DurableStateUpdateStore, GetObjectResult }
+import com.typesafe.config.Config
+import org.apache.pekko.persistence.state.javadsl.{ DurableStateStore => JDurableStateStore }
Review Comment:
could you move the `com.typesafe.config.Config` line so the Pekko imports are together?
--
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: notifications-unsubscribe@pekko.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org
For additional commands, e-mail: notifications-help@pekko.apache.org