Building Camunda as a Web Service API

Hi,

I’m developing a backend API for my Mobile/Web client application using Camunda. I would like to validate if my implementation and understanding of how Camunda is correct, and that it would coincide to what I am trying to accomplish.

I have no working experience in Java, so I’m using the Camunda REST API.

What I did was create BPMN workflows for my API endpoints ( Login, Change password, Transact, Get User Data). I would be using external services (microservice).

One of my questions would be:

  1. How do I create JSON messages as results of my Workflows. Since Camunda would be my backend API.

  2. Assuming, I havefigured out question #1. How does my client application retrieve that JSON message, it would be another API call, right after Start Process Rest-engine. right?

  3. Where should I build my models? these are my domain models, if it’s a microservice arch. then each of my microservices would have there own model.

Glad to hear your suggestions.

I’ve been digging the forums and found some similar projects…

Similar projects:

The difference though is that, the implementation I am trying to achieve is one without using Java, this would mean that all of my service tasks would be External.

The question I have now are.

  1. How do you return JSON messages as results from the entire workflow processes.
  • From what I am seeing, JSON messages are handled by the use of Connectors + Input/Ouput mapping via scripting.

  • Or an alternative approach would be to persist the actual JSON response and assign it as a process variable, you would then have to call another API call to get process instance variables ( this I haven’t tried)

If all your tasks are external, have you considered using the external task pattern?

Hi Stephen, yes, I have, although I realized that doing external task pattern isn’t ideal for all of the API calls…

For example a User Login Workflow would ideally be better implemented on a connector service vs a external worker implementation.

To add, even if I use external service approach, my problem about how to return JSON messages as response of a workflow is still up. how do you think should I tackle this?

I would still have to develop in Java for the case of connectors, and do some scripting.

If you use external tasks, then all the work is done by the external task worker (the login, the work, the sending data back to the process instance when the task is completed)

So saving API responses is nothing more than regular JSON Spin variables being created by your completion of external tasks.

Do you have any issues writing groovy or JavaScript ? If not, then you can do all of your requests as scripts. You can easily abstract the requests for things like login, into reusable functions /API calls. There are many posts on the forum that discuss different strategies to do this.

What does “develop java” mean to you? In all of the examples that I discuss in this thread, they all use scripting, and don’t involve building java classes or compiling

1 Like

Yes, I am aware of how worker services return the data and how it is persisted by the rest-engine, my problem is from the rest-engine,. how does my client applications retrieve that data back… Do they invoke another call right after the service tasks are completed?

When I say do I need to develop Java is that do I have to code Java classes or modify Java code to make things work.

Could you point me to these resources? Would surely appreciate it.

so are you saying, i could write the logic that handles the creation of messages and parsing of responses just through Javascript? through the use of Script tasks on BPMN? that would handle the HTTP request through AJAX or what not?

See the links from the other thread you were discussing in: Rest Api based workflow - Http-Connector and handeling errors

There is no ajax.
Yes you can do all of the scripting through javascript ( /without Java).

See the camunda documentation about Scripting.