snowplow-incubator / sauna

:hotsprings: A decisioning and response platform
https://github.com/snowplow/sauna/wiki
69 stars 11 forks source link

Add ObserverEvent #75

Open chuwy opened 7 years ago

chuwy commented 7 years ago
  1. ObserverBatchEvent has to be called ObserverFileEvent, it's core application is file events, therefore it has path property. It could be "file was uploaded to S3/localFs" (for s3 and localFs responders). I don't think path is applicable for kinesis observer, which emits chunks of JSON. Therefore we need to introduce new kind of observer events, like ObserverCommandEvent.
  2. It means that we can introduce another (root) level of trait hierarchy - ObserverEvent (without "Batch"), which can be superclass of ObserverBatchEvent and ObserverCommandEvent.
  3. I think that @fingercos's Kinesis implementation should work with ObserverCommandEvent, not batch one. Notice, that it doesn't use path anywhere. It also doesn't make sense to use Option for streamContent, as we already have whole data (but file can be missing). So my point is that command and batch observer events are different.

This can be achieved with just few lines of code: ResponderEvent needs to be parametrized with ObserverEvent instead of ObserverBatchEvent and same for Responder.

/cc @alexanderdean @rzats