Last active
December 5, 2019 09:15
-
-
Save srkiNZ84/a3834374a150ed8a73228e6ca444d455 to your computer and use it in GitHub Desktop.
Eventstore event generation script
This file contains hidden or 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
#!/bin/bash | |
sendToStream(){ | |
local EVENT_UUID=`uuidgen` | |
echo "Sending $1 event with shared ID $2" | |
AUTH="-u admin:changeit" | |
curl $AUTH -i -d "{\"type\":\"$1\", \"foo$1\":\"we did a $1 kind of thing.\",\"id\":\"$2\"}" "http://127.0.0.1:2113/streams/$1-$2" -H "Content-Type:application/json" -H "ES-EventType: $1-event" -H "ES-EventId: $EVENT_UUID" | |
echo "Curl return value $?" | |
} | |
SHARED_UUID=`uuidgen` | |
for i in {1..10} | |
do | |
echo "Unique ID to use for correlation is: $SHARED_UUID" | |
sendToStream a $SHARED_UUID | |
sendToStream b $SHARED_UUID | |
echo "#---------------------------#" | |
done | |
echo "Sending unifying C event" | |
sendToStream c $SHARED_UUID |
This file contains hidden or 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
fromAll() | |
.when({ | |
$init: function(){ | |
return { | |
fooa: "", | |
foob: "", | |
fooc: "" | |
} | |
}, | |
$any: function(s,e){ | |
log(JSON.stringify(e)); | |
if(e.body && e.body.fooa){ | |
s.fooa = e.body.fooa; | |
} else if (e.body && e.body.foob){ | |
s.foob = e.body.foob; | |
} else if (e.body && e.body.fooc){ | |
s.fooc = e.body.fooc; | |
} | |
if(s.fooa && s.foob && s.fooc){ | |
log("We have a full object!"); | |
} else { | |
log("Still missing some properties"); | |
} | |
} | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment