Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature invoke activity #73

Closed
wants to merge 18 commits into from
Closed

Conversation

rameshpolishetti
Copy link
Contributor

@rameshpolishetti rameshpolishetti commented Aug 13, 2019

This PR implements #69. It enhances rule action function to service. A service is constructed from a gofunction / flogo activity / flogo action.
When a rules fires, corresponding service input expressions would be resolved from tuple scope and then service gets executed (i.e underlying function/activity/action gets executed).

A service definition goes like this:

"services": [
  {
    "name": "ServiceFlowAction",
    "description": "Asynchronous flow action service",
    "type": "action",
    "ref": "github.com/project-flogo/flow",
    "settings": {
      "flowURI": "res://flow:sample_flow"
    }
  }
]

Invoking the service:

"rules": [
  {
    "name": "n1.name == function",
    "conditions": [],
    "actionService": {
      "service": "ServiceFunction",
      "input": {
        "message": "=$.n1.name"
       }
    }
  }
]

An example covering all varients of service is made available at - examples/flogo/invokeservice

@mellistibco mellistibco requested a review from fm-tibco August 13, 2019 14:36
@balamg
Copy link
Collaborator

balamg commented Aug 14, 2019

I'd like to see support added for invoking a flow as compared to an activity. That would be a general solution

@rameshpolishetti
Copy link
Contributor Author

@balamg Now I have added support to invoke flogo-action (ex: flow)

@fm-tibco
Copy link

fm-tibco commented Aug 22, 2019

Maybe you should consider leaving this as invoke activity? @skothari-tibco is implementing an activity that can invoke actions (not just flows). This way you have a lot more flexibility. If someone wants to invoke a simple rest call, they don't have to setup an entire flow for that.

I guess if you can invoke either activity or action in this implementation it is fine also.

@rameshpolishetti
Copy link
Contributor Author

Thank you @fm-tibco for sharing your input. Seems my PR message is not conveying enough about rule service in detail. In fact, this PR supports any action (not just flow-action) as rule service, as mentioned below:

"services": [
{
"name": "ServiceFlowAction",
"description": "Asynchronous flow action service",
"type": "action", ==> type can be "function" / "activity" / "action"
"ref": "github.com/project-flogo/flow", ==> It can be any flogo-action / flogo-activity reference
"settings": { ==> action/activity specific settings
"flowURI": "res://flow:sample_flow"
}
}
]
Comprehensive example is made available at: https://github.com/project-flogo/rules/tree/feature-invoke-activity/examples/flogo/invokeservice

Coming back to what to consider here activity vs action OR both - my original plan was to have just activity. As per the @balamg view mentioned above, action (flow) adds more value to rules.

Appreciate your further inputs.

@rameshpolishetti
Copy link
Contributor Author

closing this PR as an improved version of this feature (invoke activity) is available in develop branch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants