Projection fails when selecting events from streams with maxAge set

Regarding EventStore

My continuous projection code looks like this:

fromStreams(‘CC1-teservice-1’, ‘CC1-teservice-2’).when({‘te-status’ : function(s, e) {linkTo(‘teccapi-apa5-stream’, e);}})

This works fine as long as the events in the input streams (‘CC1-teservice-1’, ‘CC1-teservice-2’) persists for ever.

The problem occurs when I set the maxAge on the input streams to any value that causes old events to be deleted from the streams.

The EvetStore logs then says:

[PID:09264:017 2017.06.07 14:56:23.874 INFO ProjectionManager ] ‘TestAPA5’ projection source has been written
[PID:09264:017 2017.06.07 14:56:23.874 DEBUG MultiStreamMessageWr] PROJECTIONS: Scheduling the writing of $start to $projections-$74aa7753-ae1a-4c3c-87c6-1c2d7d0ea183. Current status of Writer: Busy: False
[PID:09264:017 2017.06.07 14:56:23.890 DEBUG MultiStreamMessageWr] PROJECTIONS: Finished writing events to $projections-$74aa7753ae1a4c3c87c61c2d7d0ea183: $start
[PID:09264:018 2017.06.07 14:56:23.890 DEBUG ProjectionCoreServic] PROJECTIONS: Command received: 121@$start
[PID:09264:018 2017.06.07 14:56:23.890 DEBUG ResponseWriter ] PROJECTIONS: Scheduling the writing of $started to $projections-$master. Current status of Writer: Busy: True
[PID:09264:018 2017.06.07 14:56:23.890 ERROR QueuedHandlerMRES ] Error while processing message EventStore.Projections.Core.Messaging.UnwrapEnvelopeMessage in queued handler ‘Projection Core #0’.
System.InvalidOperationException: Event number 0 was expected in the stream CC1-teservice-1, but event number 13 was received
at EventStore.Projections.Core.Services.Processing.MultiStreamEventReader.DeliverEvent(ResolvedEvent pair, Single progress)
at EventStore.Projections.Core.Services.Processing.MultiStreamEventReader.ProcessBuffers()
at EventStore.Projections.Core.Services.Processing.MultiStreamEventReader.Handle(ReadStreamEventsForwardCompleted message)
at EventStore.Core.Messaging.SendToThisEnvelope.ReplyWith[T](T message)
at EventStore.Core.Bus.MessageHandler`1.TryHandle(Message message)
at EventStore.Core.Bus.InMemoryBus.Publish(Message message)
at EventStore.Core.Bus.QueuedHandlerMRES.ReadFromQueue(Object o)

…and no event links will be added to the output stream (in this case ‘teccapi-apa5-stream’).

What is really strange is if I only select one (e.g. ‘CC1-teservice-1’) input stream in the fromStreams() the projection works fine without any errors.

Any help would be appreciated!



Would you mind raising this on the github repository here?

Hi Pieter

Of course. Should I create a new issue there?


Yes please.