onyx

FYI: alternative Onyx :onyx: chat is at <https://gitter.im/onyx-platform/onyx> ; log can be found at <https://clojurians-log.clojureverse.org/onyx/index.html>
2019-03-05T08:01:20.016400Z

Hi @lmergen, and thanks for your reply No not deduplication, actually each stream contains different info but that info may be about the same thing I am getting stock market info from different sources (scrapping some, receiving others from rabbitmq, others comming from different source through tcp socket, etc) And the system is supposed to compute some financial indicators (that may need data from these different sources)

2019-03-05T08:02:19.018Z

I wanted to merge related segments from different sources and then send them down stream

2019-03-05T08:02:46.018900Z

that's a lot easier 🙂

2019-03-05T08:03:04.019300Z

:)) Yeah What I intend to do is use state management and triggers

2019-03-05T08:03:26.019900Z

Dunno if that’s the right way, though

2019-03-05T08:04:04.020600Z

so just for my understanding, say you get event X from stream A, you want to find related event X' from stream B and send those downstream ?

2019-03-05T08:04:19.020800Z

Yeah

2019-03-05T08:04:55.021600Z

and if no related events are found, none are send downstream ?

2019-03-05T08:05:22.022200Z

Yes

2019-03-05T08:05:55.022800Z

sounds almost like a kind of windowing

2019-03-05T08:06:05.023100Z

where you cache all events in the window

2019-03-05T08:06:50.025100Z

Yeah, so that is the appropriate way, then ?

2019-03-05T08:08:51.028500Z

well maybe you can model it as just an aggregate as well

2019-03-05T08:09:03.029200Z

depends on your time window an exact requirements

2019-03-05T08:09:27.030300Z

but what i would do is use onyx' :aggregation keys

2019-03-05T08:09:37.030700Z

Hmm ... what did you mean by aggregarate (am I missin something) ?

2019-03-05T08:09:41.031Z

i think this example code might be of use for your case: https://github.com/lbradstreet/onyx-reducers/blob/master/src/onyx_reducers/deduplicate.clj

2019-03-05T08:09:53.031500Z

Hmmm thanks alot @lmergen

2019-03-05T08:10:04.031900Z

well it's actually more like a reducer, that emits events only when it was found before

đź‘Ť 1
2019-03-05T08:10:54.033300Z

About the trigger + window solution I have another problem : But trigger/pred doesn’t appear to be getting the segment How am I supposed to decide when to send the event down stream ?

2019-03-05T08:12:06.034600Z

yeah i think a window might not be the best abstraction here, because it only allows you to flush down the entire window state (i think, i do not have extensive experience with onyx + windows)

2019-03-05T08:12:48.035400Z

the reduction/aggregation as seen in the code sample above is better, because it allows you to separate the state (seen events) from what you want to emit (similar events that have been seen before)

2019-03-05T08:14:08.036100Z

Thanks a lot Will check it right away

roland 2019-03-05T18:51:01.036600Z

I'd use a session window, triggering on segment count = 2

roland 2019-03-05T18:51:53.037500Z

We had a similar problem but we needed to send downstream even if some sources were missing and we used session window + time gap trigger