Catching multi-instance event messages

21 views
Skip to first unread message

Adrian Apthorp

unread,
Mar 7, 2021, 4:57:33 AMMar 7
to Kogito development mailing list
Hi,

I've got a multi-instance called subprocess that I want to catch some message events from in my parent process. To do this I created a multiple instance sub-process in parallel to the called subprocess with a catching event in it. This gives me a compile error

[ERROR]     [error]: Build step org.kie.kogito.quarkus.deployment.KogitoAssetsProcessor#generateModel threw an exception: org.kie.kogito.codegen.process.ProcessCodegenException: Error while elaborating process id = "parentProcess", packageName = "com.xxx.yyy": null
[ERROR]     at org.kie.kogito.codegen.process.ProcessCodegen.generate(ProcessCodegen.java:248)
[ERROR]     at org.kie.kogito.codegen.ApplicationGenerator.lambda$generateComponents$1(ApplicationGenerator.java:83)
[ERROR]     at java.base/java.util.stream.ReferencePipeline$7$1.accept(ReferencePipeline.java:271)
[ERROR]     at java.base/java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1655)
[ERROR]     at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:484)
[ERROR]     at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:474)
[ERROR]     at java.base/java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:913)
[ERROR]     at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
[ERROR]     at java.base/java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:578)
[ERROR]     at org.kie.kogito.codegen.ApplicationGenerator.generateComponents(ApplicationGenerator.java:84)
[ERROR]     at org.kie.kogito.codegen.ApplicationGenerator.generate(ApplicationGenerator.java:66)
[ERROR]     at org.kie.kogito.quarkus.deployment.KogitoAssetsProcessor.generateModel(KogitoAssetsProcessor.java:147)
[ERROR]     at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[ERROR]     at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
[ERROR]     at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
[ERROR]     at java.base/java.lang.reflect.Method.invoke(Method.java:566)
[ERROR]     at io.quarkus.deployment.ExtensionLoader$2.execute(ExtensionLoader.java:920)
[ERROR]     at io.quarkus.builder.BuildContext.run(BuildContext.java:277)
[ERROR]     at org.jboss.threads.EnhancedQueueExecutor$Task.run(EnhancedQueueExecutor.java:2415)
[ERROR]     at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1452)
[ERROR]     at java.base/java.lang.Thread.run(Thread.java:834)
[ERROR]     at org.jboss.threads.JBossThread.run(JBossThread.java:501)
[ERROR] Caused by: java.lang.NullPointerException
[ERROR]     at org.jbpm.compiler.canonical.ForEachNodeVisitor.visitNode(ForEachNodeVisitor.java:72)
[ERROR]     at org.jbpm.compiler.canonical.ForEachNodeVisitor.visitNode(ForEachNodeVisitor.java:40)
[ERROR]     at org.jbpm.compiler.canonical.AbstractNodeVisitor.visitNode(AbstractNodeVisitor.java:63)
[ERROR]     at org.jbpm.compiler.canonical.ProcessVisitor.visitNodes(ProcessVisitor.java:234)
[ERROR]     at org.jbpm.compiler.canonical.ProcessVisitor.visitProcess(ProcessVisitor.java:158)
[ERROR]     at org.jbpm.compiler.canonical.ProcessToExecModelGenerator.generate(ProcessToExecModelGenerator.java:91)
[ERROR]     at org.kie.kogito.codegen.process.ProcessExecutableModelGenerator.generate(ProcessExecutableModelGenerator.java:43)
[ERROR]     at org.kie.kogito.codegen.process.ProcessCodegen.generate(ProcessCodegen.java:240)
[ERROR]     ... 21 more

I get the same error even changing the activity within the process to a simple user task.

Aside from the comple error, is this right approach for my scenario?

Jakub Grabowski

unread,
Mar 7, 2021, 7:45:33 AMMar 7
to kogito-de...@googlegroups.com
I haven't analyzed your scenario thoroughly but one hint is to use .bpmn2 extension for filename. It changed a lot in my case. I was able to cancel multi instance via ad-hoc call and it wasn't working with .bpmn extension.

--
You received this message because you are subscribed to the Google Groups "Kogito development mailing list" group.
To unsubscribe from this group and stop receiving emails from it, send an email to kogito-developm...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/kogito-development/622ca1ce-b1df-4a85-9a7b-f50bff1f8109n%40googlegroups.com.

