Query on Conditional Event

Hi,
I’m new to camunda and I can see in documentation Conditional Event is widely used to replace cmmn. So I’m trying to understand this event.

What am I trying?
trying to trigger a sub-process on variable create/update(isException) using conditional event. I even tried same with boundary event on sub-process. Is this possible with conditional event? I dont want to use event sub-process here.

Attached screenshot for reference:


Hello @camundabpmlearner ,

why don‘t you want to use a event subprocess?

This would be the perfect fit imo…

Jonathan

Hi @jonathan.lukas,
Thank you for the response,
I just want to check whether subprocess can be triggered without shifting the token to subprocess (which is the behavior in event subprocess). I want token to be present in main process and new token to be created in subprocess.

So wanted to know whether conditional Intermediate event can achieve this.

Exception is just an example here. Above scenario I wanted to check.

Hello my friend!
Yes… there is a way.

You can use it with a non-interrupting conditional event.
If you use the conventional conditional start event it will move your token to the subprocess, if you use the non-interrupting it will create an extra token in the subprocess.

image

image

I hope this helps!

William Robert Alves

1 Like

Hi @WilliamR.Alves,
Out of Curiosity asking, there is no way to trigger sub process like this?

Hello!

The conditional event will trigger the subprocess according to some condition of your process what you defined… but you can trigger it in other ways… for example with a messageCorrelate using a “message event” in your subprocess, and even with a timer if want to trigger every time.

I’m at the gym right now, but as soon as I get home, I’ll send you a code triggering the camunda engine to make this message correlation and trigger the subprocess.

See you later.

William Robert Alves

Hello! i’m back!

Answering your previous question, you can use a “message start event (non-interrupting)” in your event subprocess, and in any step of your process, you can trigger this subprocess through a message correlation.

image

image

And make this code below in one of your tasks, it can be in an execution listner of some task if it’s through Camunda Modeler, or even in your project’s code.

execution.getProcessEngineServices().getRuntimeService()
         .createMessageCorrelation("MyMessageReferenceName")
         .processInstanceBusinessKey(execution.getProcessBusinessKey())
         .correlateWithResult();

Hope this helps.

William Robert Alves

Hi @WilliamR.Alves
Thank you for the details…
My Question is on Sub process, not on event subprocess…

Some what like this… Can this intermediate message event can be triggered?

Reason behind asking is, as far as I know event sub processes are kind of expensive one which continuously listening as soon as main process started hence forth, I’m trying to find alternative.

1 Like

Hello my friend! :smiley:

Where did you see this information that the event subprocess has a higher cost? The event subprocess is basically a “pub/sub”.

I think it has a lower cost, because the event subprocess was created to be part of the main process waiting for a specific event to happen to start, the event subprocess does not have an independent process instance.

And the expanded subprocess is a completely independent process, started with a new separate instance, and I believe that this will make the cost of an expanded subprocess higher… for this reason I believe that the best event subprocess is.

But yes it is possible to do it this way you mentioned too, although I don’t recommend it for your use case.

OBS.: Just for the purposes of organizing topics, I always recommend that when you end your question in a topic, finish it by marking the correct answer, and start a new topic with your next question.

This way people will be able to find the answers to their questions easier from the name of the new topic. :smile:

I hope this helps!

William Robert Alves

Hi @camundabpmlearner,

your process will NOT work, because every intermediate message event needs an incoming sequence flow.

The message event in your process will never be activated.

Hope this helps, Ingo

1 Like

Thank you @Ingo_Richtsmeier.
So only event sub process can achieve this.

Hi @camundabpmlearner,

yes. The post that is marked as a solution is the correct one.

Hope this helps, Ingo

2 Likes

@camundabpmlearner

Really Mr. @Ingo_Richtsmeier is correct about the comment.
I didn’t see that the event was an intermediate event… I thought it was a “message start event”.

But if you create this same flow by creating a “message start event”, it will work, but starting a new instance of your process, with a new id.

Thanks @Ingo_Richtsmeier for correcting.

William Robert Alves

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.