-
Notifications
You must be signed in to change notification settings - Fork 26
Home
This wiki contains the getting started content posted to both Bluemix and the Accelerate developer advocacy site.
Respond to messages and handle streams Create auto-scaling actions that execute logic in response to messages or streams.
A new programming model has emerged for cloud-native applications that enables developers to write code that responds to events, such as messages or new streams of data. Platforms like OpenWhisk provide the runtime environment to manage the containers to run that code, and automate the complete create, start, stop, destroy lifecycle of the compute resources needed. Because code runs only in response to events and is billed for the milliseconds used, rather than for idle resources reserved, this results in a better match between the cost of cloud resources consumed and business value earned.
This project shows the power of serverless, event-driven architectures to execute code in response to messages or to handle streams. It demonstrates two OpenWhisk actions, written in JavaScript that write and read text and image data to Cloudant, a hosted Apache CouchDB service. The use case demonstrates how actions can work with data services and execute logic in response to database changes.
One action connects to Cloudant and inserts text and binary data as an attachment. It is defined with package variables that provide it with Cloudant credentials as environment variables. It is uploaded to the OpenWhisk platform, where it can be invoked manually to test. A second action is created to respond to changes inserted into Cloudant by the first action. Instead of being manually invoked by the developer, a trigger and mapping rule are defined that bind it to the Cloudant database and listen for changes.
- The developer uploads and invokes the first action manually, this connects to Cloudant and inserts data.
- The data insert in turn fires an event called a trigger. This trigger is mapped to a second action by a rule.
- The second action executes in response to the event, inspects the data, and logs information to the console.
- OpenWhisk
- Cloudant
- OpenWhisk
- Cloudant
- TBD
Data Processing with Cloudant – Responding to database changes in an event-driven architecture
Computing has fundamentally changed as the Internet shifts away from human driven, request/response web applications. New cloud-native microservices are more and more likely to respond to machine or system initiated events than they are to human driven HTTP requests. This trends will continue as "things" outnumber humans on the Internet.
New computing models are emerging to address this trend, one of the most interesting is called "serverless."