Playing With OpenWhisk

IBM recently launched OpenWhisk
, their new “serverless”
compute platform.

This service allows developers to register small bits of code that are executed on-demand in response to external events. The “serverless” stack started in 2014, when Amazon launched Lambda
, but is now set to be a major technology trend in 2016 with IBM, Microsoft and Google all launching their own solutions.

OpenWhisk is the first open-source “serverless” platform
. It supports running registered actions in Node.js, Swift and even executing custom Docker containers.

Playing around with the technology recently, I’ve created two projects using the platform.

OpenWhisk Client Library

OpenWhisk exposes a RESTful API
for interacting with the service. Wrapping this API with a small client library
makes it easy for developers to interact with the service from JavaScript.

This library has been donated back to the OpenWhisk project and is available through NPM

const openwhisk = require('openwhisk')
const ow = openwhisk({api: '', api_key: '...', namespace: '...'})
ow.actions.invoke({actionName: 'action'}).then(result => {
  // result is service response


This project
, available through NPM
, makes it easy to run arbitary JavaScript functions as OpenWhisk actions. Passing a reference to a JavaScript function into the module, an OpenWhisk action is created using the function source. The module returns a new JavaScript function, that when executed, will call the remote action and returns a Promise with the service response.

const whiskify = require('whiskify')({api: 'https://', api_key: '...', namespace: '...'})
const action = whiskify(function (item) { return item + 1; })

action(1).then(function (result) {
  // == 2
})[1, 2, 3, 4]).then(function (result) {
 // == [2, 3, 4, 5]


This project uses the client library above.

稿源:James Thomas (源链) | 关于 | 阅读提示

本站遵循[CC BY-NC-SA 4.0]。如您有版权、意见投诉等问题,请通过eMail联系我们处理。
酷辣虫 » 后端存储 » Playing With OpenWhisk

喜欢 (0)or分享给?

专业 x 专注 x 聚合 x 分享 CC BY-NC-SA 4.0

使用声明 | 英豪名录