JDBC read_side_offsets and journal

I have a read side processor which is failing, and it is failing on a specific offset that I know. However, in the journal there are two identifiers: ordering and sequence_id.

  1. Which one of those maps to the read_side_offset in the JDBC?
  2. How can we one find the persistenceId given the entityId?

The ordering column is used as the offset. It’s implemented using an auto-incrementing sequence, so it is unique across the entire set of events.

The sequence_number column is relative to a particular persistence ID, so it can’t be used for ordering events across different entities.

The persistence ID is determined by combining the entity type name and the entity ID. By default, the entity type name is the abbreviated (without package qualifier) class name of the persistent entity, but you can change this by overriding the entityTypeName method (for example, if you want to change the class name without affecting data that has already been persisted).

The mapping from entity ID to persistence ID is slightly different between Java and Scala. You can find the implementation in PersistentEntityActor (Java/Scala). The only difference is that the Scala implementation puts a | separator between the prefix and the ID, while the Java implementation does not.

1 Like