Skip to main content


The framework provides feature to extend datasources where you can add new datasources with any customized type as per your business logic.

8.6.1 Datasource definition

You can define your datasource in yaml file inside src/datasources directory. For example, newDatasource.yaml is defined in the datasources.

├── config
└── src
├── datasources
│   └── httpbin.yaml
│   ├── kafka1.yaml
│   └── newDatasource.yaml
├── events
├── functions
└── mappings

The three keys in yaml type, loadFn and executeFn are mandatory to define any new datasource which is not provided by the framework as core datasources. You can define other key/vaue pairs as per your need.

Below is a sample of newDatasource.yaml

type: sample
loadFn: com.sample.loader
executeFn: com.sample.execute
client_id: sample123


It defines the type of the datasource like api, soap, datastore, etc.


It defines the load function which loads the client for the datasource. The developer must define the load function in the workflows as mentioned in the below project structure. The loadFn can be a js/ts function which takes the datasource yaml as an input and return an object that contains client.

├── config
└── src
├── datasources
├── events
├── functions
│   └── com
│   └── sample
│   ├── loader.ts
│   └── execute.ts
└── mappings

A sample of loader.ts

export default async function(args:{[key:string]:any;}) {
const ds = {
client: new SampleClient(args)
return ds;


It defines the execute function which gets executed in the workflow. The developer must define the execute function in the workflows as mentioned in the above project structure. The executeFn can be a js/ts function which takes the workflow args as input and return status/output.

export default async function(args:{[key:string]:any;}) {
if(args.datasource) {
const client = args.datasource.client;
const data =;

if (!Array.isArray( {
data = [];
. . . . . . . . . .
} else {
return { success: false, code: 500, data: 'datasource not found in the workflow' };

8.6.2 Example spec for the event

id: sample_event
fn: com.jfs.sample_helloworld
description: The body of the query
required: true
application/json: # For ex. application/json application/xml
type: object
type: string
required: [name]

8.6.3 Example spec for the workflow

summary: hello world
- id: helloworld_step1
fn: com.sample.execute
datasource: newDatasource
data: <% inputs %>
method: sample