Hi,
We have a situation where we have a very low traffic endpoint (few transaction per day) where people can post new versions of some data. The endpoint accepts the data and calculates a new version number (to prevent users from accidentally miscalculating the version number incorrectly) which it will return to the user. The backend behind this API we want to make event sourced (there is a requirement to output an event to say that a new version of this resource has been created and having the events be the source of truth here makes this easier), but we would rather not enforce all clients to post to the API then eventually receive the event to say that the update has been done (as this complicates the usage patterns for all clients) but would rather have client be able to call to POST and get the new version number back.
To solve this we have been considering a pattern where when the API controller recieves the POST call it sends a command to do the actual update, then subscribes to the stream where the event will be created, When the event arrives it reads the version number, and returns this t the client. Obviously some timeout needs to exist etc.
Is this a reasonable solution? Is there a better way to handle this situation?
Cheers
Sam