Cassandra Read Side Not Processing Events

Hi …

I’m having an issue where a cassandra read side view is not sending events to the event handler method. I cannot determine why.

A subscriber to the service message topic does receive messages generated from events. However, these events never reach the read side event handler method, even though the offsets for the view are recorded in the offset store.

I’ve pushed an example project to github that recreates this condition.

Can someone help me understand what I’ve done wrong here?

Thank you!
–Steve

Hello All …

I’ve gone through this several times comparing to any documentation or examples I could find. Clearly, I am missing something. Can someone provide any hints as to what is wrong?

Thank you!
–Steve

Tenacity pays off!!! Drilling down into Lagom code, CassandraReadSideImpl builds a Map of handlers that is keyed by event ClassTag.

So, my original code matches nothing:

override def buildHandler(): ReadSideProcessor.ReadSideHandler[Event] =
    readSideProcessor.builder[Event]("processes")
      .setGlobalPrepare(() => createTable())
      .setPrepare(_ => prepare())
      .setEventHandler[Event](processEvent _)
      .build()

The solution is to match each derived Event class:

override def buildHandler(): ReadSideProcessor.ReadSideHandler[Event] =
    readSideProcessor.builder[Event]("processes")
      .setGlobalPrepare(() => createTable())
      .setPrepare(_ => prepare())
      .setEventHandler[event.Added](processAddedEvent _)
      .setEventHandler[event.Dropped](processDroppedEvent _)
      .setEventHandler[event.Updated](processUpdatedEvent _)
      .build()

Yeah, the log at debug level is probably not enough to help diagnose this issue:

How do you think this could be improved?

Maybe change the debug message to:

“Unhandled event [{}]. Note: A handler must be set via ‘setEventHandler’ for each derived Event class.”

It seems a bit kludgy, but it may be the easiest way.