You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@pekko.apache.org by "janjaali (via GitHub)" <gi...@apache.org> on 2025/02/09 11:29:38 UTC
[PR] Add support for querying last known sequence number by persistenceId. [pekko-persistence-jdbc]
janjaali opened a new pull request, #267:
URL: https://github.com/apache/pekko-persistence-jdbc/pull/267
Resolves <https://github.com/apache/pekko/issues/1761> for this plugin.
--
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] Add support for querying last known sequence number by persistenceId. [pekko-persistence-jdbc]
Posted by "pjfanning (via GitHub)" <gi...@apache.org>.
pjfanning commented on code in PR #267:
URL: https://github.com/apache/pekko-persistence-jdbc/pull/267#discussion_r1948070291
##########
core/src/main/scala/org/apache/pekko/persistence/jdbc/query/javadsl/JdbcReadJournal.scala:
##########
@@ -132,4 +139,14 @@ class JdbcReadJournal(journal: ScalaJdbcReadJournal)
*/
override def eventsByTag(tag: String, offset: Offset): Source[EventEnvelope, NotUsed] =
journal.eventsByTag(tag, offset).asJava
+
+ override def currentLastKnownSequenceNumberByPersistenceId(
+ persistenceId: String
+ ): CompletionStage[Optional[Long]] = {
Review Comment:
ok - I see this is the javadsl package - so this is fine
--
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] Add support for querying last known sequence number by persistenceId. [pekko-persistence-jdbc]
Posted by "janjaali (via GitHub)" <gi...@apache.org>.
janjaali commented on code in PR #267:
URL: https://github.com/apache/pekko-persistence-jdbc/pull/267#discussion_r1948131315
##########
core/src/main/scala/org/apache/pekko/persistence/jdbc/query/javadsl/CurrentLastKnownSequenceNumberByPersistenceIdQuery.scala:
##########
@@ -0,0 +1,27 @@
+/*
Review Comment:
Sure! Updated in <https://github.com/apache/pekko-persistence-jdbc/pull/267/commits/b033218f3f11f813fffa6cb8c5f7a46b82022d2f>.
--
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] Add support for querying last known sequence number by persistenceId. [pekko-persistence-jdbc]
Posted by "janjaali (via GitHub)" <gi...@apache.org>.
janjaali commented on PR #267:
URL: https://github.com/apache/pekko-persistence-jdbc/pull/267#issuecomment-2646201294
@pjfanning I tried to align column widths to 120 and dropped curly braces for single statement methods. I hope that fits better now.
--
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] Add support for querying last known sequence number by persistenceId. [pekko-persistence-jdbc]
Posted by "pjfanning (via GitHub)" <gi...@apache.org>.
pjfanning commented on code in PR #267:
URL: https://github.com/apache/pekko-persistence-jdbc/pull/267#discussion_r1948270542
##########
core/src/main/scala/org/apache/pekko/persistence/jdbc/query/javadsl/JdbcReadJournal.scala:
##########
@@ -32,7 +38,8 @@ class JdbcReadJournal(journal: ScalaJdbcReadJournal)
with CurrentEventsByPersistenceIdQuery
with EventsByPersistenceIdQuery
with CurrentEventsByTagQuery
- with EventsByTagQuery {
+ with EventsByTagQuery
+ with CurrentLastKnownSequenceNumberByPersistenceIdQuery {
Review Comment:
My aim would be merge this without the marker trait meaning that we could release a version pekko-persistence-jdbc 1.1.x that supports this but without needing a new Pekko core release. pekko-persistence 1.2.0-M2 and above could have the marker trait and a pekko-persistence-jdbc 1.2.0(-M1) release could rely on pekko-persistence 1.2.0-M2 and uptake the marker trait.
I haven't studied pekko-persistence-r2dbc but I presume that it too could implement this support and in a similar timeline.
--
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] Add support for querying last known sequence number by persistenceId. [pekko-persistence-jdbc]
Posted by "janjaali (via GitHub)" <gi...@apache.org>.
janjaali commented on code in PR #267:
URL: https://github.com/apache/pekko-persistence-jdbc/pull/267#discussion_r1957068980
##########
core/src/main/scala/org/apache/pekko/persistence/jdbc/query/javadsl/JdbcReadJournal.scala:
##########
@@ -132,4 +138,16 @@ class JdbcReadJournal(journal: ScalaJdbcReadJournal)
*/
override def eventsByTag(tag: String, offset: Offset): Source[EventEnvelope, NotUsed] =
journal.eventsByTag(tag, offset).asJava
+
+ /**
+ * Returns the last known sequence number for the given `persistenceId`. Empty if the `persistenceId` is unknown.
+ *
+ * @param persistenceId The `persistenceId` for which the last known sequence number should be returned.
+ * @return Some sequence number or None if the `persistenceId` is unknown.
+ */
+ def currentLastKnownSequenceNumberByPersistenceId(persistenceId: String): CompletionStage[Optional[Long]] =
Review Comment:
I was considering `scala.Long` as the better suited one here, since the `EventEnvelope` itself - which is the return type of multiple other methods in this class - carries the offset and specially the sequenceNr - the attribute that this method is actually interested in - as scala.Long.
The Optional wrapper was "inspired" by the `GetObjectResult` for the `DurableStateStore` javadsl.
--
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] Add support for querying last known sequence number by persistenceId. [pekko-persistence-jdbc]
Posted by "pjfanning (via GitHub)" <gi...@apache.org>.
pjfanning commented on PR #267:
URL: https://github.com/apache/pekko-persistence-jdbc/pull/267#issuecomment-2854779385
#271 modifies the function name added in this PR
--
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] Add support for querying last known sequence number by persistenceId. [pekko-persistence-jdbc]
Posted by "pjfanning (via GitHub)" <gi...@apache.org>.
pjfanning commented on code in PR #267:
URL: https://github.com/apache/pekko-persistence-jdbc/pull/267#discussion_r1948095125
##########
core/src/main/scala/org/apache/pekko/persistence/jdbc/query/javadsl/JdbcReadJournal.scala:
##########
@@ -32,7 +38,8 @@ class JdbcReadJournal(journal: ScalaJdbcReadJournal)
with CurrentEventsByPersistenceIdQuery
with EventsByPersistenceIdQuery
with CurrentEventsByTagQuery
- with EventsByTagQuery {
+ with EventsByTagQuery
+ with CurrentLastKnownSequenceNumberByPersistenceIdQuery {
Review Comment:
Do we really need the CurrentLastKnownSequenceNumberByPersistenceIdQuery trait? Can't we just add the function without having a marker trait.
We can add the trait to the pekko-persistence jar at some stage and then do another PR to uptake the trait here.
--
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] Add support for querying last known sequence number by persistenceId. [pekko-persistence-jdbc]
Posted by "pjfanning (via GitHub)" <gi...@apache.org>.
pjfanning commented on code in PR #267:
URL: https://github.com/apache/pekko-persistence-jdbc/pull/267#discussion_r1948070108
##########
core/src/main/scala/org/apache/pekko/persistence/jdbc/query/javadsl/JdbcReadJournal.scala:
##########
@@ -132,4 +139,14 @@ class JdbcReadJournal(journal: ScalaJdbcReadJournal)
*/
override def eventsByTag(tag: String, offset: Offset): Source[EventEnvelope, NotUsed] =
journal.eventsByTag(tag, offset).asJava
+
+ override def currentLastKnownSequenceNumberByPersistenceId(
+ persistenceId: String
+ ): CompletionStage[Optional[Long]] = {
Review Comment:
why is this using Java Optional and not Scala Option?
--
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] Add support for querying last known sequence number by persistenceId. [pekko-persistence-jdbc]
Posted by "pjfanning (via GitHub)" <gi...@apache.org>.
pjfanning commented on code in PR #267:
URL: https://github.com/apache/pekko-persistence-jdbc/pull/267#discussion_r1948069727
##########
core/src/main/scala/org/apache/pekko/persistence/jdbc/query/dao/DefaultReadJournalDao.scala:
##########
@@ -60,6 +60,12 @@ class DefaultReadJournalDao(
override def journalSequence(offset: Long, limit: Long): Source[Long, NotUsed] =
Source.fromPublisher(db.stream(queries.journalSequenceQuery((offset, limit)).result))
+ override def lastPersistenceIdSequenceNumber(
+ persistenceId: String
Review Comment:
Could you use the existing code style? See the function above as an example.
--
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] Add support for querying last known sequence number by persistenceId. [pekko-persistence-jdbc]
Posted by "pjfanning (via GitHub)" <gi...@apache.org>.
pjfanning commented on code in PR #267:
URL: https://github.com/apache/pekko-persistence-jdbc/pull/267#discussion_r1956783437
##########
core/src/main/scala/org/apache/pekko/persistence/jdbc/query/javadsl/JdbcReadJournal.scala:
##########
@@ -132,4 +138,16 @@ class JdbcReadJournal(journal: ScalaJdbcReadJournal)
*/
override def eventsByTag(tag: String, offset: Offset): Source[EventEnvelope, NotUsed] =
journal.eventsByTag(tag, offset).asJava
+
+ /**
+ * Returns the last known sequence number for the given `persistenceId`. Empty if the `persistenceId` is unknown.
+ *
+ * @param persistenceId The `persistenceId` for which the last known sequence number should be returned.
+ * @return Some sequence number or None if the `persistenceId` is unknown.
+ */
+ def currentLastKnownSequenceNumberByPersistenceId(persistenceId: String): CompletionStage[Optional[Long]] =
Review Comment:
I wonder if this should be java.lang.Long instead of scala.Long? scala.Long acts as an alias for the Java long primitive which is not the same as java.lang.Long. java.lang.Long is nullable but I still prefer the Optional wrapper.
wdyt @janjaali @ptrdom ?
--
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] Add support for querying last known sequence number by persistenceId. [pekko-persistence-jdbc]
Posted by "pjfanning (via GitHub)" <gi...@apache.org>.
pjfanning commented on code in PR #267:
URL: https://github.com/apache/pekko-persistence-jdbc/pull/267#discussion_r1956783437
##########
core/src/main/scala/org/apache/pekko/persistence/jdbc/query/javadsl/JdbcReadJournal.scala:
##########
@@ -132,4 +138,16 @@ class JdbcReadJournal(journal: ScalaJdbcReadJournal)
*/
override def eventsByTag(tag: String, offset: Offset): Source[EventEnvelope, NotUsed] =
journal.eventsByTag(tag, offset).asJava
+
+ /**
+ * Returns the last known sequence number for the given `persistenceId`. Empty if the `persistenceId` is unknown.
+ *
+ * @param persistenceId The `persistenceId` for which the last known sequence number should be returned.
+ * @return Some sequence number or None if the `persistenceId` is unknown.
+ */
+ def currentLastKnownSequenceNumberByPersistenceId(persistenceId: String): CompletionStage[Optional[Long]] =
Review Comment:
I wonder if this should be java.lang.Long instead of scala.Long? scala.Long acts as an alias for the Java long primitive which is not the same as java.lang.Long. java.lang.Long is nullable but I still prefer the Optional wrapper.
wdyt @janjaali @ptrdom @raboof @He-Pin ?
--
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] Add support for querying last known sequence number by persistenceId. [pekko-persistence-jdbc]
Posted by "janjaali (via GitHub)" <gi...@apache.org>.
janjaali commented on code in PR #267:
URL: https://github.com/apache/pekko-persistence-jdbc/pull/267#discussion_r1948133226
##########
core/src/main/scala/org/apache/pekko/persistence/jdbc/query/javadsl/JdbcReadJournal.scala:
##########
@@ -32,7 +38,8 @@ class JdbcReadJournal(journal: ScalaJdbcReadJournal)
with CurrentEventsByPersistenceIdQuery
with EventsByPersistenceIdQuery
with CurrentEventsByTagQuery
- with EventsByTagQuery {
+ with EventsByTagQuery
+ with CurrentLastKnownSequenceNumberByPersistenceIdQuery {
Review Comment:
Main intent was to stick to existing marker traits application + having that part of contract testable on its own. In our applications we rarely declare dependencies to the full query journal, usually we tend to have the capabilities speaking:
```scala
object FancyAggregator {
def apply(readJournal: EventsByTagQuery)
}
```
vs
```scala
object FancyAggregator {
def apply(readJournal: JdbcReadJournal)
}
```
If you feel more comfortable, surely, I can try to inline it without marker trait. Would make dependency injection a bit harder.
--
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] Add support for querying last known sequence number by persistenceId. [pekko-persistence-jdbc]
Posted by "pjfanning (via GitHub)" <gi...@apache.org>.
pjfanning commented on code in PR #267:
URL: https://github.com/apache/pekko-persistence-jdbc/pull/267#discussion_r1948078488
##########
core/src/main/scala/org/apache/pekko/persistence/jdbc/query/javadsl/CurrentLastKnownSequenceNumberByPersistenceIdQuery.scala:
##########
@@ -0,0 +1,27 @@
+/*
Review Comment:
Can you change the license header on new files that are not copies of other files to be https://github.com/apache/pekko/blob/main/project/AddMetaInfLicenseFiles.scala#L1-L16 ?
--
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] Add support for querying last known sequence number by persistenceId. [pekko-persistence-jdbc]
Posted by "janjaali (via GitHub)" <gi...@apache.org>.
janjaali commented on code in PR #267:
URL: https://github.com/apache/pekko-persistence-jdbc/pull/267#discussion_r1951471351
##########
core/src/main/scala/org/apache/pekko/persistence/jdbc/query/javadsl/JdbcReadJournal.scala:
##########
@@ -32,7 +38,8 @@ class JdbcReadJournal(journal: ScalaJdbcReadJournal)
with CurrentEventsByPersistenceIdQuery
with EventsByPersistenceIdQuery
with CurrentEventsByTagQuery
- with EventsByTagQuery {
+ with EventsByTagQuery
+ with CurrentLastKnownSequenceNumberByPersistenceIdQuery {
Review Comment:
Removed marker trait with <https://github.com/apache/pekko-persistence-jdbc/pull/267/commits/ce15d5ea2627de79e32c025b1caa971d5d761320>.
--
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] Add support for querying last known sequence number by persistenceId. [pekko-persistence-jdbc]
Posted by "ptrdom (via GitHub)" <gi...@apache.org>.
ptrdom commented on code in PR #267:
URL: https://github.com/apache/pekko-persistence-jdbc/pull/267#discussion_r1957072968
##########
core/src/main/scala/org/apache/pekko/persistence/jdbc/query/javadsl/JdbcReadJournal.scala:
##########
@@ -132,4 +138,16 @@ class JdbcReadJournal(journal: ScalaJdbcReadJournal)
*/
override def eventsByTag(tag: String, offset: Offset): Source[EventEnvelope, NotUsed] =
journal.eventsByTag(tag, offset).asJava
+
+ /**
+ * Returns the last known sequence number for the given `persistenceId`. Empty if the `persistenceId` is unknown.
+ *
+ * @param persistenceId The `persistenceId` for which the last known sequence number should be returned.
+ * @return Some sequence number or None if the `persistenceId` is unknown.
+ */
+ def currentLastKnownSequenceNumberByPersistenceId(persistenceId: String): CompletionStage[Optional[Long]] =
Review Comment:
Quick search in Pekko repository gives mixed results, some `javadsl` classes stick to `java.lang.Long` quite well, others do not. My guess is that `javadsl` should use `java.lang.Long`, it is just difficult to enforce, because there is no automatic linting for it.
--
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] Add support for querying last known sequence number by persistenceId. [pekko-persistence-jdbc]
Posted by "janjaali (via GitHub)" <gi...@apache.org>.
janjaali commented on code in PR #267:
URL: https://github.com/apache/pekko-persistence-jdbc/pull/267#discussion_r1948131590
##########
core/src/test/scala/org/apache/pekko/persistence/jdbc/query/CurrentLastKnownSequenceNumberByPersistenceIdTest.scala:
##########
@@ -0,0 +1,51 @@
+/*
+ * 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.
+ */
+
+package org.apache.pekko.persistence.jdbc.query
+
+import org.scalatest.concurrent.ScalaFutures
+
+abstract class CurrentLastKnownSequenceNumberByPersistenceIdTest(
+ config: String
Review Comment:
Hope <https://github.com/apache/pekko-persistence-jdbc/pull/267/commits/f0cc6c571a8a394761de4d312c5cb6d71645dca3> does the job?
--
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] Add support for querying last known sequence number by persistenceId. [pekko-persistence-jdbc]
Posted by "pjfanning (via GitHub)" <gi...@apache.org>.
pjfanning commented on code in PR #267:
URL: https://github.com/apache/pekko-persistence-jdbc/pull/267#discussion_r1948069919
##########
core/src/main/scala/org/apache/pekko/persistence/jdbc/query/dao/ReadJournalQueries.scala:
##########
@@ -29,6 +29,9 @@ class ReadJournalQueries(val profile: JdbcProfile, val readJournalConfig: ReadJo
val messagesQuery = Compiled(_messagesQuery _)
val eventsByTag = Compiled(_eventsByTag _)
val journalSequenceQuery = Compiled(_journalSequenceQuery _)
+ val lastPersistenceIdSequenceNumberQuery = Compiled {
+ _lastPersistenceIdSequenceNumberQuery _
Review Comment:
same - please don't change the code style - look at the line above for an indication of style
--
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] Add support for querying last known sequence number by persistenceId. [pekko-persistence-jdbc]
Posted by "janjaali (via GitHub)" <gi...@apache.org>.
janjaali commented on code in PR #267:
URL: https://github.com/apache/pekko-persistence-jdbc/pull/267#discussion_r1957306537
##########
core/src/main/scala/org/apache/pekko/persistence/jdbc/query/javadsl/JdbcReadJournal.scala:
##########
@@ -132,4 +138,16 @@ class JdbcReadJournal(journal: ScalaJdbcReadJournal)
*/
override def eventsByTag(tag: String, offset: Offset): Source[EventEnvelope, NotUsed] =
journal.eventsByTag(tag, offset).asJava
+
+ /**
+ * Returns the last known sequence number for the given `persistenceId`. Empty if the `persistenceId` is unknown.
+ *
+ * @param persistenceId The `persistenceId` for which the last known sequence number should be returned.
+ * @return Some sequence number or None if the `persistenceId` is unknown.
+ */
+ def currentLastKnownSequenceNumberByPersistenceId(persistenceId: String): CompletionStage[Optional[Long]] =
Review Comment:
Using `java.lang.Long` in <https://github.com/apache/pekko-persistence-jdbc/pull/267/commits/711145fb39f9a71dbf8455fa94af4adcfa7a049d>. I wasn't able to import `java.lang.Long` in top level since `scala.Long` already used in other query methods.
--
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] Add support for querying last known sequence number by persistenceId. [pekko-persistence-jdbc]
Posted by "janjaali (via GitHub)" <gi...@apache.org>.
janjaali commented on code in PR #267:
URL: https://github.com/apache/pekko-persistence-jdbc/pull/267#discussion_r1948876089
##########
core/src/main/scala/org/apache/pekko/persistence/jdbc/query/javadsl/JdbcReadJournal.scala:
##########
@@ -32,7 +38,8 @@ class JdbcReadJournal(journal: ScalaJdbcReadJournal)
with CurrentEventsByPersistenceIdQuery
with EventsByPersistenceIdQuery
with CurrentEventsByTagQuery
- with EventsByTagQuery {
+ with EventsByTagQuery
+ with CurrentLastKnownSequenceNumberByPersistenceIdQuery {
Review Comment:
Sure, I will drop the marker trait today or tomorrow.
--
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] Add support for querying last known sequence number by persistenceId. [pekko-persistence-jdbc]
Posted by "janjaali (via GitHub)" <gi...@apache.org>.
janjaali commented on code in PR #267:
URL: https://github.com/apache/pekko-persistence-jdbc/pull/267#discussion_r1948076107
##########
core/src/main/scala/org/apache/pekko/persistence/jdbc/query/dao/DefaultReadJournalDao.scala:
##########
@@ -60,6 +60,12 @@ class DefaultReadJournalDao(
override def journalSequence(offset: Long, limit: Long): Source[Long, NotUsed] =
Source.fromPublisher(db.stream(queries.journalSequenceQuery((offset, limit)).result))
+ override def lastPersistenceIdSequenceNumber(
+ persistenceId: String
Review Comment:
Sure! Tried to align to existing code style in <https://github.com/apache/pekko-persistence-jdbc/pull/267/commits/49b7262dbcfe47279d580537a7c65dcdfd460fc8>.
##########
core/src/main/scala/org/apache/pekko/persistence/jdbc/query/dao/ReadJournalQueries.scala:
##########
@@ -29,6 +29,9 @@ class ReadJournalQueries(val profile: JdbcProfile, val readJournalConfig: ReadJo
val messagesQuery = Compiled(_messagesQuery _)
val eventsByTag = Compiled(_eventsByTag _)
val journalSequenceQuery = Compiled(_journalSequenceQuery _)
+ val lastPersistenceIdSequenceNumberQuery = Compiled {
+ _lastPersistenceIdSequenceNumberQuery _
Review Comment:
Sure! Tried to align to existing code style in <https://github.com/apache/pekko-persistence-jdbc/pull/267/commits/49b7262dbcfe47279d580537a7c65dcdfd460fc8>.
--
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] Add support for querying last known sequence number by persistenceId. [pekko-persistence-jdbc]
Posted by "ptrdom (via GitHub)" <gi...@apache.org>.
ptrdom commented on code in PR #267:
URL: https://github.com/apache/pekko-persistence-jdbc/pull/267#discussion_r1948104642
##########
core/src/main/scala/org/apache/pekko/persistence/jdbc/query/javadsl/JdbcReadJournal.scala:
##########
@@ -32,7 +38,8 @@ class JdbcReadJournal(journal: ScalaJdbcReadJournal)
with CurrentEventsByPersistenceIdQuery
with EventsByPersistenceIdQuery
with CurrentEventsByTagQuery
- with EventsByTagQuery {
+ with EventsByTagQuery
+ with CurrentLastKnownSequenceNumberByPersistenceIdQuery {
Review Comment:
Assuming a marker trait would allow writing this:
```
PersistenceQuery(system).readJournalFor[CurrentLastKnownSequenceNumberByPersistenceIdQuery](JdbcReadJournal.Identifier)
```
Instead of having to write this:
```
PersistenceQuery(system).readJournalFor[JdbcReadJournal](JdbcReadJournal.Identifier)
```
But if the goal is to eventually have the marker trait in the core repository then this serves very little and temporary purpose, so overall I agree with suggestion to remove it.
--
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] Add support for querying last known sequence number by persistenceId. [pekko-persistence-jdbc]
Posted by "ptrdom (via GitHub)" <gi...@apache.org>.
ptrdom commented on code in PR #267:
URL: https://github.com/apache/pekko-persistence-jdbc/pull/267#discussion_r1952123087
##########
core/src/main/scala/org/apache/pekko/persistence/jdbc/query/javadsl/JdbcReadJournal.scala:
##########
@@ -32,7 +38,8 @@ class JdbcReadJournal(journal: ScalaJdbcReadJournal)
with CurrentEventsByPersistenceIdQuery
with EventsByPersistenceIdQuery
with CurrentEventsByTagQuery
- with EventsByTagQuery {
+ with EventsByTagQuery
+ with CurrentLastKnownSequenceNumberByPersistenceIdQuery {
Review Comment:
Yes, I think it should be no problem to add this functionality to pekko-persistence-r2dbc.
--
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] Add support for querying last known sequence number by persistenceId. [pekko-persistence-jdbc]
Posted by "pjfanning (via GitHub)" <gi...@apache.org>.
pjfanning commented on code in PR #267:
URL: https://github.com/apache/pekko-persistence-jdbc/pull/267#discussion_r1951682777
##########
core/src/main/scala/org/apache/pekko/persistence/jdbc/query/javadsl/JdbcReadJournal.scala:
##########
@@ -32,7 +38,8 @@ class JdbcReadJournal(journal: ScalaJdbcReadJournal)
with CurrentEventsByPersistenceIdQuery
with EventsByPersistenceIdQuery
with CurrentEventsByTagQuery
- with EventsByTagQuery {
+ with EventsByTagQuery
+ with CurrentLastKnownSequenceNumberByPersistenceIdQuery {
Review Comment:
@ptrdom it looks like pekko-persistence-r2dbc can have a similar PR added at some stage? Can you confirm this? I can look into adding the marker trait to the pekko core but it could be a while before it makes it into a full release meaning that we will have to wait to add the uptake of the marker trait.
--
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] Add support for querying last known sequence number by persistenceId. [pekko-persistence-jdbc]
Posted by "pjfanning (via GitHub)" <gi...@apache.org>.
pjfanning merged PR #267:
URL: https://github.com/apache/pekko-persistence-jdbc/pull/267
--
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] Add support for querying last known sequence number by persistenceId. [pekko-persistence-jdbc]
Posted by "pjfanning (via GitHub)" <gi...@apache.org>.
pjfanning commented on code in PR #267:
URL: https://github.com/apache/pekko-persistence-jdbc/pull/267#discussion_r1948078680
##########
core/src/test/scala/org/apache/pekko/persistence/jdbc/query/CurrentLastKnownSequenceNumberByPersistenceIdTest.scala:
##########
@@ -0,0 +1,51 @@
+/*
+ * 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.
+ */
+
+package org.apache.pekko.persistence.jdbc.query
+
+import org.scalatest.concurrent.ScalaFutures
+
+abstract class CurrentLastKnownSequenceNumberByPersistenceIdTest(
+ config: String
Review Comment:
this style is still wrong
--
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] Add support for querying last known sequence number by persistenceId. [pekko-persistence-jdbc]
Posted by "pjfanning (via GitHub)" <gi...@apache.org>.
pjfanning commented on code in PR #267:
URL: https://github.com/apache/pekko-persistence-jdbc/pull/267#discussion_r1957160916
##########
core/src/main/scala/org/apache/pekko/persistence/jdbc/query/javadsl/JdbcReadJournal.scala:
##########
@@ -132,4 +138,16 @@ class JdbcReadJournal(journal: ScalaJdbcReadJournal)
*/
override def eventsByTag(tag: String, offset: Offset): Source[EventEnvelope, NotUsed] =
journal.eventsByTag(tag, offset).asJava
+
+ /**
+ * Returns the last known sequence number for the given `persistenceId`. Empty if the `persistenceId` is unknown.
+ *
+ * @param persistenceId The `persistenceId` for which the last known sequence number should be returned.
+ * @return Some sequence number or None if the `persistenceId` is unknown.
+ */
+ def currentLastKnownSequenceNumberByPersistenceId(persistenceId: String): CompletionStage[Optional[Long]] =
Review Comment:
I agree that Pekko is inconsistent but I would prefer that we use java.lang.Long here.
--
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