Can't get counts for streams working user per-stream projections

not atm

Ok, I have an update on this.

Here’s the query I am running:

fromCategory(categoryName)
.foreachStream()
.when({
$init : function(s,e) {return {count : 0}},
$any : function(s,e) { s.count += 1} //mutate in place works
});

If I run this on the “Query” tab, I get results containing the count of each stream - perfect.

Here’s the bad news:

  1. If I create a new projection with this code as one-time with all the boxes checked - nothing. The “buffered events” number just keeps increasing, while the “events processed” value does not change. When I navigate to the “state” resource, nothing there either. The projection just stays in the “running” state

  2. If I create the same projection, but with “continuous”, then it completes. The number of events processed also looks reasonable. But when I navigate to the “state” resource, with or without a valid “partition” parameter value, I get a 408 response - unable to respond in time.

Any thoughts?

  1. When I run as “one-time” but don’t check the other boxes (except enabled) it completes instantly, but with 1 “events processed”. However, when navigating to the state resource I get the 408 again.

  2. When I run as “continuous” with all boxes checked except “emit enabled” it completes instantly. When I request the state resource, with or without a partition I actually get a 200 response. But it’s empty.

Sorry if I am doing something stupid.

Ahhh, I have it working.

So in my comments above, when I was getting a 200 response back it was actually working. When I was specifying a “partition” I was emitting the category. For instance:

partition=Greg <— bad

partion=person-Greg <— good

To be fair, I was working against Rob Ashton’s examples here: http://codeofrob.com/entries/creating-a-projection-per-stream-in-the-eventstore.html which are quite old. I’m guessing that omitting the category prefix is obsolete in V3?

yes to be fair this is part of why we are keeping projections in beta as we are making internal changes on such apis. Soon these apis will be supported. We dont want to break too many people along the way

All sounds reasonable. I’m sure projections are going to be a killer feature.