Hi,
Followup to my question yesterday, as I managed to figure out how to
enable correlation id projections with custom configuration. This was
basically a process of trial and error as the docs are, as pointed out
many times, in a really really bad state.
Step 1:
To enable projections add "RunProjections: System" to your EventStore
config file. This will enable support for system projections.
Step 2:
Upload your custom configuration to specify what field to use as
correlation id like this:
curl -i -X PUT --data-binary "@correlationid.json"
"http://localhost:2113/projection/%24by_correlation_id/query" -H
"accept:application/json" -u admin:changeit
correlationid.json is a JSON file which contains the config, in my case:
{"correlationIdProperty":"id"}
This refers to the "id" field in event metadata, no idea if it's
possible to use event data for this.
Step 3:
Enable the correlation id projection by doing this:
curl -i -X POST
"http://localhost:2113/projection/%24by_correlation_id/command/enable"
-H "accept:application/json" -H "Content-Length:0" -u admin:changeit
With these steps in place, if I import events that have the "id"
metadata field it would create streams that I can access with the
naming convention "$bc-someidgoeshere". All the events are links only,
so use resolveLinkTos:true to get the actual data.
This seems to have worked for me, but as above, just a case of trial
and error to figure out. Would love to see these kinds of things
actually documented, and with tutorials on the website. EventStore is
amazing, but hidden behind lack of docs on how to actually use it.
regards, Rickard