Message in a process

Hello, as I have learned, according to BPMN rules, customers and applicants should not be within the same pool where the organization is mentioned. I have modeled something, but unfortunately, I don’t know if it’s correct. I tried to remove the user and give them their own pool. However, I don’t know how to handle the messages where the data from the first task appears in the ‘Check User’ task because I have never worked with messages before, and I don’t know how to do it. I would appreciate any help. Thank you very much. You are the best.

Hello @FC_Catalonia ,

instead of a message start event “got message”, try using a message intermediate catch event and connect the sequence flow between “send message” and “got message”.

This will effect your User process to wait for the Travel agency process until it ended with “send message”.

I hope this helps

Jonathan

1 Like


I have done it the way you wanted, but I’m getting an error message somehow. Is this correct? Do I need to program something else? I’m not sure what the user enters in the first task in that form, whether the approver can see the data, because previously I had user and approver within the same pool, which is incorrect.

Sorry if my wording was unprecise, but a diagram should say more than 1000 words :wink:

This is what I meant:

Thank you. One question, do I not need to program anything in the Messenger Event? So can I be sure that the variables from the “Task Pull Data” go into “Checks user Data”? Unfortunately, I don’t understand what I should insert under “Messag” in the screenshot.
Screenshot 2023-06-26 150319

Hello @FC_Catalonia ,

you can find a guide about message correlation here:

Jonathan

Thank you, but my English is not very good. Isn’t there a video for this? Also, I’m using the SaaS version. Unfortunately, I don’t have a good understanding of it. Can’t it be done with Java? I would be grateful if you could help me understand it with the instructions, so I can finally grasp it.

Hello @FC_Catalonia ,

I am sorry, but I do not see a resource on youtube. Could the webpage maybe be translated to your language by some tool your browser offers?

In the end, a message catch event will subscribe using a message name (usually static) plus a correlation key (composed from process variables using an expression) while your (java) client for zeebe will be able to publish a message for a message name and the correlation key.

I hope this works for you.

Jonathan

Is there an example of BPMN that shows how to input it? I have set it to my language, but I don’t quite understand what it says. I’m sorry if I’m bothering you.

Hello @FC_Catalonia ,

this would be the config in the modeler:

Then, you can define a message correlation in your code like this:

    zeebeClient
        .newPublishMessageCommand()
        .messageName("myMessageName")
        .correlationKey("myCorrelationKeyValue")
        .send()
        .join();

The assumption is that you have a process variable with name correlationKey and value myCorrelationKeyValue.

As you can imagine, this variable value would be dynamic later.

Jonathan

To be honest, I’m feeling quite overwhelmed right now. I’m not sure how to integrate BPMN into Java. If I could see an example of a BPMN process with accompanying Java code, I would understand better. I’ve looked at the GitHub page, but I only see these annotations: @SpringBootApplication, @EnableZeebeClient, @RestController. Unfortunately, I’m not making progress.

Hello @FC_Catalonia ,

in this case, I would recommend this guide:

Here, you will get a description on how to get started with Camunda Platform 8 Saas using Java.

If you are using Saas, are you a customer or prospect?

Jonathan

I understand that you have read it, but you still don’t know where it belongs. You don’t even know which class it belongs to. A few days ago, I cloned the GitHub library, but I don’t understand it. I watched videos to try to understand, but unfortunately, not much is said in the academic videos, and I’m on the verge of tears right now. I don’t know how to proceed.

I am using Camunda on a free trial.

The Java client just calls Camunda’s APIs. There are many other clients in other languages too: Go, PHP, Python, Javascript, .NET, and more. It doesn’t integrate into the process, it sits entirely outside of Camunda.

Conceptually, while it is valid BPMN, your model doesn’t quite match the requirements you’ve explained through various threads: in order for the user to enter their details in that form, they will need to log into Camunda. It isn’t very likely that the travel agency would be creating a Camunda user account for every person who wants to inquire about a vacation. As a customer of the travel agency, I would expect the “See data” part to be an email that arrives in my inbox, for instance.

In that model I am imagining a form on the travel agencies website that the user enters their data into, then the backend of the website sends that data to your process to start a new instance. This is is illustrated in the Java example Jonathan shared:

.variables(Map.of("message_content", "Hello from the Java get started"))

Unfortunately, though, I can’t really tell you how to architect a full application and process; there are so many questions that you would need to provide answers to, and it would take so much time.

I see. I would like to create a model like the one Jonathan made because I still haven’t received a clear answer about what ‘Message’, ‘global message reference’, ‘name’, and ‘subscription correlation key’ mean. I have read the documentation on GitHub, but I don’t know where the other things mentioned on GitHub fit into my Java code. Even though I have cloned the GitHub library, I’m still not making progress. I have tried everything, but I’m unable to move forward. I understand what is mentioned about the Zeebe client, but it doesn’t specify exactly where it should be implemented. If I could see an example of Jonathan’s model with sample Java code, it would help me understand.

I don’t have a full example of that offhand, but if I find one I will send it to you. It seems like you may be thinking that the Java code is somehow run by Camunda and therefore needs to be “installed” to Camunda somewhere. It is not. The Java - or any other language - application exists and runs completely independently of Camunda.

The example repo Jonathan linked is a Java application that you launch on your workstation. This example might help you conceptualize that a bit more (note: this example is for C7, not C8 SaaS, but the idea is the same even if the API calls are slightly different).

Let me try to explain the whole process in simple language:

Imagine you have a server running at www.fccatalonia.com, and it is running your Java application. When the server starts the Java application, the bit of code that executes the job worker makes a call to C8 SaaS with the credentials you configured the application with. This registers the job worker as listening for a specific task definition type: now Camunda knows where to send the requests from service tasks configured with that task definition type.

For instance, let’s say your job worker is configured to listen for send-user-details tasks. There are multiple ways to do this, depending on your language, framework, and client, but one example could be like this:

client.newWorker().jobType("send-user-details").handler((jobClient, job) -> { /* your code here */ })

Your process is running, then the process encounters a task with the task definition type of send-user-details. Camunda knows to call the service running on www.fccatalonia.com because the job worker is registered. Camunda sends the data you configured in the model, and your application does whatever it needs to do with that data. When your code is finished executing, it sends a completion message back to Camunda. That completion message can contain additional data too. Then the process continues to the next step.

1 Like

Oh, now I understand it somewhat. I was initially very confused because I looked at this link once, https://academy.camunda.com/c8-getting-started-microservice-orchestration, camunda-platform-get-started/java at main · camunda/camunda-platform-get-started · GitHub, and this GitHub - camunda-community-hub/camunda-8-code-studio: This repository contains all assets for the Camunda Platform 8 related Code Studio events. It got me mixed up about where to start first.

Hi @FC_Catalonia,

You will be able to find the sample java code (spring-boot + camunda) to trigger message catch event from the below git repo.

Camunda Message Buffer

Please look at “messageCorrelationEventService” method under “MessageBufferingServiceImpl” class from “com.sandhata.camunda.messagebuffering.service” package.

Cheers

1 Like