Hi @VladimirTitov4 and @Christopher_Wu, how are you doing?
So, this is my take on the question, hope that helps to clarify a bit
First of all, if you are exceeding the (default) message size of 4MB, IMO, that indicates something is wrong with how you are using your messages.
For me, messages should be as small as possible and with a flat structure.
Having said that, to your problem of a file generation, I would solve it in a different way:
- First of all, it sounds like a Command and not a Query, since you are “requesting” something to be build
- Following this approach, you would have a component responsible to generate such a file (probably in an async way) and just notifies whoever is interested that the file is generated and available at x.y.z
- In that case, your event would only contain the location where to get the file from (it can be an url, an id or whatever that identify it but not the file itself)
- There are lots of good storage options for files (S3 for example) but messages are not one of them =)
- Another component could listen to that event and ‘populate’ a projection with id / filename / location / etc and a query could be made towards that projection to get the info from where the file is
- Something that we have seen a lot are notification services that will notify the user who requested the file that it is ready to be downloaded “clicking here”. You can send a popup, email or any kind of notification you see fit
That are some ideas of how I would tackle this problem and I hope it helps to shed some light on it!