title | weight |
---|---|
Counter |
4609 |
This activity allows you to use a global counter.
This activity comes out of the box with the Flogo Web UI
flogo add activity github.com/TIBCOSoftware/flogo-contrib/activity/counter
Inputs and Outputs:
{
"input":[
{
"name": "counterName",
"type": "string",
"required": true
},
{
"name": "increment",
"type": "boolean"
},
{
"name": "reset",
"type": "boolean"
}
],
"output": [
{
"name": "value",
"type": "integer"
}
]
}
Setting | Required | Description |
---|---|---|
counterName | True | The name of the counter |
increment | False | If this field is set to true, increment the counter by one |
reset | False | Reset the counter. If reset is set to true, increment is ignored |
value | False | The value of the counter after executing the increment or reset |
The below example increments a 'messages' counter:
{
"id": "counter_1",
"name": "Increment Counter",
"description": "Simple Global Counter Activity",
"activity": {
"ref": "github.com/TIBCOSoftware/flogo-contrib/activity/counter",
"input": {
"counterName": "messages",
"increment": true
}
}
}
The below example retrieves the last value of the 'messages' counter:
{
"id": "counter_1",
"name": "Increment Counter",
"description": "Simple Global Counter Activity",
"activity": {
"ref": "github.com/TIBCOSoftware/flogo-contrib/activity/counter",
"input": {
"counterName": "messages"
}
}
}
The below example resets the 'messages' counter:
{
"id": "counter_1",
"name": "Increment Counter",
"description": "Simple Global Counter Activity",
"activity": {
"ref": "github.com/TIBCOSoftware/flogo-contrib/activity/counter",
"input": {
"counterName": "messages",
"reset": true
}
}
}