Could someone give me a quick explanation / code snippet for using $initShared in a projection?
I have checked the documentation, and had a quick Google but not found much.
I hoped it would created a shared state between many streams, but my testing suggests it’s not:
fromCategory(‘OrderAggregate’)
.foreachStream()
.when({
$initShared: function (s, e)
{
return {
count :0,
};
},
$any : function(s,e){
s.count++; //I was hoping only one count for all my OrderAggregate streams
}
})
``
Thanks in advance.