Lifetime File Variable


#1

Good day everyone,

I am about to create an Application which will recive Messages from a third party System.
These Messages will be Files which I will be Adding as a Variable to the Process.
The Files can be of serveral hundred MB.

I use the standard Camunda in Version 7.11.

The question is, how long do these Variables live in the h2 database for example when I overwrite them?
Are therse Files stored in the RAM of my machine?

Basically I want to know more about how somewhat big Files are handled by Camunda, if someone could point me to documentation regarding this topic I would be very glad. My own research was not very successful.

Best Regards.


#2

Basically in camunda, The type file can be used to store the contents of a file or input stream along with metadata such as a file name, an encoding, and the MIME type the file contents correspond to.

Files can be persisted as BLOBs in the database. The file value type allows to store additional metadata such as a file name and a mime type along with it.

FileValue typedFileValue = Variables
  .fileValue("addresses.txt")
  .file(new File("path/to/the/file.txt"))
  .mimeType("text/plain")
  .encoding("UTF-8")
  .create();
runtimeService.setVariable(execution.getId(), "fileVariable", typedFileValue);

FileValue retrievedTypedFileValue = runtimeService.getVariableTyped(execution.getId(), "fileVariable");
InputStream fileContent = retrievedTypedFileValue.getValue(); // a byte stream of the file contents
String fileName = retrievedTypedFileValue.getFilename(); // equals "addresses.txt"
String mimeType = retrievedTypedFileValue.getMimeType(); // equals "text/plain"
String encoding = retrievedTypedFileValue.getEncoding(); // equals "UTF-8"

Refer this post regarding file storage:

https://blog.camunda.com/post/2016/11/ecm-box-with-camunda/


#3

Just as a point of additional information. You really should not store large files in camunda. you should have camunda share a reference to a dedicated file storage system.