Apache OpenWhisk has the concept of Action Sequence. Where if we write, for example, functions f1
and f2
we can write a command which shall compose the functions in such a way that the output of f1
shall be piped to f2
.
For example, we have the first action asfunction1
:
function main(params) {
return {
string: params.text
};
}
And take the second action, function2
as follows:
function main(params){
return{
string: "Hello,"+params.string
};
}
Then we compose a new action as :
$ wsk action create fun2_o_fun1 --sequence function1,function2
And we invoke the new action as usual:
$ wsk action invoke fun2_o_fun1 -b -r -p text "Abhishek"
And we get the output as follows:
{ string: 'Hello,Abhishek' }
We note that here in the case of OpenFaaS the output of one function is automatically fed to the next function in the sequence when we create a new action with the --sequence
directive.
But here, in the case of OpenFaaS, we use a naive Linux-based utility to pipe the outputs of one function to the input of another. (This is done on the client side). But we try to create a wrapper that achieves the same for the server side.
Is this the only equivalent?