How we can send multiple messages via the APi?
with send message task, there is no connector to add API ?
How we can send multiple messages via the APi?
with send message task, there is no connector to add API ?
Hello,
Please find here an example to send a message via the API (this example comes from the Longboard page) https://community.bonitasoft.com/project/custom-page-longboard
Example:
https://github.com/Bonitasoft-Community/page_longboard/blob/master/src/main/java/com/bonitasoft/custompage/longboard/casehistory/MessageOperations.java
Have a look at line 231.
with send message task, there is no connector to add API ?
What do you mean by "add API"? And what is a "connector to add API"? Do you speak about the Command (which is a way to add a API method inside a Bonita Engine)?
Best,
Hello,
from one pool to several pool:
* use a Throw event. A thread event can send multiple messages (just click on Add for each message)
* via a groovy script. Look at the example I already sent you.
Best
I think that you propose to create a separate java application ?
How I can integrate it with bonitastudio with task which send this message?
I search a way to send message to différents pools within bonita studio or uI design without used source code !
Hello,
That the question: you want to send message to different pool. From which component?
* from a connector in a process? ==> will be by the JAVA API, getting the apiAccessor in the "provided variable"
* from an operation? ==> JAVA API, getting the apiAccessor in the "provided variable"
* From a Groovy custom page ==>JAVA API , getting the apiAccessor from the pageContext
APISession apiSession = pageContext.getApiSession();
ProcessAPI processAPI = TenantAPIAccessor.getProcessAPI(apiSession);
IdentityAPI identityAPI= TenantAPIAccessor.getIdentityAPI(apiSession);
* from a UI Designer form => REST API https://documentation.bonitasoft.com/bonita/7.11/bpm-api#toc41
* from an external application, completely out of Bonita => Java API ( login, then get the API Accessor from the ApiSession)
So, from which components do you want to send a message ? With Bonita Studio does not help: you can build a UI Designer page, a Process, a Groovy Page, a REST API Extension from a Bonita Studio.
I am looking for the simplest, the essential that I send message (which contains a complex variable) from one pool to several pools.
What method do you suggest to me?
Hello,
With Bonita, as I told you, you have to send one message per pool. 1 sender, 1 receiver.
So, in the throw event, click on "Add message" then send one message per receiver. On each message, give a different name ("message_1", "message_2" etc...)
You can use the JAVA API too to send message. In your process, create a Groovy Connector, so you can develop a Groovy code to send all your message, with the pattern
List<String> listPoolToSend = ["Pool1", "Pool54", "Pool6654"];
for (int i=0,i< listPoolToSend.size();i++) {
// look the JavaAPI (processAPI.sendMessage() ) to send the message
}
Best
Thanks sir so much.
I will try this solution.
Have a good weekend
as you have suggested, i create a groovy connector with this code:
//import com.company.model.AdtA04DAO;
import com.company.model.AdtA04;
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<Expression, Expression> mapA = new HashMap<Expression, Expression>();
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?
Hello,
What do you mean by "Received this message by P2" ?
You should have, in the process P2, a Catch Event named "Démarrer3".
It may be a "Start message", a "Catch message" or a "boundary catch message".
Best
Sorry but i think that my question was wrong:( or not precise!!!
I want to send the same message from one pool to several pool?
No worry. Then just add multiple time the sender in the throw event, and change the target pool. Same with the API
With Bonita, a message is "1 sender, 1 receiver". So, if you want to send to a list of receiver, you have to send 1 message per receiver. Then to copy the message for each receiver.
So, for each message we must give a different name.
whoever I want to send it to different partenaires with the same name!!!!
Is it possible?
Hello,
In the studio, you must be a different name. You can give as the name the name of the target pool.
By the API, I think you can give the same name, but this is not a good idea: name is used to identify easily the message on the log file, so even if you can give the same name, I want give a different name to understand which message have an issue, isn't it?
What do you want to give the same name?
Because it is a standard message.
Effectively, after process execution I want to extract messages information from log file !!!
You mean to use for example :
* From a Groovy custom page ==>JAVA API , getting the apiAccessor from the pageContext
So I must create this page with groovy out bonita(in another editor) or in bonita ?
How I can do it?
Effectively, after process execution I want to extract messages information from log file !!!
==> Don't do that, you can rely on the LOG file. What do you want to do exactly?
* From a Groovy custom page ==>JAVA API , getting the apiAccessor from the pageContext
So I must create this page with groovy out bonita(in another editor) or in bonita ?
==> This is a possibility, but using the studio should solve your issue. It's simpler than using the JAVA here.
Reminber: a message is a 1 sender to 1 receiver. So, you already know your X reveiver, ins't it ?
Let's say you have 4 receivers, in 4 different process. Process "Vacation", "Expense", "Review", "OnBoard".
So, in the Throw Event, you click 4 times on "Add a message".
For the message 1, you target "Vacation", and you give as the name... what you want, it's only for internal usage, so let's say I named this message "Coffee". You add the message content the message correction. Then I have a variable "CarColor" in my process, I add a line "msgCarColor", assigned by "CarColor". Ok, done.
For the message 2, you target "Expense", and give as the name... "tea". You populate the message with the same content.
Do I understand correctly what you want to do ?
==> Effectively, after process execution I want to extract messages information from log file !!!
I think there is nothing in the log file. To extract a message information, in the "catch event", you can associate the content's message with your local process variable. Example, in the process "Vacation", you have a variable "ColorOfVacation". Then, you can say "ColorOfVacation <= msgCarColor".
That the way to extract message information. Do not try from the log file. Keep in mind, in case of a Synchronized message, the correlation can be executed days after the emission.
So, I'm not sure that I completely understand what you look for. Are you a Bonita Customer? You can be in touch with a consultant.
Best,
No, I'm PHd student,
I want to analyze the execution traces of collaborative process that I am trying to develop. I want to extract all the elements of my process (activities, messages, events, times ....) from the logs to build it later.
I use bonita to develop a collaborative process, using standard messages.
The message names are standard, we cannot change them.
I want to send a message to two collaborators with the same name, Throw Event does not allow the same nomination for two messages !!! so is there another solution?
how can I be in contact with a consultant?
Hello,
You are already in touch with a consultant (I'm one of them !). But we are in priority to help and work for our customer, so I may have a look in the community every week only. Click on the "Contact us" on the Bonitasoft website, give the way to contact you, and the company will be in touch with you. With a consultant full time, you will address your concern in less than a day.
For your need, I would recommend:
* not to see the log file, but directly request the Database. All information are saved in the database (arch_flownode_instance for activity and event).
I want to send a message to two collaborators with the same name
For the message, do you mess up a BPMN message and a EMAIL? A message is sent to a PROCESS, not to a COLLABORATORS. If you want to send a EMAIL, use the Connector EMAIL (and here, you can use the same subject of course).
How the message name cannot be changed? A BPMN message name is an internal ID actually. So, of course, you cannot have the same name (the same ID) for two different messages. So, of course (hopefully !) the Throw Event does not allow the same name (the same ID) for two BPMN messages.
Why not named the BPMN message by "ProcessTarget_YourName" ? Then the message name (the ID) will be unique. And please notice that this name is visible for you to be convenience in case of issue, but this is really an internal information.
But I really have the sensation that you want to send an email, not a BPMN message,ins't it?
Best,
I mean partner process or collaborative process.
This names were imposed by standard, we can not change its Names.
We have xml schéma predefined.
But i create my owner schéma with bdm with the
same name.
OK sir I will try
Thanks a lot