Adrian Apthorp

unread,
Mar 8, 2021, 9:05:42 AMMar 8
to kogito-de...@googlegroups.com
I’m using the .bpmn2 file extension.

On 7 Mar 2021, at 8:45 PM, Jakub Grabowski <jgrab...@perfectsource.pl> wrote:



Adrian Apthorp

unread,
Mar 11, 2021, 8:52:25 AMMar 11
to Kogito development mailing list
It seems that multi-instance sub-processes just do not compile. Will log a JIRA for this.

Tried using a multi-instance user task with a boundary event. This compiles but then I get a runtime error when I start my service.

2021-03-11 21:41:30,717 ERROR [io.qua.run.Application] (Quarkus Main Thread) Failed to start application (with profile dev): java.lang.RuntimeException: Process could not be validated !
    at org.jbpm.ruleflow.core.RuleFlowProcessFactory.validate(RuleFlowProcessFactory.java:208)
    at com.xxx.MyProcessProcess.process(MyProcessProcess.java:215)
    at org.kie.kogito.process.impl.AbstractProcess.id(AbstractProcess.java:98)
    at org.kie.kogito.infinispan.CacheProcessInstances.<init>(CacheProcessInstances.java:45)
    at org.kie.kogito.persistence.KogitoProcessInstancesFactory.createProcessInstances(KogitoProcessInstancesFactory.java:41)
    at org.kie.kogito.persistence.KogitoProcessInstancesFactoryImpl_ClientProxy.createProcessInstances(KogitoProcessInstancesFactoryImpl_ClientProxy.zig:128)
    at org.kie.kogito.persistence.KogitoProcessInstancesFactory.createProcessInstances(KogitoProcessInstancesFactory.java:31)
    at org.kie.kogito.process.impl.AbstractProcess.configure(AbstractProcess.java:133)
    at org.kie.kogito.process.impl.AbstractProcess.activate(AbstractProcess.java:149)
    at com.xxx.MyProcessProcess.<init>(MyProcessProcess.java:18)
    at com.xxx.MyProcessProcess_Bean.create(MyProcessProcess_Bean.zig:320)
    at com.xxx.MyProcessProcess_Bean.create(MyProcessProcess_Bean.zig:380)
    at io.quarkus.arc.impl.AbstractSharedContext.createInstanceHandle(AbstractSharedContext.java:96)
    at io.quarkus.arc.impl.AbstractSharedContext.access$000(AbstractSharedContext.java:14)
    at io.quarkus.arc.impl.AbstractSharedContext$1.get(AbstractSharedContext.java:29)
    at io.quarkus.arc.impl.AbstractSharedContext$1.get(AbstractSharedContext.java:26)
    at io.quarkus.arc.impl.LazyValue.get(LazyValue.java:26)
    at io.quarkus.arc.impl.ComputingCache.computeIfAbsent(ComputingCache.java:69)
    at io.quarkus.arc.impl.AbstractSharedContext.get(AbstractSharedContext.java:26)
    at io.quarkus.arc.impl.ClientProxies.getApplicationScopedDelegate(ClientProxies.java:17)
    at com.xxx.MyProcessProcess_ClientProxy.arc$delegate(MyProcessProcess_ClientProxy.zig:67)
    at com.xxx.MyProcessProcess_ClientProxy.arc_contextualInstance(MyProcessProcess_ClientProxy.zig:82)
    at com.xxx.MyProcessProcess_Observer_Synthetic_d70cd75bf32ab6598217b9a64a8473d65e248c05.notify(MyProcessProcess_Observer_Synthetic_d70cd75bf32ab6598217b9a64a8473d65e248c05.zig:94)
    at io.quarkus.arc.impl.EventImpl$Notifier.notifyObservers(EventImpl.java:282)
    at io.quarkus.arc.impl.EventImpl$Notifier.notify(EventImpl.java:267)
    at io.quarkus.arc.impl.EventImpl.fire(EventImpl.java:69)
    at io.quarkus.arc.runtime.LifecycleEventRunner.fireStartupEvent(LifecycleEventRunner.java:23)
    at io.quarkus.arc.runtime.ArcRecorder.handleLifecycleEvents(ArcRecorder.java:60)
    at io.quarkus.deployment.steps.LifecycleEventsBuildStep$startupEvent-858218658.deploy_0(LifecycleEventsBuildStep$startupEvent-858218658.zig:81)
    at io.quarkus.deployment.steps.LifecycleEventsBuildStep$startupEvent-858218658.deploy(LifecycleEventsBuildStep$startupEvent-858218658.zig:40)
    at io.quarkus.runner.ApplicationImpl.doStart(ApplicationImpl.zig:762)
    at io.quarkus.runtime.Application.start(Application.java:90)
    at io.quarkus.runtime.ApplicationLifecycleManager.run(ApplicationLifecycleManager.java:97)
    at io.quarkus.runtime.Quarkus.run(Quarkus.java:66)
    at io.quarkus.runtime.Quarkus.run(Quarkus.java:42)
    at io.quarkus.runtime.Quarkus.run(Quarkus.java:119)
    at io.quarkus.runner.GeneratedMain.main(GeneratedMain.zig:29)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.base/java.lang.reflect.Method.invoke(Method.java:566)
    at io.quarkus.runner.bootstrap.StartupActionImpl$3.run(StartupActionImpl.java:134)
    at java.base/java.lang.Thread.run(Thread.java:834)

