Lab 6: Event sourcing using event log
Show how to use the Open Content event log
In this exercise you will start a script which will poll the Open Content event log every 5th second. If any events are found the script will print information of the event.
The script will persist the last event to a file (lastevent
) which holds the last event id processed by the script. When started next time and lastevent
file exists the script will start processing events with id larger than the lastevent
processed . This means that even if the listener is off. It will continue from last event next time the listener is started. This way no event is missed.
This is how to get the /eventlog/
endpoint response:
Response
Get the last event id use event=-1
In folder 6-event-sourcing
is an example of a bash script which will poll the event log every 5 seconds and print information about what is happening. To try this :
Now the script polls the event log every 5 second and print out the events.
Last updated