Hi! I’m experimenting with event registry introduced in 6.5.0.
Everything so far for the moment - I can connect flowable with Kafka and initiate process then new event posted into Kafka.
But I have question - all samples I found has quite simple event payload - suitable for “flat” event data.
Lets imagine I have more complex event - there some variables - are JSON object itself. For example:
{“var1”:{“var2”:“value2”, “var3”:“value3”}}
How can I define event payload, so, whole var1 placed into process context? or, for example, only var2 placed into process context as String?
Thanks Joram for this answer
I just upgraded to version 6.6.0 - and i see there is a new json data type supported for variables.
I was able to extract the parts of my complex payload as separate json variables - but now i’m trying to figure out how i can use them (for example - how can i use such a variable in an expression in a gateway).
Are there any examples for this use i can look at as reference ?
Thanks a lot for all the support in this forum
Inbal
OK, actually I found how to map json in event registration (just to use json variable type). Everything is ok - JSON value passed from Kafka to Flowable Process.
Now same question as Inbal asked - how can I operate with this variable in task form (for example)? Any samples?
I managed to work with those json variables.
In the event definition - i set the variable with type = json.
Then in my flow built using Modeler - i could not set the variable as json - so i ended up saving the xml of the flow and editing it to define the variable as json as well.
And now i could use it easily.
e.g. my incoming json was
{“eventKey”:“newImportFileEvt”, “file”:{“key”:“abcd”, “type”:“csv”}}
So my variable called “file” with type = json holds {“key”:“abcd”, “type”:“csv”} and i managed to use this in expressions like file.key & file.type
Hope i’m doing it the right way … works for me
Inbal
Hi Inbal!
Can you share part of process definition?
My problem: I defined variable in eventRegistry definition (payload part) as json.
In Process Definition I also defined it as JSON <flowable:eventOutParameter xmlns:flowable="http://flowable.org/bpmn" source="event" sourceType="json" target="event"></flowable:eventOutParameter>
OK, partially answered to my question.
Varialbe with type “json” passed into ScriptTask not as JavaScript Object, but as " * com.fasterxml.jackson.databind.node.ObjectNode" object.
So,