Jakub Grabowski

unread,
Mar 11, 2021, 8:59:11 AMMar 11
to Kogito development mailing list
Hi,
I'm actually running several multi instance processes with user tasks and it seems to work. I had problems with date marshalling but got rid of them (using plain strings with date). You can't have OffsetDate time field when using Infinispan) nor while using Kafka cloud events (date marshalling is broken - I've filed a bug for it). But multi instance seems to work for me.
"Rule flow" process validation errors often occur when you have eg several incoming flows and more than one outgoing flow from exclusive gateway or more than one incoming with several outgoing. Please check.

Regards,
Jakub.

Adrian Apthorp

unread,
Mar 13, 2021, 5:22:20 AMMar 13
to Kogito development mailing list
The problem occurs when I add a catching message event to a multi-instance user task.

To explain some more. I have a multi-instance called sub-process that I want to catch message events from in my parent process. This is to allow a parallel activity to advance once all sub-process instances have sent the message event.

Adrian Apthorp

unread,
Mar 13, 2021, 5:30:08 AMMar 13
to Kogito development mailing list
Ideally I'd use a receive task for this, but this is currently not supported.

Adrian Apthorp

unread,
Mar 20, 2021, 7:02:36 AMMar 20
to Kogito development mailing list
Any suggestions on how to support catching multiple event messages in a process from a multi-instance sub-process? In other tools I've used multi-instance receive tasks but as receive tasks are not supported in Kogito that's not an options.

I've tried various workarounds, but have hit dead ends. I now see (mea culpa) that my original approach with multi-instance embedded sub processes is not supported. I've also tried creating a simple callable sub-process but this doesn't compile when I set it to multi-instance in the parent process.

[error]: Build step org.kie.kogito.quarkus.deployment.KogitoAssetsProcessor#generateModel threw an exception: java.lang.IllegalStateException: src/main/java/com/xxx/testProcessProcess.java (92:22) : cannot find symbol
[ERROR]   symbol:   method setItem_in(com.xxx.Item)
[ERROR]   location: variable model of type com.xxx.ReceiveVerifiedModel

Jakub Grabowski

unread,
Mar 20, 2021, 10:47:34 AMMar 20
to kogito-de...@googlegroups.com
Hi, my approach that works is:
1. Set multi instance subprocess as bpmn2 and ad-hoc
2. Create "loose" service task, user task or script task
3. Add some logic after "loose" task.
I was able to make subprocess with user task cancellation using this approach.
When you want to end instance you have to use End Terminate because ordinary End just finishes branch but doesn't finish whole subprocess.

Regards, 
Jakub.

You received this message because you are subscribed to a topic in the Google Groups "Kogito development mailing list" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/kogito-development/gWoYtTbxlRg/unsubscribe.
To unsubscribe from this group and all its topics, send an email to kogito-developm...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/kogito-development/023de594-5a09-4cfb-a83d-f4b3ab7315e0n%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages