Skip to content

Flynn Script

Frank Martinez edited this page May 2, 2018 · 3 revisions

Initial Proposal for "Flynn Script"

The concept is to allow the creation of a flogo application using a scripting paradigm as an alternative to a json configuration file. The scripting is intended to be specific to the use case of creating a flogo application and is not intended to be a generic scripting language. Given this, the goal is to:

  • Create a programming like interface, almost the feeling of pseudo code
  • Remove the burden of traditional programming language constructs and syntax
  • Simplify the understanding of the application logic with a limit on verbosity

Sample Script

import github.com/TIBCOSoftware/flogo-contrib/action/flow
import github.com/TIBCOSoftware/flogo-contrib/activity/subflow
import github.com/TIBCOSoftware/flogo-contrib/trigger/kafka
import github.com/me/activity/blah
import github.com/me/action/myAction

app() {	
    t = kafka(BrokerUrl:"url")

    t.handle(topic:"topic") {
        a = flow(flowURI:"flow:myflow1")
        a.run(i1:"input"”, i2:23)
        t.out1 = a.out1 
        t.out2 = a.out2  + 5
    }

    t.handle(topic:"topic2") {
        a = myAction().run(i1:”input1”, i2:23)
        t.out1 = a.out1 
        t.out2 = a.out2  + 5
    }
}

flow:myflow1(i1 string, i2 int) (out1 string, out2 int) {
    
    a1 = blah()
    a1.run(in1:1, in2:2, in3:3)

    if a1.out2 < 10 {
        a2 = blah().run(in1:3, in2:4, in3:5)
        a3 = blah().run(in1:6, in2:7, in3:a2.out)
        return a3.out1 + "blah", a3.out + 10
    }

    f1 = subflow().run(flow:"flow:myflow2", i1:"a", i2:a1.out1)

    return a1.out1 + "blah", 
           a1.out2 + 10
}

flow:myflow2(i1 string, i2 int) (out1 string, out2 int) {    
  ...
}
Clone this wiki locally