Migrate from YAWL/Activiti to Camunda


#1

Hello. I previously used YAWL as workflow engine and now I’m evaluating Camunda and Activiti. The problem is I do not understand some differences:

  1. how you can declare process variables in the Modeler? It seems you can only define input and output parameters of tasks.
  2. how can I define a custom type for variables, that I can reuse in different processes?
  3. can’t you validate the diagram?

Migrating YAWL files (*.ywl) to BPMN 2.0 schema files
#2

Furthermore, parameters can be only

  • Text
  • Script (?)
  • List (of strings?)
  • Map (of string, string?)

There’s no long, double, boolean, byte? I think they are a very basic values… Activiti editor at least supports integer and boolean.

Can’t you specify the type of List elements and Map keys and values?


#3

Hi, Marco,

What exactly are you trying to do and where are you seeing these parameters.
Generally speaking there’s not need to map the variables you want to you in the modeler. You can just send in variables of any time into the engine and they’re be stored either via a task (service or user) or by started the process with a payload.

  1. Declaring variables in the modeler is not required.
  2. customer types? do you mean java objects?
  3. The modeler itself has validation on the BPMN notation, to validate it for technical inaccuracies you can use the camunda-asserts-lib in a JUnit test.

#4

I’m speaking about process variables. In YAWL, if for example you declare a task output parameter, to pass it to another task you have to define a process variable with the same name and type. The task parameter, once generated, is copied to the process variable. The task that read the same parameter will read it from the process variable.

How this mechanism works in Camunda?

PS: Activiti 7 app (Activiti Cloud) let you create process variables.

Well, no, since BPMN is not linked to a particular language. I mean a custom type that can be defined in XSD in the editor, that I suppose can be included in the XML of the BPMN file, and that will have a corresponding class in the language that implements the workflow engine (Java in your case).

Well, but it’s not enough, no? It doesn’t check, for example, if a service task has an linked implementation, or if the process network is sound.

What about the second post? You can define only strings, list of strings and maps of string,string? It’s not a bit limitative?


#5

You wouldn’t declare input and output variables for a task - things would start to get crazy if you consider the amount of things that can happen in parallel. Instead you simply set variable to the process instance scope. the instance itself will store them and if they’re needed by another task, that task will have access to them by simply asking the instance for the variables it needs. You can find more information in the docs: https://docs.camunda.org/manual/latest/user-guide/process-engine/variables/

As i said, any kind of technical validation is done using the testing framework.

No, this isn’t the case. - you can define any kind of variables you like.


#6

Ok, but where can I define the variables of process in the editor? I quote the docs:

In this case, when working on Task 1 the variables worker and customer are accessible.
Note that due to the structure of scopes, the variable worker can be defined twice, so that
Task 1 accesses a different worker variable than Task 2 . However, both share the
variable customer which means that if that variable is updated by one of the tasks, this
change is also visible to the other.

With the editor, I can define local variables in tasks, but where can I define the variable “customer” in the example?

Well, I suggest to you Camunda people and devs to take a look to the code of YAWL, since it does a lot of checks in the editor itself. It’s written in Java too, even if the processes he creates are not based on BPMN.

In the Java API, yes, but in the editor?


#7

I think it would be helpful for you to follow a tutorial, it’ll likely answer a lot of your questions.

It will give you some practical understanding on how variables work as well as how validation works across the platform.


#8

Well, I thank you for the tutorial, but explained me little. The fault is mine, I didn’t explained how I intend to use Camunda (or Activiti).

What I’m trying to do is to create a Spring Boot webapp that integrates the Camunda engine and REST API. I want only to use the Camunda Modeler to create the BPMN files, the rest of the job should be done by the webapp.

The tutorial you linked me is about external script, and I don’t need it. I need Java classes or, better, an expression, that allows me to invoke @Service methods, since in Spring the business logic should be put in the Service layer. This gives me a lot of power that a simple external script or a Java “class” (that will be used as a script too, in the end), gives me not.

If I understood well the tutorial, the variables can be “declared” in the connectors. Or, better, they can be checked in the connectors. The type is not declared. I find it very much confusing, I must say.

The problem is the tutorial does not explain how to declare process variables


#9

Try this then.


#10

Well, thank you but this is the first thing I’ve done. I already have a Spring Boot webapp with Camunda and a process that does nothing… The tutorial does not even mention process variables.


#11

Let me try to be clear:
You have a misconception that variables need to configured somehow in the modeler they do not. They are added in runtime as needed, either by java api or via the rest api - depending on the situation.

Variables are often only mentioned in runtime when configured gateways
e.g. a sequence flow leaving a gateway may have an expression #{approved} and of course this would require the at variable exists in runtime but there is no requirement to define the variable in the modeler.


#12

Ok, but so, what is the “Input/Output” tab in the properties of a Service Task?


#13

That tab can certainly confuse people. It’s basically only used in situations where you’d want to map a variable in the process instance to another variable in runtime

e.g. the service task has some code running that is asking for a variable “firstName” but the process variable created is called “name” you can simply map it’s value to a new variable.


#14

Ok, I have only two other questions:

  1. how can I define a Custom Type in User Task forms? If you select it, a field without label is displayed, a label field and a value field. I don’t understand how value can be a simple text form, since I suppose I can create a complex class. Or not?
  2. in an Exclusive Gateway, how can I design a sequence flow to be the default one if all the others does not match?

#15
  1. Adding UI via the modeler is pretty basic and only intended for prototyping. In reality forms should be created externally and linked to the task. We have a concept of “embedded forms” which appear in tasklist
  2. BPMN has a default flow, you can find it by selecting a sequence flow leaving a gateway and then using the wrench icon to morph it into a defualt flow.

#16

Well, in reality I want to create the form using Spring Boot, with a classic html file and a Controller that get the POST. I think I can then pass the variables to a Service method, that will set the variable to the process, and this method should be invoked at the end of the User Task, adding a listener with an expression like ${myTaskService.runAbc()}. Am I right?