Hey guys,
I’m working on writing a projection to monitor a stream and then emit a new event to a different already existing stream. The projection works emitting the event to streams that do not already exist, but not for ones created elsewhere.
Here’s my projection:
fromAll()
.when({
“ItemAddedToShipment”: function(s, e) {
var myStreamName = “customsshipmentitem-” + e.data.tenantId + “-” + e.data.shipmentItemId;
var streamToEmitTo = “customsitem-” + e.data.tenantId + “-” + e.data.orderItemId;
emit(streamToEmitTo, “EventLinksRequested”, {
shipmentItemStreamName: myStreamName
});
}
});
It seems that eventstore is getting hung up trying to write these events, because the write queue stays high and the logs show that a System.Exception is being thrown:
[25932,20,20:48:42.378] ‘TestingEmit’ projection source has been written
[25932,20,20:48:42.378] PROJECTIONS: Scheduling the writing of $start to $projections-$c66d10a1-609f-4175-b368-420153a1dd16. Current status of Writer: Busy: False
[25932,20,20:48:42.378] PROJECTIONS: Finished writing events to $projections-$c66d10a1609f4175b368420153a1dd16: $start
[25932,22,20:48:42.378] PROJECTIONS: Command received: 753@$start
[25932,22,20:48:42.378] PROJECTIONS: Scheduling the writing of $started to $projections-$master. Current status of Writer: Busy: True
[25932,22,20:48:42.393] Error while processing message EventStore.Core.Messages.ClientMessage+ReadStreamEventsBackwardCompleted in queued handler ‘Projection Core #1’.
Exception of type ‘System.Exception’ was thrown.
[25932,22,20:48:42.393] Error while processing message EventStore.Core.Messages.ClientMessage+ReadStreamEventsBackwardCompleted in queued handler ‘Projection Core #1’.
Exception of type ‘System.Exception’ was thrown.
[25932,22,20:48:42.393] Error while processing message EventStore.Core.Messages.ClientMessage+ReadStreamEventsBackwardCompleted in queued handler ‘Projection Core #1’.
Exception of type ‘System.Exception’ was thrown.
[25932,22,20:48:42.393] Error while processing message EventStore.Core.Messages.ClientMessage+ReadStreamEventsBackwardCompleted in queued handler ‘Projection Core #1’.
Exception of type ‘System.Exception’ was thrown.
[25932,22,20:48:42.411] PROJECTIONS: Finished writing events to $projections-$master: $started
[25932,20,20:48:42.431] PROJECTIONS: Response received: 7034@$started
[25932,13,20:48:46.252] SLOW QUEUE MSG [StorageWriterQueue]: WritePrepares - 666ms. Q: 0/0.
[25932,13,20:48:51.723] SLOW QUEUE MSG [StorageWriterQueue]: WritePrepares - 1296ms. Q: 0/0.
[25932,13,20:48:56.579] SLOW QUEUE MSG [StorageWriterQueue]: WritePrepares - 651ms. Q: 0/0.
[25932,13,20:49:01.365] SLOW QUEUE MSG [StorageWriterQueue]: WritePrepares - 638ms. Q: 0/0.
[25932,13,20:49:06.181] SLOW QUEUE MSG [StorageWriterQueue]: WritePrepares - 656ms. Q: 0/0.
[25932,13,20:49:16.561] SLOW QUEUE MSG [StorageWriterQueue]: WritePrepares - 656ms. Q: 0/0.
[25932,13,20:49:22.251] SLOW QUEUE MSG [StorageWriterQueue]: WritePrepares - 603ms. Q: 0/0.
[25932,13,20:49:31.870] SLOW QUEUE MSG [StorageWriterQueue]: WritePrepares - 649ms. Q: 0/0.
[25932,13,20:49:37.295] SLOW QUEUE MSG [StorageWriterQueue]: WritePrepares - 643ms. Q: 0/0.
[25932,13,20:49:47.306] SLOW QUEUE MSG [StorageWriterQueue]: WritePrepares - 650ms. Q: 0/0.
[25932,13,20:49:57.323] SLOW QUEUE MSG [StorageWriterQueue]: WritePrepares - 676ms. Q: 0/0.
I assume it has something to do with the state of the streams that I am attempting to write to. But I’m not sure what.