pekko icon indicating copy to clipboard operation
pekko copied to clipboard

Implement EventsByTag in javadsl.PersistenceTestKitReadJournal.scala

Open olijaun opened this issue 1 year ago • 4 comments

Hi

I wanted to Query events by tag using EventsByTag with org.apache.pekko.persistence.testkit.query.javadsl.PersistenceTestKitReadJournal. Unfortunately this interface is not implemented yet. The scala-Version does implement EventsByTag. Is there a specific reason for this? As far as I can tell (I'm no Scala-Developer) one could simply add an additional delegate method.

I also saw that the org.apache.pekko.persistence.testkit.query.scaladsl.PersistenceTestKitReadJournal does not support specifying an offset other than NoOffset. This will probably be my next issue...

What I actually want to do is to replace io.github.alstanchev.pekko.persistence.inmemory.query.javadsl.InMemoryReadJournal with something that is included in the "standard" pekko libs. Is there another option? I saw that there is a org.apache.pekko.persistence.journal.inmem.InmemJournal but I could not figure out how I'm supposed to use that. How would I configure that in application.conf?

Thanks and regards Oliver

olijaun avatar Feb 06 '25 12:02 olijaun

The Java DSL can often have a few missing features - mainly due to an oversight. In particular, EventsByTag support was only added recently to the Scala DSL PersistenceTestKitReadJournal - #1532. I have added #1763 but will need to get back to it to add a test or 2. There seem to be a few more missing interfaces too.

pjfanning avatar Feb 08 '25 09:02 pjfanning

From the Javadoc of InMemJournal.

 * InmemJournal is only intended to be used for tests and therefore binary backwards compatibility
 * of the published messages are not guaranteed.

I think if you are going to use a persistence framework, that you should use real persistence (JDBC, Cassandra, DynamoDB, etc).

pjfanning avatar Feb 08 '25 10:02 pjfanning

I created https://github.com/apache/pekko/issues/1765

pjfanning avatar Feb 08 '25 10:02 pjfanning

Thanks a lot for your answers and work @pjfanning.

I use the io.github.alstanchev.pekko.persistence.inmemory.query.javadsl.InMemoryReadJournal only for testing. I use pekko-persistence-jdbc for my application. There is currently no Version for Pekko 1.1.3 of the InMemoryReadJournal and it's a bit tedious to add the dependencies to make it working. That's why I thought it would be nice to have something that comes directly with Pekko. But of course I can live with that for the moment :-) Thanks!

olijaun avatar Feb 17 '25 07:02 olijaun