-
-
Save briandonahue/08dcfacd49ba921e6af6 to your computer and use it in GitHub Desktop.
Projection test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// EditionSearchModel, | |
// NOTE: this sample projection immediately stops in one-time mode unless you have | |
// either event_type1 or event_type1 events in the store | |
options({ | |
reorderEvents: true, // enables event reordering in a multi-stream projection | |
// event reordering attempts to feed the projection with events in a | |
// their natural order | |
processingLag: 500, // processing lag in ms allowing event reordering to happen | |
}); | |
fromStreams( | |
'$et-EditionCreated', | |
'$et-EditionOfficePermissionsChanged', | |
'$et-EditionDescriptionUpdated', | |
'$et-EditionContactInfoChanged', | |
'$et-EditionDeactivated', | |
'$et-EditionDemographicInfoChanged', | |
'$et-PublicationCategoryChanged' | |
) | |
// fromStream('streamId') | fromStreams(['sream1', 'stream2']) | fromCategory('category') | |
//NOTE: fromCategory requires $by_category standard projection to be enabled | |
// .foreachStream() | .partitionBy(function(e) { return e.body.useId; }) | |
.when({ | |
$init: function () { | |
return { }; // initial state | |
}, | |
$any: function(s, e) { | |
linkTo('hercules.readmodel-EditionSearchModel', e); | |
return s; | |
}, | |
}) | |
// .filterBy(f)/transformBy(f) | |
// .outputTo(name[, namePattern]) // defines a name for the output stream | |
//NOTE: filterBy(), transformBy(), emit(), linkTo(), copyTo() require "emit enabled" (see checkbox below) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment