These are chat archives for RBMHTechnology/eventuate

30th
Sep 2016
Narayan Kumar
@knoldernarayan
Sep 30 2016 06:23
This message was deleted
Narayan Kumar
@knoldernarayan
Sep 30 2016 06:45

hi @krasserm we are using eventuate in our project an are stuck in one use case scenarios.
Eventuate is best when we logs the events and they are replayed to the current state , but we are not able to query it directly from the event_store.

Ill explain using a scenario : -

Suppose we have user details with us as Email ,
now when any user updates his email we log an EVENT as EMAIL_UPDATED , with content as new emailID .

again user can update his/her email anytime and each time new EVENT is Logged. now my question is :-

1) How do I fetch the no of times any users has updated the email on a particular Day?

2) How will I get any user updated Email content for any particular data/time ?

3) How to fetch the day/time when any particular user has updated his email from a@gmail.com to b@gmail.com

Now I need to get these details using the EVENT_STORE , means how can i query directly to the event_store ?
Currently we are maintaing the current state through EventSourceView in memory, that is the current updated details for the email ,
but my aim is to get the history for a particular event (like updated Emails).

I have searched a lot on net but didnt get any solution , also on one of the ticket ' RBMHTechnology/eventuate#88 '
it is mentioned that it not possible using the eventuate to query and fetch directly from event_soure.

So the only solution I am thinking is I need to maintain all the possible state for the particular event in memory which is not fesible in any case.

Please suggest if there is any way to overcome this problem ,
Waiting for any early positive reply , Thanks in advance

Martin Grotzke
@magro
Sep 30 2016 08:19
@knoldernarayan I see two possible solutions:
  1. If the number of users is "small" (so that event log replay is fast enough): for each query create a new EventsourcedView and pass the desired event filter / aggregation / query on construction, so the the EV can compute the query result - it would provide the possibility to GetResults via a message. The EV would be stopped afterwards.
  2. For more users (if event log replay is not fast enough): Use a query database, e.g. a search engine. For the given example you could store documents with type=EmailUpdated, from, to, updated_at. This should allow to perform the given queries. The schema of course bould be more general (in case of solr you could use dynamic fields to support different types of events you want to query). You'd populate the query database via an EventsourcedWriter.
Piyush Rana
@piyushknoldus
Sep 30 2016 08:30
Hi @knoldernarayan @magro , I have many users , so if I got it correctly and follow your 2nd approach , then isn't it similar to storing the data in eternal DB say Cassandra and then querying it , instead it doing with EventsourcedWriter .
Narayan Kumar
@knoldernarayan
Sep 30 2016 08:30
@magro thanks for quick reply
Piyush Rana
@piyushknoldus
Sep 30 2016 08:41
@magro @krasserm Also I have one doubt , if we use EventsourcedWriter to log into external Cassandra DB , then to retrieve the results we have to write separate CQL queries , as I think Eventuate dosen't provide any EventsourcedReader or any such thing .
Martin Krasser
@krasserm
Sep 30 2016 09:31

Also I have one doubt , if we use EventsourcedWriter to log into external Cassandra DB , then to retrieve the results we have to write separate CQL queries , as I think Eventuate dosen't provide any EventsourcedReader or any such thing

An EventsourcedWriter reads a the event history and creates application-specific current state. What would you expect from an EventsourcedReaderto do?

Piyush Rana
@piyushknoldus
Sep 30 2016 09:53
This message was deleted
Piyush Rana
@piyushknoldus
Sep 30 2016 09:58
hi @krasserm Actually I was having a discussion with @magro please find the below link https://gitter.im/RBMHTechnology/eventuate?at=57ee1ff9b0ff456d3ad2870e and Have asked the question i.e I have many users , so if I got it correctly and follow your 2nd approach , then isn't it similar to storing the data in eternal DB say Cassandra and then querying it , instead it doing with EventsourcedWriter .
and one of mine teammate have asked the below question , please find the link :- https://gitter.im/RBMHTechnology/eventuate?at=57ee09edb0ff456d3ad23e44
Martin Grotzke
@magro
Sep 30 2016 10:05
When you store data in Cassandra you must design your schema after your queries. So for the 3 queries that were sketched above one might end up with 3 different column families / tables. It depends on your domain, the requirements, stability of requirements etc. if Cassandra is a good solution. Because a search engine provides more flexibility I mentioned this as an example. Of course there are other tools that allow to do ad-hoc queries like good old relational databases, mongodb etc.
Regarding the "EventsourcedReader" - perhaps this goes a bit into the direction of option 1) that I mentioned: for each query pull up an EventsourcedView that's "configured" with some kind of query/aggregation "strategy" during construction, that the EV can then apply during event replay to build the query specific view on the events. Such an EV would only exist for the lifetime of the query, afterwards it would be destroyed.
Or just build an EV per query...
Martin Krasser
@krasserm
Sep 30 2016 10:15
Looks like a use case for the upcoming Akka Streams adapter. No docs yet, just some initial tests. Should be ready and in master in a few weeks I hope ...
Piyush Rana
@piyushknoldus
Sep 30 2016 10:30
Thanks @krasserm @magro , Just one last question , I just want to confirm that can I directly query from Event Store logs that we persists during onCommand Event ?
Martin Krasser
@krasserm
Sep 30 2016 10:46
The storage schema in Cassandra is not part of the public API, so the answer is no. Anyway, you wouldn't get more information out of it than with EventsourcedView/Writer/... etc. What advantage do you see reading directly from Cassandra?
Martin Grotzke
@magro
Sep 30 2016 11:31
@krasserm I just had a quick look at the streams adapter (tests), looks really nice, cool!!
Martin Krasser
@krasserm
Sep 30 2016 12:56
@magro thanks, that's just the beginning. So far, I mainly focused on event processing with custom Flows without exposing DurableEvent metadata to the user. But Flow input and output must be related to these metadata in order to preserve causality. More on that later in the user documentation.
Martin Grotzke
@magro
Sep 30 2016 20:29
:+1: