Skip to content

App Model

Frank Martinez edited this page Jul 30, 2018 · 14 revisions

The updated app model to be available in 0.5.6 is as follows:

{ 
   "name":"test",
   "type":"flogo:app",
   "version":"0.0.1",
   "appModel":"1.0.0",
   "description":"My flogo application description",
   "triggers":[ 
      { 
         "id":"my_rest_trigger",
         "ref":"github.com/TIBCOSoftware/flogo-contrib/trigger/rest",
         "settings":{ 
            "port":"9233"
         },
         "handlers":[ 
            { 
               "action": { 
                   "ref":"github.com/TIBCOSoftware/flogo-contrib/action/flow",
                   "data":{ 
                          "flowURI":"res://flow:myflow"
                    },
                   "mappings":{ 
                       "input":[ 
                        ],
                       "output":[ 
                       ]
                   }
                },
               "settings":{ 
                  "method":"GET",
                  "path":"/test"
               }
            },
            { 
               "action": { 
                   **"id":"sharedAction",**
                   "mappings":{ 
                       "input":[ 
                        ],
                       "output":[ 
                       ]
                   }
                },
               "settings":{ 
                  "method":"GET",
                  "path":"/test2"
               }
            }
         ]
      }
   ],
   **"actions":[ 
      { 
         "id" :"sharedAction",
         "ref":"github.com/TIBCOSoftware/flogo-contrib/action/flow",
          "data":{ 
             "flowURI":"res://flow:myflow"
          },
      }
   ],**
   "resources":[ 
      { 
         "id":"flow:myflow",
         "data": {
            "name": "My Flow",
            "description": "Example description",
            "metadata":{ 
               "input":[ 
                  { "name":"customerId", "type":"string" },
                  { "name":"orderId", "type":"string" }
               ],
               "output":[ 
                  { "name":"value", "type":"string" }
               ]
            },
            "tasks":[ 
               { 
                  "id":"FirstLog",
                  "name": "FirstLog",
                  "type":"iterator",
                  "settings":{ 
                     "iterate":"10"
                  },
                  "activity":{ 
                     "ref":"github.com/TIBCOSoftware/flogo-contrib/action/flow",
                     "output":{ },
                     "mappings":{ 
                        "input":[ 
                           { 
                              "type":"assign",
                              "value":"$current.iteration.key",
                              "mapTo":"message"
                           }
                        ]
                     }
                  }
               },
               { 
                  "id":"SecondLog",
                  "name":"SecondLog",
                  "activity":{ 
                     "ref":"github.com/TIBCOSoftware/flogo-contrib/action/flow",
                     "input":{ 
                        "message": "test message"
                     },
                     "output":{ },
                     "mappings":{ }
                  }
               }
            ],
            "links":[ 
               { 
                  "from":"FirstLog",
                  "to":"SecondLog",
                  "type":"expression",
                  "value":"$flow.orderId > 1000"
               }
            ],
            "errorHandler": {
               "tasks": [
                  { 
                     "id":"SecondLog",
                     "activity":{ 
                         "ref":"github.com/TIBCOSoftware/flogo-contrib/activity/log",
                         "input":{ 
                             "message": "log in error handler"
                         },
                         "output":{ },
                         "mappings":{ }
                     }
                  }
               ]
            }
         }
      }    
   ]
}
Clone this wiki locally