Is there a best-practice
for transferring files (>1mb)?
Does this sound like a reasonable design strategy?
...
byte[] payload = new byte[1048576]; // 1mb
while ((read = ios.read(payload)) != -1) {
FileMessage fm = new FileMessage();
fm._payload = payload;
fm._fileName = fileName;
if (ios.available() > 0) {
fm._isEof = false;
} else {
fm._isEof = true;
}
sc.publish(subject, serialize(fm), acb);
}
...
The
alternative is to generate a protocol with google protobuf and then send over
nats.
All the examples I have seen in the unit tests and documentation are just sending small text messages.