Skip to content
Daniel Krook edited this page Mar 5, 2018 · 1 revision

Serverless reference architecture with IBM Cloud Functions (powered by Apache OpenWhisk)

This wiki contains the getting started content posted to both the IBM Cloud console and the IBM Code Pattern site.

IBM Cloud tile title and description / IBM Code title/subtitle

Respond to messages and handle streams Create autoscaling actions that respond to message streams.

IBM Code description

Serverless platforms, like IBM Cloud Functions powered by Apache OpenWhisk, provide a runtime that scales up or down automatically in response to demand. This results in overall lower cloud resource consumption and a better match between business value gained and the cost of the resources that are used. One of the key use cases for Cloud Functions is to execute logic efficiently in response to events, such as messages or streams of data.

Technologies

  • Messaging
  • Serverless

Deployment models

  • Cloud

IBM Code overview

This project shows how serverless, event-driven architectures execute code in response to messages or to handle streams of data records.

The application demonstrates two IBM Cloud Functions (based on Apache OpenWhisk) that read and write messages with IBM Message Hub (based on Apache Kafka). The use case demonstrates how actions work with data services and execute logic in response to message events.

One function, or action, is triggered by message streams of one or more data records. These records are piped to another action in a sequence (a way to link actions declaratively in a chain). The second action aggregates the message and posts a transformed summary message to another topic.

IBM Code flow and diagram

  1. The developer simulates a client publishing application and puts a new array of JSON objects onto an Apache Kafka topic.
  2. The message fires an event called a trigger that listens for messages sent to that topic.
  3. This trigger is mapped to the first action by a rule, which downloads and parses the message array.
  4. The message array is then sent to another action in a sequence to aggregate, or reduce, the data to a single message.
  5. The second action posts the new message to another Message Hub queue for another application to process.

IBM Code components

  • IBM Cloud Functions
  • IBM Message Hub

IBM Code links

  • What makes serverless architectures so attractive? - Serverless architectures are one of the hottest trends in cloud computing this year, and for good reason. There are several technical capabilities and business factors coming together to make this approach very compelling from both an application development and deployment cost perspective.

  • Build a cloud-native app with Apache OpenWhisk - At this live coding event, Daniel Krook provides an overview of serverless architectures, introduces the OpenWhisk programming model, and then deploys an OpenWhisk application on IBM Bluemix, while you watch, step-by-step.

IBM Cloud blog post

Analyze streaming Message Hub records with OpenWhisk

In many of today's cloud-native applications, data is generated at huge volumes and is used to link highly distributed services. Apache Kafka provides a system to stream messages at scale, but the systems that receive those messages must be able to process and act on individual records as well.

With an event-driven architecture built on OpenWhisk, you can write functions that respond to messages from queues and execute logic to process or send data to other systems in a distributed architecture. And you'll pay only for the resources consumed by your analytics functions for the fractions of a second that they run. This gives you a tight match between transactions processed and cloud resources used.

This is the promise of an event-driven, serverless architecture for new cloud-native applications such as those that support high volume stream-based message processing. Check out the new OpenWhisk demo on responding to Message Hub records and start processing messages at scale, not worrying about whether you'll have enough servers manage the volume.