Custom bpmn elements

Hello, everybody!

Please help to understand.
I have a system with its own API. And would like to make separate tasks in Camunda to call methods from this API.

Here is a request example of a method from the API:

POST /rest/api/v1/feedback/
{
 "feedback-text": "some text from client",
 "priority": "high"
}

And i would like to create such task in bpmn scheme:

<bpmn:process id="Process" name="Process with custom task" isExecutable="true">
...
 <customNS:postFeedback id="postFeedbackTask" 
                        name="postFeedbackTask" 
                        feedbackText="some text from client" 
                        priority="high"/>
...
</bpmn:process>

What is the difficulty:

  1. Communication between servers is asynchronous.
  2. After the task is launched, the class with the business logic must be invoked, which sends a message and waits for an answer to it.

I.e. it looks like SignallableActivityBehavior implementation for Service Task.

I unfortunately could not figure out how to implement such a custom task in the engine.
Is there really a simple solution to my problem?
Or maybe I started from wrong way?

Hi,

Im not sure which part of your interaction is asynchronous. Im attaching a basic process model which uses a synchronous request with async response. In addition, I used the http connector to show how the call could be configured.

This model assumes the service knows how to call your process back with a response.

Perhaps you could explain the client code a little more…

Heres a link to an example of how to implement an asynchronous service task…

regards

Rob

Asynch.bpmn (4.8 KB)

1 Like

Hi, Webcyberrob.

I’ll try to explain integration what i would like to build with the process.

I would like something like this:

  1. The busines-process starts Execution on Task “Feedback”
  2. Inside this Execution sends message to external system by API.
  3. Starts busines-logic of Integration layer - monitoring activity of this record and waits for Answer to it.
  4. After it has got the Anser the Execution should complete.

Inside Integration layer i have Camel route that listening some queue outcome.feedback.post and sends request to API. And send message id to second queue outcome.feedback.check for second Route.
Second Route send requests to other rest-resource to check answer.
After got an Answer it dispatches a signal to busines-process. After what Execution should complete.

The link you posted really helped me.
But I still have a question: how can I determine the necessary set of parameters for my task.

Hi,

Given you may have camel as middleware, I would use something like the model I posted using the message send, message receive pattern. Hence the interaction may be something like;

Process Instance->Camel->Service->Camel->Process Instance

Hence in this scenario, you shouldn’t need a custom or asychronous BPMN element. Here [1] is a link to the correlate message API. You could use this via camel to signal back to your process instance…

Let me know if this is the pattern you want to implement…

regards

Rob

[1] https://docs.camunda.org/manual/7.9/reference/rest/message/post-message/

Hi, thanks for your advice.

I didn’t know about correlate message feature.
But now i am already begin with experimenting with camel + mq + camunda inside one project.

I have something working now.

What did i done:

  1. Register model for extension property;
  2. Add parse listener to set behavior for processing async logic if service task have this custom extension;
  3. Add camel routes to send messages to api and resume process after get answer.

Now it works just fine :slight_smile:

But I would still like to try to make my root element type in bpmn schema. And this is where I don’t even know where to start.

Hi, Everybody !
Is there any solution for my question ?
Or extension elements is only one way ?