I had been experimenting with Lagom with a small project : https://github.com/codingkapoor/lagom-scala-slick.
Q1. What I have noticed that lagom after persisting events in Cassandra writes the same to Kafka too. I understand that using Kafka decouples services but isn’t maintaining events both in Cassandra and Kafka redundant?
From the README of the above mentioned project I have been working on:
Verify Kafka
$ /opt/kafka_2.12-1.0.0/bin/kafka-topics.sh --zookeeper localhost:2181 --list
__consumer_offsets
employee
$ /opt/kafka_2.12-1.0.0/bin/kafka-console-consumer.sh --topic employee --bootstrap-server localhost:9092 --from-beginning
{"gender":"M","name":"Shivam","pfn":"PFKN110","id":"128","type":"EmployeeAdded","doj":"2017-01-16"}
Verify Cassandra
$ /opt/apache-cassandra-3.11.4/bin/cqlsh localhost 4000
cqlsh> USE lagom_scala_slick;
cqlsh:simplelms> select * from messages ;
persistence_id | partition_nr | sequence_nr | timestamp | timebucket | used | event | event_manifest | message | meta | meta_ser_id | meta_ser_manifest | ser_id | ser_manifest | tag1 | tag2 | tag3 | writer_uuid
------------------------------------------------+--------------+-------------+--------------------------------------+------------+------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+----------------+---------+------+-------------+-------------------+---------+-----------------------------------------------------------+-----------------------------------------------------------+------+------+--------------------------------------
EmployeePersistenceEntity|128 | 0 | 1 | 9757cab0-cb0c-11e9-91c9-d1a5d92dc8d6 | 20190830 | True | 0x7b226964223a22313238222c226e616d65223a2253686976616d222c2267656e646572223a224d222c22646f6a223a22323031372d30312d3136222c2270666e223a2250464b4e313130227d | | null | null | null | null | 1000004 | com.codingkapoor.employee.persistence.write.EmployeeAdded | com.codingkapoor.employee.persistence.write.EmployeeEvent | null | null | 5ecbca45-9b79-46c5-a858-5c97d9ed1da2
/sharding/kafkaProducer-employeeCoordinator | 0 | 1 | 947e2530-cb09-11e9-91c9-d1a5d92dc8d6 | 20190830 | True | 0x0a65616b6b612e7463703a2f2f656d706c6f7965652d696d706c2d6170706c69636174696f6e403132372e302e302e313a33383833352f73797374656d2f7368617264696e672f6b61666b6150726f64756365722d656d706c6f79656523333832323635343635 | | null | null | null | null | 13 | AB | null | null | null | c39f782f-5a96-4628-9568-060d01ad6a93
/sharding/kafkaProducer-employeeCoordinator | 0 | 2 | 94850300-cb09-11e9-91c9-d1a5d92dc8d6 | 20190830 | True | 0x0a0973696e676c65746f6e1265616b6b612e7463703a2f2f656d706c6f7965652d696d706c2d6170706c69636174696f6e403132372e302e302e313a33383833352f73797374656d2f7368617264696e672f6b61666b6150726f64756365722d656d706c6f79656523333832323635343635 | | null | null | null | null | 13 | AF | null | null | null | c39f782f-5a96-4628-9568-060d01ad6a93
/sharding/EmployeeEventProcessorCoordinator | 0 | 1 | 947e2531-cb09-11e9-91c9-d1a5d92dc8d6 | 20190830 | True | 0x0a67616b6b612e7463703a2f2f656d706c6f7965652d696d706c2d6170706c69636174696f6e403132372e302e302e313a33383833352f73797374656d2f7368617264696e672f456d706c6f7965654576656e7450726f636573736f72232d31323535303739333037 | | null | null | null | null | 13 | AB | null | null | null | b12e8f2c-485d-4c51-a7b3-7da9d66f3949
/sharding/EmployeeEventProcessorCoordinator | 0 | 2 | 94848dd0-cb09-11e9-91c9-d1a5d92dc8d6 | 20190830 | True | 0x0a39636f6d2e636f64696e676b61706f6f722e656d706c6f7965652e70657273697374656e63652e77726974652e456d706c6f7965654576656e741267616b6b612e7463703a2f2f656d706c6f7965652d696d706c2d6170706c69636174696f6e403132372e302e302e313a33383833352f73797374656d2f7368617264696e672f456d706c6f7965654576656e7450726f636573736f72232d31323535303739333037 | | null | null | nmessagull | null | 13 | AF | null | null | null | b12e8f2c-485d-4c51-a7b3-7da9d66f3949
/sharding/EmployeePersistenceEntityCoordinator | 0 | 1 | 947e2532-cb09-11e9-91c9-d1a5d92dc8d6 | 20190830 | True | 0x0a68616b6b612e7463703a2f2f656d706c6f7965652d696d706c2d6170706c69636174696f6e403132372e302e302e313a33383833352f73797374656d2f7368617264696e672f456d706c6f79656550657273697374656e6365456e74697479232d3231303737303339 | | null | null | null | null | 13 | AB | null | null | null | d4fbac44-e315-4f76-8fe3-7184f874cb87
/sharding/EmployeePersistenceEntityCoordinator | 0 | 2 | 975050a0-cb0c-11e9-91c9-d1a5d92dc8d6 | 20190830 | True | 0x0a0239351268616b6b612e7463703a2f2f656d706c6f7965652d696d706c2d6170706c69636174696f6e403132372e302e302e313a33383833352f73797374656d2f7368617264696e672f456d706c6f79656550657273697374656e6365456e74697479232d3231303737303339 | | null | null | null | null | 13 | AF | null | null | null | d4fbac44-e315-4f76-8fe3-7184f874cb87
Q2. How really is this message
cassandra column family different from kafka topic in terms of content they maintain?
Q3. Is it necessary to implement Kafka just to implement Readside processor? Can’t we just implement the same using only kafka or cassandra??
Q4. Also, the EmployeeEvent
definition under lagom-scala-slick/employee-api/src/main/scala/com/codingkapoor/employee/api/
is precisely KAFKA Event Definition while the one under lagom-scala-slick/employee-impl/src/main/scala/com/codingkapoor/employee/persistence/write/
is PERSISTENTENTITY Event Definition? Correct me if I am wrong.
Please explain.