Passing long input/output parameters via BPMN

Hi there, we do have a requirement to store long values as part of BPMN. In order to workaround the limitation of string’s 4K restriction, we decided to go with JSON. Now, the only way to pass JSON object I could find so far is the following:

<camunda:inputParameter name="longEntry">
   <camunda:script scriptFormat="groovy">S('{"longentry": "some_very_long_value_exceed_4k"}')</camunda:script>
</camunda:inputParameter>

this required to setup spin extension, but at least both groove and javascript script formats work well. But our main issue right now is that parameter value is mixed with some code (i.e. S function) which makes the whole setup be fragile. I am looking for any other way to pass such long variables? The ideal would be something like this:

<camunda:inputParameter name="longEntry">
   <camunda:script scriptFormat="groovy">{"longentry": "some_very_long_value_exceed_4k"}</camunda:script>
</camunda:inputParameter>

i.e. just pass the JSON.

Basically 2 questions,

  1. Is there any other way to set long variables via BPMN?
  2. Is there any “clear” way to set JSON/XML without involving custom functions?

Is using Java Delaget or execution listener out of the question?

@JussiL How would java delegate solve the issue? I mean if one defines long var in input param of BPMN, this will cause camunda to store it in DB, which once again raises value too long exception.

@vicmosin Could you elaborate ypur problem a bit.

With sample process or something. I do not understand how the long variable will be created in the first place in the process.

As I wrote in my question, the long variables are set via BPMN directly… You can find example attached. As you see, I have to use S function to compose the complex object, otherwise, if I used stringified representation of the JSON, it would fail with value too long exception. test.bpmn (31.2 KB)

So basicly they are hard coded values, or are they user input?

From camunda perspective, it’s harcoded value

Well if it is hardcoded, and you don’t want to include the S function, you could just write a Java delegate that creates the Json and stores it into a process variable.

@JussiL just to make it clear, the idea is to have some custom delegate code which will accept the stringified JSON and will save it as complex object (BLOB), instead of setting it manually in BPMN. Is this right?

If you are already have it as JSON I do not undertand why you need to convert it in the first place. If it is a String Object, I think you will be in trouble, as it will remain a string in history even if you convert it.

Ok, let me ask differently… Assuming we have the BPMN (see attached one), how can I make sure it won’t fail with 4K restriction?test2.bpmn (31.1 KB)

3 ways I have used and should work (provided that you are not bringing the input in as a string):

  1. use S function (as you did)
  2. Create A Java delegate that creates your entry
  3. Use a script task with {“longentry”: long_text_here} as script and suitable variable name.

@JussiL thank you