Bproc event gateway

Hi,

I am lost in cosmos,

I want after a task1 wait event launch by an other process to continue flow. So i use event gateway with gateway wait MessageIntermediateCatchEvent or CondiontalIntermedaiteCatchEvent to way.

image

image

image

In the process who will run event. I found the good workflow ProcessInstanceData, but i don’t know how run event.

I see IntermediateCatchConditionalEventActivityBehavior but I not found any exemple from your stack.

Can you provide me a exemple who run event with id?

thx

Gabriel

Hello!

In the Flowable documentation there is a description of how to notify certain execution with configured MessageIntermediateCatchEvent that necessary message arrived. I’ve also attached a test project which uses this functionality, for example, please use it as a reference.

I’ve modeled two process definitions - “process1587” has event gateway and two intermediateCatchEvents, one with message type and another with timer type. If message with name “message15878” will receive in 5 minutes after gateway has reached execution should go to “userTaskAfterMessageEvent” task, if no - to “userTaskAfterTimerEvent” task.
Another process definition - “process-to-notify-another-process” - has a simple service task with spring bean definition, this bean allows to find an active process which is waiting for a certain message and notify it that message arrived. So if there is an active process started from the first process definition and execution arrived at the event gateway, you can start the process from the second process definition that will notify the first process that message is there, so execution will go by messageIntermediateCatchEvent branch.

@Component(MyMessageEventReceivedBean.NAME)
public class MyMessageEventReceivedBean {
    public static final String NAME = "forum15878_MyMessageEventReceivedBean";

    private final static Logger log = LoggerFactory.getLogger(MyMessageEventReceivedBean.class);

    public void messageEventReceived(String messageName, String processDefinitionKeyToNotify) {
        log.info("MyMessageEventReceivedBean#messageEventReceived messageName={} processDefinitionKeyToNotify={}",
                messageName, processDefinitionKeyToNotify);

        RuntimeService runtimeService = ProcessEngines.getDefaultProcessEngine().getRuntimeService();
        Execution execution = runtimeService.createExecutionQuery()
                .messageEventSubscriptionName(messageName)
                .processDefinitionKey(processDefinitionKeyToNotify)
                .singleResult();

        runtimeService.messageEventReceived(messageName, execution.getId());
    }
}

forum15878.zip (114.8 KB)

Please let me know if it solves your problem.

Perfect!