Skip to content

Create ballerina/workflow code modifier #8449

@rdulmina

Description

@rdulmina

Area

Area/CompilerPlugin

Description

The following initial code modifications are needed

User code

import ballerina/workflow;

service "myworkflow" on new workflow:Listener() {


    remote function execute() returns string {
        var result = foo();
        return "Hello, World!";
    }

    @workflow:Signal
    remote function onSignal(string msg) {
        log:printInfo("Signal received: " + msg);
    }
}

@workflow:Activity
function foo() returns int {

}

Desugared Code

import ballerina/workflow;
import ballerina/workflow.internal as wfl;

//# Annotation to specify the workflow activities attached to a workflow service
//#
//# # Deprecated
//# Usage of this annotation is discouraged. This is an internal annotation.
//@deprecated
//public annotation map<function> __WorkflowActivities on service;


wfl:__WorkflowActivities {
    "foo" : foo;
}
service "myworkflow" on new workflow:Listener() {


    remote function execute() returns string {
        var result = foo(); // wfl:invokeActivity("foo");
        var res2 = int:fromString(foo()); 
        return "Hello, World!";
    }

    @workflow:Signal
    remote function onSignal(string msg) {
        log:printInfo("Signal received: " + msg);
    }
}

Tasks:

  • Scan all current modules' function calls with @activity annotation inside the execute method and desguar them into internal:invokeActivity()

Version

No response

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions