Server variables

We have 2 Flowable servers. 1 Production and 1 development.
These are normal tomcat servers that have the war files deployed.

Depending on the server the variables used in flows will be different.
For example in development the rest calls to sap should go to the sap development server.
In production the rest calls need to go to the production server.

I would like to set these variables on the server so they are accessible in the flows as a variable.
Ideally these are saved in a properties file or in an “bean xml” file.

I believe this issue was also requested here: Process engine variable scope

Hi,

Like I mentioned in the referenced post you can already do this by using Spring properties / beans and reference these in JUEL expressions. Or are you looking for something different?

Best regards,

Tijs

Hi Tijs,

I’m a bit in over my head :frowning:

Is this the documentation: http://www.flowable.org/docs/userguide/index.html#springExpressions

Sebastiaan

I created the following bean and placed it in /flowable-task/WEB-INF/lib

"
package eu.newtec.ibq.flowable;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.stereotype.Component;

@Component
@Configuration
public class Printer {

@Bean
public void printMessage() {
	System.out.println("hello world");
}

}
"

Created the following javascript task:
print(“test”);
var var1 = execution.getVariable(“Printer.printMessage()”);
print(var1);

var var2 = execution.getVariable(“printMessage()”);
print(var2);

Result =
test
null
null

Any idea what I’m doing wrong?

That isn’t correct: you are fetching a variable, but trying to call an expression.

You’d need a regular service task with an expression, like this: expression="${printer.PrintMessage()} to invoke the spring bean. No need to set these beans as variables, having a different implementation in a different environment will already allow you to change behaviour.

If I understand correctly I cannot invoke the spring bean from a script task?

Is there any way of declaring “server variables” and accessing them from a script task?

Some prosa:
What I like about a script task is that you don’t need a server reboot when changing some code.
Another advantage is that the script task is versioned together with the BPM drawing.
The “http call” task made this extra powerful since complex logic can be written outside of Flowable and can thus be easily modified.