send message



as you have suggested, to send message i create a groovy connector with this code:

import org.bonitasoft.engine.api.APIAccessor;
import org.bonitasoft.engine.api.ProcessAPI;
import org.bonitasoft.engine.api.ProcessRuntimeAPI;
import org.bonitasoft.engine.expression.ExpressionBuilder;
import org.bonitasoft.engine.expression.Expression;
//import java.util.logging.Logger;

Expression targetProcess = new ExpressionBuilder().createConstantStringExpression("P2");
Expression targetFlowNode = new ExpressionBuilder().createConstantStringExpression("Démarrer3");

ProcessAPI processAPI = apiAccessor.getProcessAPI();

Map mapA = new HashMap();

Expression messageContentKey = new ExpressionBuilder().createConstantStringExpression("key");
Expression messageContentValue = new ExpressionBuilder().createConstantStringExpression("AdtA04DAO");

mapA.put(messageContentKey, messageContentValue)

processAPI.sendMessage("adt_A04", targetProcess, targetFlowNode,mapA);

but i don't know how to received this message by P2?

1 answer

This one is the BEST answer!

to receive a message, your process should use a "Catch Message" event. You have 3 kinds of Catch Message:

* a Starter catch event: a new case in P2 will be created

* a Catch Message event: you have to declare a Correlation Key to synchronize the sender and the receiver (in your example, you don't declare this key)

* a Boundary Catch message event: you need a correlation key too.

Sorry, the QA in the community does not allow to put some images to show events I told you about here.

For more information, look here or search on the web BMPN events.

At Bonita, we have the training, and you really should consider the following one: it will be a great value for you! We explain, and train on all these kinds of features.



Submitted by maouachria on Fri, 12/04/2020 - 21:22

they informed me on price formation but I have not the amount requested and besides my university does not pay that kind of training.