Does FEEL support eval() function? If not, would you like to add it?

Dear Sir,

In camunda-connector-kafka, ‘correlationKey’ and ‘correlationKeyExpression’ is configured using FEEL to dynamically extract value from a variable with its name defined in FEEL, as in screen shot below, where ‘requestId’ is variable name.

image

I want to make the bpmn process definition more dynamic & flexible, i.g. the variable name can come from value of another variable. An ‘eval(…)’ function can satisfy it. For example, change the correlationKey in above screen shot from “=requestId” to “=eval(requestExpressionVariableName)”, here ‘requestExpressionVariableName’ is the name of a variable, its value can be ‘requstId’ or some other String value, which then will be recognized as variable name by ‘eval(…)’.

Does FEEL support ‘eval()’ function? If not, would you like to add it?

Hi @kerler, welcome to the forums! FEEL is a maintained specification by the OMG Group (part of the DMN spec), and eval is not currently part of that spec.

Can you share a bit more about your use case? What process model do you have that you can reuse with only changing a single variable name? How do you envision using this process?

I want to write a general template bpmn process for implementing a general template SAGA transaction, with using camunda-connector-kafka/pulsar. In the general template SAGA bpmn process, the start event message contains all the parameters configured for a concrete SAGA. If all the parameters in the configuration are dynamic/configurable, the general template SAGA bpmn process would be more flexible.

With general template SAGA bpmn process, to support a concrete SAGA, application developer just need to implement every single micro service which only know kafka/pulsar without knowing Camunda/Zeebe, and then a gateway application produce a kafka/pulsar message which including all the parameters for the concrete SAGA, then a process instance of the general template SAGA bpmn process will be created to implement the concrete SAGA.

(By the way, without eval() function, the general template SAGA bpmn process can be written, the drawback is that the flexibility is a little worse.)

The data structure of the start event message of general template SAGA bpmn process is like code below, and followed by the screen shot of the general template SAGA bpmn process (not done yet) (not using compensation event as Camunda 8.4 has not supported it).

‘class CorrelationBetweenMessageAndProcessInstancePath’ contains two fields, each of them is a FEEL expression. In the input box ‘Correlation key (process) fx’ in the screen shot, I wish I can input like ‘=eval(…correlationBetweenMessageAndProcessInstancePath.correlationKeyExpressionInVariableInProcessInstancePath)’

public class SagaModel {

public final List<TransactionStage> transactionStageList;

public class TransactionStage {

public final List<TransactionCommandPair> transactionCommandPairList;

public class TransactionCommandPair {

public final TransactionCommand doCommand;
public final TransactionCommand undoCommand; //compensate

public class TransactionCommand {

public final RequestInfoFromCoordinatorToMessageBroker requestInfoFromCoordinatorToMessageBroker; //Coordinator might be a process engine such as zeebe/camunda 8
public final ResponseInfoToCoordinatorFromMessageBroker responseInfoToCoordinatorFromMessageBroker; 

public class RequestInfoFromCoordinatorToMessageBroker {

public final MessageBrokerAndTopicInfo messageBrokerAndTopicInfo;
public final MessageInfo messageInfo;
public final VarialeMappingInCoordinator varialeMappingInCoordinator;
public final ErrorHandlingInCoordinator errorHandlingInCoordinator;

public class ResponseInfoToCoordinatorFromMessageBroker {

public final MessageBrokerAndTopicInfo messageBrokerAndTopicInfo;
public final String subscriptionName;

public final CorrelationBetweenMessageAndProcessInstancePath correlationBetweenMessageAndProcessInstancePath; //Correlation in coordinator such as zeebe/camunda 8
public final VarialeMappingInCoordinator varialeMappingInCoordinator;

public class CorrelationBetweenMessageAndProcessInstancePath {

public final String correlationKeyExpressionInVariableInProcessInstancePath; //FEEL in zeebe/camunda 8
public final String correlationKeyExpressionInMessage; //FEEL in zeebe/camunda 8