2 Replies Latest reply on Sep 12, 2011 4:27 AM by eaa

    Passing variables to signalEvent

    dondragon2

      I am using the following to trigger and event in my process:

       

      StatefulKnowledgeSession ksession = JPAKnowledgeService.newStatefulKnowledgeSession(kbase, null, env);

      ksession.signalEvent("wait4_signal_event", parameters);

       

      parameters is a Map<String,Object> that is created elsewhere.

       

      <intermediateCatchEvent id="wait4_signal" name="wait4_signal">

      <signalEventDefinition signalRef="wait4_signal_event"/>

      </intermediateCatchEvent>

       

      I realize that the parameters that is executed after the signal is sent is not what i passed int he signalEvent. It keeps using the values before the process reached the intermediateCatchEvent  in the flow. I saw from some examples that I can use dataOutput to pass a variable. but how can I do this for multiple variables. like those contain in the Map? Or, a different way to pass the variables instead of in a map?

        • 1. Re: Passing variables to signalEvent
          salaboy21

          You usually should send an object that will represent the event that you are signalling. I usually send something more representative like an object that represent the event and in the case that you need to send a map of parameter you should create an object to wrap that map and add more semantic meaning to the event. You can take a look at the emergency services application to see how we are sending events and how we are using that information in different activities of the process.

           

          https://github.com/Salaboy/emergency-service-drools-app

           

          Best Regards

          • 2. Re: Passing variables to signalEvent
            eaa

            As Mauricio mentioned, the best and more clear way to handle events is to have your own Event class with all the attributes you need. Using a Map is a dirty solution in my opinion.