April 2020
Intermediate to advanced
292 pages
6h 50m
English
You’ve already built the machinery for capturing user registration—we just haven’t done anything with the events. Now you’ll build an Aggregator to turn those Registered events into View Data you can use for authentication. Its job is to turn Registered events into a queryable table.
Let’s start with the top-level function:
| | function build ({ db, messageStore }) { |
| | const queries = createQueries({ db }) |
| | const handlers = createHandlers({ queries }) |
| | const subscription = messageStore.createSubscription({ |
| | streamName: 'identity', |
| | handlers, |
| | subscriberId: 'aggregators:user-credentials' |
| | }) |
| | |
| | function start () { |
| | subscription.start() |
| | } |
| | |
| |
Read now
Unlock full access