So i am new to EventStore and events CQRS basically.
I am confused on how to use projections do some math and send a http request to a 3rd party api with updated values.
If i understood it right, basically projection lets me do calculations, change the state to updated values and emit the output of new state.
The new output will be into a different stream so another app is already listening to the stream where it will do 3rd party api calls or update local db.
Please let me know if i understood this correctly.
Secondly, how can i obtain the previous state + current state? For example, i am working on a project where i need last hour results and i need to do some calculations to last hour to make current results.
How should i get the last hour results? I assume, it will be set in initial state? If so, how do i pull the initial state from database?
I am confused on how to achieve this, any help would be really appreciated.
Thank you