Problem with getting objects data from signal
toja Nov 28, 2014 6:23 AMHi Everyone,
I have problem with getting object event data from start event signal. I defined (using jbpm-console) a process that is started by signal with data of ExampleEvent type.
In bussines process modelling tool I set in signal start event node's properties: SignalRef property as 'com.example.ExampleEvent', I added 'event' variable to DataOutput and I defined in process variableDefinitions 'startEvent' variable of type Object with custom type: com.example.ExampleEvent. In start node data output assigments I set that the 'event' variable should be mapped to 'startEvent' (event -> startEvent).
I also added com.example.ExampleEvent to process imports.
Event com.example.ExampleEvent was defined in external project and I added it as dependecy to the jbpm project. I can use ExampleEvent in jbpm scripts, so the class should be visible in the jbpm-project.
From external system I'm sending a signal to jbpm:
ExampleEvent event = new ExampleEvent(); event.setExampleField("data"); kieSession.signalEvent("com.example.ExampleEvent", event);
In jbpm new process instance is started (so I received a signal) but in process variables I see startEvent variable as '[event: null]':
Name | Value | Type |
---|---|---|
startEvent | [event: null] | com.example.ExampleEvent |
When I tried to execute event.getExampleField() in script task I got error so I'm unable to access to the data set in the sent event.
I noticed that when I'm sending basic String as event data everything works fine:
kieSession.signalEvent("com.example.ExampleEvent", "Example event text")
In process variables I see sent String as startEvent variable's value:
Name | Value | Type |
---|---|---|
startEvent | Example event text | com.example.ExampleEvent |
Any ideas how to deal with objects as signal data? Mayby, the ExampleEvent should be annotated or defined in a specific way or the ExampleEvent class should be extra defined in jbpm console? In my sample ExampleEvent extend simple DAO class and implements Serializable interface.
I would like to extract data from ExampleEvent in jbpm process and now I am unable to do this.
Thanks for help,
Tomek