Eventing Service: Fundamentals

Eventing Service: Fundamentals

The Couchbase Eventing Service is a multidimensional-scaling(MDS) enabled service that lets you process changes to data as they happen in real-time.

Eventing Service

The Couchbase Eventing Service provides near real-time handling of changes to data. It consists of event-oriented, programmable constructs: code can be executed both in response to document-mutations, and as scheduled by timers.

This page provides an overview of the service, describing prominent use-cases and benefits. It also introduces the Functions offering which enables you to write server-side functions that are automatically triggered using the familiar Event-Condition-Action model. Functions let you develop and debug the code on generated mutations to the data residing in a Couchbase cluster.

Functions

Within the Eventing Service framework, Functions handle data-changes according to an Event-Condition-Action model. This provides a highly performant, fault-tolerant development platform that is highly supportive of business-logic, and so facilitates the deployment of business-rules.

Whenever a document is created, updated, or deleted on Couchbase Server, Functions handle the event that is duly generated. This as a Service approach eradicates the need for multiple writes from the application tier; and makes polling from the middle tier unnecessary. Architecturally, the possibility of layer consolidation is thereby increased.

The Functions offering is implemented in JavaScript. Note that some language-constructs have been constrained; and others have been added, to enhance performance and semantics.

Features Provided

The Eventing Service and Functions provide the following features:

  • Notification before expiry
  • Threshold-based monitoring and alerting
  • Propagation of changes to other systems
  • Enrichment of content in near real-time
  • Triggering of routines on given documents at specified intervals
  • Deletion-cascade

Use Cases

A subset of important industry-specific use-cases is as follows:

  • Media and Entertainment: News alerts, content expiration and archival, enrichment
  • Financial Technology: Tickers, event propagation, risk modeling, trade summaries
  • Healthcare: Monitoring vitals, A/B risk assessments
  • Telecommunications and Internet of Things: Call monitoring and alerts, network performance, sensor monitoring
  • Travel and Hospitality: Price alerts, special promotions
  • Law, Defense, and Security: Transient event detection, real-time compliance
  • Retail, SCM, and Logistics: Instant loyalty, wishlists, stock replenishments, price alerts.
  • Sports and Gaming: leader board, bet analysis, statistics products

Benefits

Benefits can be summarized as follows:

  • Improving customer experience and engagement
    • Near real-time processing of customer interactions
    • Easier data-enrichment capabilities, leading to a personalized customer experience
    • Easier identification of needles in the haystack, with minimized overhead
  • Faster innovation and reduced time-to-market
    • Quicker development cycles, and improved developer experience, leading to earlier Minimum-Viable-Products (MVPs).
    • Lower barrier to technology-adoption by business operations
    • Faster response to business-change
  • Reducing infrastructure and operations-cost
    • Simpler deployment-models, with an integrated approach to infrastructure
    • Avoidance of data-leaks, leading to better data-governance
    • Highly performant and fault-tolerant service at scale

Terminology

The following terms are frequently used in descriptions of Eventing.

  • Binding: A construct that allows the separating of environment-specific variables — such as bucket-names, external endpoint URLs, and credentials — from handler source-code. It allows functions to be developed without source changes being required to production workflows.

  • Function: A collection of handlers (each being either OnUpdate or OnDelete), implementing a composite business-functionality. Resources are managed at or above function level, and the state of all handlers is scoped by the containing function.

  • Handler: A stateless, short-running code-fragment that reacts to a specified event. One or more handlers together constitute a function. A handler must execute from start to finish, prior to a specified timeout-duration. OnUpdate or OnDelete are the only two handlers currently exposed.

  • Redeployment: Functions do not have a native concept of redeployment in Couchbase Server 5.5. However, deployment with the DCP provider option of starting with the last sequence-number processed by the prior deployment of this function is sometimes referred to as redeployment.

  • Statelessness: The persistent state of a function is captured by entities listed below, while any state that appears on the execution stack is ephemeral.
    • The metadata bucket (which will eventually be a system collection)
    • The document being observed and its Extended Attributes
    • The storage-providers bound to the function