Abhitocode commented on PR #3583:
URL: 
https://github.com/apache/incubator-kie-kogito-runtimes/pull/3583#issuecomment-2248669926

   Hi, I've implemented a ProcessEventListener to capture the process instance 
created by the engine, but I'm facing an issue. The beforeProcessStarted and 
afterProcessStarted methods of the listener are not being executed. Can you 
please help me understand if I'm missing something in the configuration or 
implementation?
   
   `  Application app = ProcessTestHelper.newApplication();
           org.kie.kogito.process.Process<ErrorsBetweenSubProcessModel> 
errorsBetweenSubProcessProcess = ErrorsBetweenSubProcessProcess.newProcess(app);
           /*
            * ProcessInstance<ErrorsBetweenSubProcessModel> subProcessInstance 
= errorsBetweenSubProcessProcess
            * .createInstance(errorsBetweenSubProcessProcess.createModel());
            */
           org.kie.kogito.process.Process<ErrorsBetweenProcessModel> process = 
ErrorsBetweenProcessProcess.newProcess(app);
           final Set<String> processInstanceIdSet = new HashSet<>();
           DefaultKogitoProcessEventListener listener = new 
DefaultKogitoProcessEventListener() {
               @Override
               public void beforeProcessStarted(ProcessStartedEvent event) {
                   logger.info("sub process id: {}, process id: {}", 
errorsBetweenSubProcessProcess.id(), process.id());
                   logger.info("Process Instance process id: {}, instance id: 
{}", event.getProcessInstance().getProcessId(), 
event.getProcessInstance().getId());
   
                   // Check if the process instance is the one we're interested 
in
                   if 
(event.getProcessInstance().getProcessId().equals(errorsBetweenSubProcessProcess.id()))
 {
                       
processInstanceIdSet.add(event.getProcessInstance().getId());
                   }
               }
           };
           ProcessTestHelper.registerProcessEventListener(app, listener);`


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to