I receive big payload via REST API. Then I send command via command gateway and in aggregate I hadle the command and publish an event which trigers a saga which processes the payload from REST API.
The problem is that the payload received from REST API is strored with the event which I want to avoid. Could you please suggest how to run the saga without polluting the event store with the payload from REST API?
everything really depends on what you’re trying to achieve. Is the rest call big because of data not (yet) needed, or does it contain large binary data?
In the latter case, we recommend storing the binary data somewhere first, and just including a reference to the data in the event. Handler can then retrieve the data using this reference.
If you have data in your rest payload that is needed at some later time, perhaps the Saga is not the best solution to your problem. Sometimes, a process is easier to be implemented as a “procedure” of commands being sent as a result of the previous command’s success.