Cheers Greg, it’s still not working for me though.
I tried creating an entirely new database. Then I pumped some events into an index called people. Each event had a name: Greg, Jimmy, Sarah.
I then ran the initial projection to create a stream per-name using:
fromStream(‘people’)
.whenAny(function(state, evnt) {
linkTo(‘person-’ + evnt.data.Name, evnt);
});
As before, this works perfectly. I can now see the streams: test-Greg, test-Jimmy and test-Sarah. I ran this is a “one-time” projection with all the boxes ticked.
Then I took the query you gave me and made a new projection:
fromCategory(‘people’)
.foreachStream()
.when({
$init : function(s,e) {return {count : 0}},
$any : function(s,e) { s.count += 1} //mutate in place works
});
I ran this in the same way: one-time only with all the boxes ticked. But again, when I navigate to the state URLs:
I just get a blank response in the browser.
The projection shows this which looks intriguing:
Events/sec:Buffered events:0Events processed:0Partitions cached:2Reads in-progress:0Writes in-progress:0Write queue:0Write queue (chkp):0Checkpoint status:Position:$ce-people: -1Last checkpoint:$ce-people: -1
In the console I see:
[04836,14,19:22:33.868] SLOW BUS MSG [bus]: CreateAndPrepare - 81ms. Handler: ProjectionCoreService.
[04836,14,19:22:33.868] SLOW QUEUE MSG [Projection Core #2]: CreateAndPrepare - 81ms. Q: 0/0.
[04836,11,19:22:33.875] ‘StreamPerPerson’ projection source has been written
[04836,14,19:22:33.875] Creating an event distribution point at ‘people: -1’
[04836,14,19:22:33.875] The ‘96201dab-39e0-478a-981d-852c6d5a0827’ projection subscribed to the ‘490a34d5-dc89-49f7-92b5
-ca3a5e6cf4b5’ distribution point
[04836,14,19:22:33.954] The ‘96201dab-39e0-478a-981d-852c6d5a0827’ subscription has unsubscribed (reader: 490a34d5-dc89-
49f7-92b5-ca3a5e6cf4b5)
[04836,14,19:22:34.283] Writing checkpoint for StreamPerPerson at people: 5 with expected version number -1
[04836,14,19:22:34.541] Checkpoint has be written for projection StreamPerPerson at sequence number 0 (current)
{“allStreams”:false,“allEvents”:true,“byStreams”:true,“byCustomPartitions”:false,“categories”:[“people”],“streams”:[],“e
vents”:[],“definesStateTransform”:false,“options”:{“resultStreamName”:null,“partitionResultStreamNamePattern”:null,"$for
ceProjectionName":null,"$includeLinks":false,“reorderEvents”:false,“processingLag”:0}}
Category people requested
All events requested
[04836,11,19:23:42.420] ‘streamPerPersonCounts’ projection source has been written
[04836,12,19:23:42.420] Creating an event distribution point at ‘$ce-people: -1’
[04836,12,19:23:42.420] The ‘dee1e4d3-34cd-4138-94f2-877917b67997’ projection subscribed to the ‘3abaa5fd-78aa-42d9-af05
-56b5da2aa4c9’ distribution point
[04836,12,19:23:42.420] The ‘dee1e4d3-34cd-4138-94f2-877917b67997’ subscription has unsubscribed (reader: 3abaa5fd-78aa-
42d9-af05-56b5da2aa4c9)
All this is happening on Windows 8, using version 2.0.1 for .NET.
It’s probably something stupid that I’ve missed, but I would be super-grateful if anyone can help me. Even if you make me look stupid it’s still a win.