This commit introduces a first version of a Persistence plugin to store serialized events on a Cassandra (version 3.9) instance.
The events are:
Later, when required, the serialized events can be retrieved from Cassandra to be processed and analyzed elsewhere (see here for a testing example to retrieve and deserialize events).
Suggestions and improvements are welcome!
Please note that the plugin comes with a bundled Integration Test configuration, so it will be possible to easily verify the behavior of Cassandra persistence.
These are the Maven goals relevant to the plugin:
mvn compile generates the Avro Event object starting from the Avro schema (however this Java class is not used in the plugin so far);
mvn verify runs the integration tests: it starts a 32 bit Docker instance of Cassandra 3.9 and performs a series of write/read operations to verify if events are properly serialized and persisted.
@mcicolella I've fixed a couple of errors that did not allow to start the plugin properly. Now on my freedomotic local instance the Persistence plugin is properly loaded. It operates with a local Cassandra Docker image!
Persistence plugin completed
@mcicolella finally here I am with a proper edit of this PR. Currently this plugin should be able to persist any kind of events, independently from their actually properties set.
Basically, each time an event is triggered, it is serialized with Avro and saved, together with the serialization schema, in a Cassandra table.
This serialized version of the event contains an array field, named "properties", where are stored all the properties as [key,value] couples.
I've tested it in my local Freedomotic environment and it seems to work properly now.
Please, let me know if you have any problem while executing it.
Meanwhile, have a nice evening,
P.s.: to speed up testing in my environment, I've prepared a dummy script that:
it is available here.
@P3trur0 Great work! I'm testing it.
For now there is a "reaction" that should be removed or modified because the command "Save data on the persistence layer" doesn't exist.
@mcicolella where can I perform this removal? Could you please provide me a reference?
You can simply remove the .xrea file into data/rea folder.
removed unused reaction
Here you go, .xrea removed properly.