Search code examples
javalagom

Can we use Cassandra for managing persistent entity and MySQL for readside


Can I use Cassandra for storing persistent entity and MySQL for read-side database.


Solution

  • Yes, the read side is completely independent from persistent entities. Feel free to implemement your read side processors using whatever you like.

    That said, is you're planning to include both lagom-javadsl-persistence-cassandra and lagom-javadsl-persistence-jdbc in your project, you might have a problem. Both include bindings for PersistentEntityRegistry and OffsetStore. I'm not sure how Guice would resolve this conflict, and you might have to override these bindings in your own application module.

    • Bind PersistentEntityRegistry to CassandraPersistentEntityRegistry
    • Bind OffsetStore to SlickOffsetStore.

    It would be nice if Lagom split the bindings of these two implementations to separate modules that we could then enable or disable as required. That's not the case in the current version, alas.