Skip to content

Instantly share code, notes, and snippets.

Avatar

Tihomir Surdilovic tsurdilo

View GitHub Profile
View gist:729d5e1b4eb1c44df4008bb1d05d971b
GitHub: https://github.com/serverlessworkflow
Website: http://serverlessworkflow.io
Slack: https://slack.cncf.io/ #serverless-workflow
Meetings: https://www.cncf.io/community/calendar/
View gist:94a5945846073294ebb344ca03583747
```json
{
"id": "helloworld",
"version": "1.0",
"name": "Hello World Workflow",
"description": "Inject Hello World",
"states":[
{
"name":"Hello State",
"type":"inject",
View gist:51c229fc9a0e154037aa7b8c1c273a12
curl -i -H "Accept: application/json" -H "Content-Type: application/json" -H "ce-id: 123" -H "ce-type: lastChainLink" -H "ce-source: test" --data '"Start"' http://localhost:8080/
View gist:3eacbc11930efde30b0aaffcc941dcc9
{
"id": "123",
"name": "abc",
"events": [],
"functions": [],
"states": [],
"extensions": [
{
"id": "workflow-kpi-extension",
"content": "/a/b/c/d/e/mykpi.json"
View gist:d5294cb5a54a04fea4aa5dbe8713c93e
{
"id": "123",
"name": "abc",
"events": [],
"functions": [],
"states": [],
"extensions": [
{
"id": "workflow-kpi-extension",
"content": {
View gist:6fc8e26f44b792feb923f85947af3b45
{
"id": "123",
"name": "abc",
"events": [],
"functions": [],
"states": [],
"extensions": [
{
"extensionsid": "workflow-kpi-extension",
"currency": "USD",
View gist:b44e174ec289b721932f3c560b86fccc
Let's say we are developing an extension which adds additional information
to a serverless workflow that can be passed and processed by a simulation tool.
Our example extension can add "scenarios". Each scenario
can add "time" parameters for each of the workflow states and define a min and max value
within which the workflow state should be executed in. It should also add a "probability" parameter
which defines the probability that a state is triggered during the execution of the workflow.
So let's define a simple example workflow model and then add our custom extension into it:
View gist:3a89dc2fcc5294fba5cae8ad6cf7b8f6
{
"id": "VetAppointmentWorkflow",
"description": "Vet service call via events",
"version": "1.0",
"events": [
{
"name": "MakeVetAppointment",
"source": "VetServiceSoure",
"kind": "produced"
},
View gist:c94aca4d2c912fd5ddd6d25a691ca129
{
"id": "VetAppointmentWorkflow",
"description": "Vet service call via events",
"version": "1.0",
"functions": [
{
"name": "VetAppointmentService",
"triggerEventRef": "MakeVetAppointment",
"resultEventRef": "VetAppointmentInfo"
}