Can't make fromCategory to work

I created a couple of projections for my event category “Customer”.

Events look like this:

No: 0@Customer-7f277da66052496d9d236b6d6c36ec85
Type: TryingASandNS.CustomerCreated
Data:
{
“CustomerName”: “qweqweqwe”,
“Id”: “7f277da6-6052-496d-9d23-6b6d6c36ec85”
}

One is:

fromCategory(‘Customer’)
.foreachStream()
.whenAny(function(state, ev) {
linkTo(‘CustomerEvents’, ev)
})

CustomerEvents stream is not being created

Another one has some state:

fromCategory(‘Customer’)
.foreachStream()
.when({
$init: function(){
return {number: 0};
},
$any: function(state, ev){
linkTo(‘mynewstream’, ev);
return {number: state.number};
}
});

I always get

A concurrency violation was detected, but the projection is not running.
Current state is: CompletingPhase. The reason for the restart is: ‘Checkpoint stream has been written to from the outside’

Basically I tried many samples about projections with state and all of them produce this exception.

I am running 3.2.1.0 (release-v3.2.1/7994e0fec6b2dc6740dfb54cbf3139e98c3fc592, Wed, 9 Sep 2015 19:11:22 +0200)

Do you have the internal category projection running?

Right, it was stopped indeed. Thanks.

Still, in many cases on one-time projections I get this error
A concurrency violation was detected, but the projection is not running.
Current state is: CompletingPhase. The reason for the restart is: ‘Checkpoint stream has been written to from the outside’

Also, on a one-time projection
fromAll()
.whenAny(function(state, ev){
linkTo(“testAll”, ev);
})

I get this:
Multiple projections emitting to the same stream detected. Stream: ‘testAll’. Last event projection: ‘8’. Emitting projection: ‘61’

Randomly, I can start it and it completes.

It seems you have multiple things writing to the same stream.

No, I don’t. Currently I have all default projections, from which only $by_category is running, one projection called Customers that links Customer category to CustomerEvents stream, and one TestAll projection that links all events to testAll stream.
When I am trying to enable testAll, I get this
Multiple projections emitting to the same stream detected. Stream: ‘testAll’. Last event projection: ‘8’. Emitting projection: ‘61’

What’s in the testall stream?

Auto Generated Inline Image 1.png

Hm, it looks like infinite loop

Is there anything in your testall stream? If so that’s multiple things emitting to the same stream do you get an issue of stream “foo5364”?

Also I’m really not sure what this projection is intended to do. It seems to do the same as category projection but in odd ways.

Auto Generated Inline Image 1.png

I had no plans to have any attention to that particular stream, I just found it strange to receive projections errors that I never have seen before.

Apparently, the category projection started to work now, thanks for the tip about $by_category.

Regards,
Alexey

Also look at $ce-yourcategory stream it does the same as your projection

Nice, I didn’t know about them. Thanks.