send multiple messages Via 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/m...
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,
Comments
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 !
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?
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 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?
Comments
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
I touch about consultant because I'm in my last year of phd I must finish it.
if the price is suitable for my situation :)
Hello,
Consider the BPMN Message name is an internal ID, how it can be "imposed by standard" ? How an XML Schema can define them? Are you sure this is not an email that you want to send? What is the link between a internal ID and the Business Data Model?
You may have some requirement on an activity name (which are an ID as well, they must be unique), but on a message, that no user can access, I think I miss something.
Best
That's me who defined internal I'd name with the same name of message imposed by standard. For raison to detected them from log or database as you propose.
Even email I think we must send itsome with different name??
Ok, so this is a constraint with the Bonita solution: each BPMN message has a unique name. This is due to identified a message and to log the correct information to help administrator to find which message has an issue.
For an email, you can do what you want, you can use the same subject, same sender, same content.
Best,
OK sir
I think that is a good idea.
I will send the message to the first process and the same message in email as notification for the second process.
Have a good weekend