Right now, I’m working on a very basic document management service, based on Axon Framework/Server 4.1
For that I created Commands/Events that among other attributes contain a string that will contain Base64 encoded binary data (which could be quite large).
When I create a bunch of commands that create documents, I recieve weird exceptions like: “io.netty.handler.codec.http2.Http2Exception$StreamException: Received DATA frame for an unknown stream 14255.”
My guess is that there is some kind of memory issue with heavy load…
Is it a reasonable aproach (or nonsense?) to handle Base64 encoded data that way?
from a design perspective: why would it be necessary to put the
document itself in the event - if I understood you correctly? Wouldn't
it be more feasible to just store a reference to the document (e.g. a
URL) to keep the events rather small?
not sure where the exceptions comes from. GRPC has a max message size, which you might have exceeded in this case.
Anyway, I heavily recommend against putting large data objects in events. In my first Axon project (now about 9 years ago), we went for the approach Michael just described. We made the operation idempotent by using the sha1 hash as the document key. I never had any regret going that route.
A nice side-effect is that you prevent storing the document in (at least) 2 places (event and read models).