Hi,
I’m doing some analytics on a mobile app. Currently I’m processing how many times a user has entered into a screen inside the app. But the problem is that the system is partitioned by clientId at the highest level. So to achieve multi tenancy currently I’m ending all my streams with ‘-{clientId}’.
So let’s say I have following event format for VisitedScreen event in stream ‘analytics-1’:
{
“name”: “VisitedScreen”,
“screenName”: “Newsfeed”,
“year”: 2016,
“month”: 10
}
The 1 in anaylitics-1 is the clientId.
and I partition this by year.
fromCategory(‘analytics’)
.foreachStream()
.when({
“VisitedScreen”: function(state, ev) { linkTo(‘analytics_year-’+ev.body.year+’-1’, ev); }
});
This succesfully creates a new stream as expected, but the clientId inside the function is hardcoded. How can I get the cliendId (the partition) from within the function, or am I going about this completely wrong.
Regards