I’m currently trying a simple proof of concept using the http api to create some events manually and testing out a projection. I have previously managed to get projections working fine writing to streams using the .net client.
I’m currently using eventstore version 2.0.1.0
I am getting the error “A unstamped event found” when posting to the stream the projection is running over after it tries to emit an event. I’m having trouble finding any documentation explaining what this error means or how to resolve it.
The event it refers to is an event posted to the stream via the http api. I’m using postman and posting :
[
{
“eventId”: “abf4b1a1-b4a3-4dfe-a01f-ec52c34e16e4”,
“eventType”: “devicemonitored”,
“data”: {
“imei” : 123,
“occuredAt” : “2014-01-20 23:30:00Z”
}
}
]
``
The projection looks like this
fromCategory(‘devicetest1’)
.foreachStream()
.when({
$init : function () {
return { offair : false };
},
deviceinit : function (s,e)
{
s.initedOn = new Date(e.body.firstSeen);
return s;
},
heartbeat : function (s,e)
{
s.lastHeartbeat = new Date(e.body.occuredAt);
if(s.offair)
{
emit(e.streamId, ‘onair’, { imei : e.body.imei, occuredAt : s.lastHeartbeat}) ;
}
return s;
},
devicemonitored : function (s,e)
{
s.lastMonitored = new Date(e.body.occuredAt);
if(s.lastMonitored - s.lastHeartbeat > 262798250)
{
emit(e.streamId, ‘offair’, { imei : e.body.imei, occuredAt : new Date()});
}
return s;
},
offair : function(s,e)
{
s.offair = true;
s.lastOffair = new Date(e.body.occuredAt);
return s;
},
onair : function(s,e)
{
s.offair = false;
return s;
}
});
``
Thanks