1 Reply Latest reply on Dec 1, 2014 1:57 AM by Maciej Swiderski

    Problem with getting objects data from signal

    Tomasz Jastrzębski Newbie

      Hi 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]':

      NameValueType
      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:

      NameValueType
      startEventExample event textcom.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

        • 1. Re: Problem with getting objects data from signal
          Maciej Swiderski Master

          it might be because of xml marshaling so please double check if it JAXB friendly as it might not be able to understand they data that comes in. Another point to check is to make sure JAXBContext on server side is aware of your classes. If that class is not part of your project then it won't be added to JAXBContext by default. If it's maven dependency but not as kjar then it won't add it either.

          To overcome this limitation (already fixed in 6.2) you can use kie remote client that allows you to add extra classes to jaxb on demand.

           

          HTH