Fork me on GitHub
#onyx
<
2017-05-01
>
lmergen15:05:23

when storing aggregates to an outside store (say, redis), are there any tools onyx provides to ensure idempotence for this ?

lmergen15:05:29

for example, i’m keeping track of an ever-increasing counter, and my trigger is set to discarding — what would be the best way to ensure consistency (assuming the data store is able to do transactions) ?

lmergen15:05:42

i think that’s what i’m talking about

lmergen15:05:32

i probably need to implement some additional mechanism on top of onyx to achieve this, eh ? or does onyx provide some tricks internally to achieve this (e.g. inspecting any of the maps that are provided to the trigger/emit / trigger/sync functions)

lmergen15:05:26

i’m probably approaching this at the wrong angle, though… another approach might be CQRS-like snapshotting and onyx resume points 🙂

lmergen16:05:51

ah, i think i’ve figured this out mentally by now — i think i should treat the last event id as the ‘version’ of the aggregate, and use that as a way to achieve consistency — if i ever need to rebuild the aggregates, i can seek towards that event id

lmergen16:05:24

my thinking problem was that i was treating the aggregates as a source of truth, while in fact they are a proxy of the truth

michaeldrogalis16:05:39

@lmergen Nice conclusion. 🙂

michaeldrogalis16:05:25

Onyx can’t do much for you at the edges when you start talking to external storage provides as far as idemotency goes. Some design work is needed there - you’re on the right path. 😄

lmergen16:05:37

yeah, i believe i read something about this in one of greg young’s documents

michaeldrogalis16:05:30

He writes quality material.

lmergen17:05:30

hmmm, i’m almost thinking this might be related to ABS…

lmergen17:05:27

or rather, i might want to use some data of ABS to use the same barrier/epoch for my aggregate versions

michaeldrogalis17:05:19

@anujsays Case-2 would attempt to put a function in an Onyx job. Jobs are strictly data.

michaeldrogalis17:05:59

We do it for concision, at any rate. Most real use cases of lifecycles have chains of calls that are a bit pointless to respecify every time.

anujsays17:05:44

Ok, I understand now. Thanks @michaeldrogalis

lucasbradstreet18:05:18

@lmergen If you write an output plugin you can actually be told the current replica version and barrier epoch

lucasbradstreet18:05:42

and when it needs to recover, it’ll restore to a particular replica version and epoch, so you can determine whether any data is out of date at that point

michaeldrogalis22:05:48

We just landed a patch in master that extends the public API to optionally receive a persistent Onyx client, rather than resconstructing one from scratch on each call: https://github.com/onyx-platform/onyx/pull/764

michaeldrogalis22:05:06

This enables rapid, successive calls to submit-job, kill-job, etc.