Joule
  • Welcome to Joule's Docs
  • Why Joule?
    • Joule capabilities
  • What is Joule?
    • Key features
    • The tech stack
  • Use case enablement
    • Use case building framework
  • Concepts
    • Core concepts
    • Low code development
    • Unified execution engine
    • Batch and stream processing
    • Continuous metrics
    • Key Joule data types
      • StreamEvent object
      • Contextual data
      • GeoNode
  • Tutorials
    • Getting started
    • Build your first use case
    • Stream sliding window quote analytics
    • Advanced tutorials
      • Custom missing value processor
      • Stateless Bollinger band analytics
      • IoT device control
  • FAQ
  • Glossary
  • Components
    • Pipelines
      • Use case anatomy
      • Data priming
        • Types of import
      • Processing unit
      • Group by
      • Emit computed events
      • Telemetry auditing
    • Processors
      • Common attributes
      • Filters
        • By type
        • By expression
        • Send on delta
        • Remove attributes
        • Drop all events
      • Enrichment
        • Key concepts
          • Anatomy of enrichment DSL
          • Banking example
        • Metrics
        • Dynamic contextual data
          • Caching architecture
        • Static contextual data
      • Transformation
        • Field Tokeniser
        • Obfuscation
          • Encryption
          • Masking
          • Bucketing
          • Redaction
      • Triggers
        • Change Data Capture
        • Business rules
      • Stream join
        • Inner stream joins
        • Outer stream joins
        • Join attributes & policy
      • Event tap
        • Anatomy of a Tap
        • SQL Queries
    • Analytics
      • Analytic tools
        • User defined analytics
          • Streaming analytics example
          • User defined analytics
          • User defined scripts
          • User defined functions
            • Average function library
        • Window analytics
          • Tumbling window
          • Sliding window
          • Aggregate functions
        • Analytic functions
          • Stateful
            • Exponential moving average
            • Rolling Sum
          • Stateless
            • Normalisation
              • Absolute max
              • Min max
              • Standardisation
              • Mean
              • Log
              • Z-Score
            • Scaling
              • Unit scale
              • Robust Scale
            • Statistics
              • Statistic summaries
              • Weighted moving average
              • Simple moving average
              • Count
            • General
              • Euclidean
        • Advanced analytics
          • Geospatial
            • Entity geo tracker
            • Geofence occupancy trigger
            • Geo search
            • IP address resolver
            • Reverse geocoding
            • Spatial Index
          • HyperLogLog
          • Distinct counter
      • ML inferencing
        • Feature engineering
          • Scripting
          • Scaling
          • Transform
        • Online predictive analytics
        • Model audit
        • Model management
      • Metrics engine
        • Create metrics
        • Apply metrics
        • Manage metrics
        • Priming metrics
    • Contextual data
      • Architecture
      • Configuration
      • MinIO S3
      • Apache Geode
    • Connectors
      • Sources
        • Kafka
          • Ingestion
        • RabbitMQ
          • Further RabbitMQ configurations
        • MQTT
          • Topic wildcards
          • Session management
          • Last Will and Testament
        • Rest endpoints
        • MinIO S3
        • File watcher
      • Sinks
        • Kafka
        • RabbitMQ
          • Further configurations
        • MQTT
          • Persistent messaging
          • Last Will and Testament
        • SQL databases
        • InfluxDB
        • MongoDB
        • Geode
        • WebSocket endpoint
        • MinIO S3
        • File transport
        • Slack
        • Email
      • Serialisers
        • Serialisation
          • Custom transform example
          • Formatters
        • Deserialisers
          • Custom parsing example
    • Observability
      • Enabling JMX for Joule
      • Meters
      • Metrics API
  • DEVELOPER GUIDES
    • Setting up developer environment
      • Environment setup
      • Build and deploy
      • Install Joule
        • Install Docker demo environment
        • Install with Docker
        • Install from source
        • Install Joule examples
    • Joulectl CLI
    • API Endpoints
      • Mangement API
        • Use case
        • Pipelines
        • Data connectors
        • Contextual data
      • Data access API
        • Query
        • Upload
        • WebSocket
      • SQL support
    • Builder SDK
      • Connector API
        • Sources
          • StreamEventParser API
        • Sinks
          • CustomTransformer API
      • Processor API
      • Analytics API
        • Create custom metrics
        • Define analytics
        • Windows API
        • SQL queries
      • Transformation API
        • Obfuscation API
        • FieldTokenizer API
      • File processing
      • Data types
        • StreamEvent
        • ReferenceDataObject
        • GeoNode
    • System configuration
      • System properties
  • Deployment strategies
    • Deployment Overview
    • Single Node
    • Cluster
    • GuardianDB
    • Packaging
      • Containers
      • Bare metal
  • Product updates
    • Public Roadmap
    • Release Notes
      • v1.2.0 Join Streams with stateful analytics
      • v1.1.0 Streaming analytics enhancements
      • v1.0.4 Predictive stream processing
      • v1.0.3 Contextual SQL based metrics
    • Change history
Powered by GitBook
On this page
  • What will we learn on this article?
  • Overview
  • Enrichment DSL structure
  • Query and response DSL explainer
  • Attributes explainer
  • Query syntax
  • by key
  • by query
  • Attributes schema
  • Response syntax
  • with values
  • all attributes
  • as object
  • Binding stores syntax
  • Attribute schema
  • Supported stores

Was this helpful?

  1. Components
  2. Processors
  3. Enrichment
  4. Key concepts

Anatomy of enrichment DSL

The enrichment DSL provides a flexible syntax that enables the user to define field level enrichments

What will we learn on this article?

In this section, we will learn about the enrichment process in Joule and focusing on how to add valuable data at the field level using different methods to an event in real-time.

We will cover:

  1. Enrichment structure Overview of enrichment types, including the query, response, and store binding approaches.

  2. DSL for enrichment How to define enrichment fields, set query and response parameters, and bind data stores using Joule’s Domain-Specific Language (DSL).

  3. Query vs. key-based lookups Using key or query-based methods to retrieve reference data, with examples for each approach.

  4. Response handling Options for handling responses, such as adding specific values, all attributes, or linking as objects.

  5. Enrichment stores Connecting fields to data stores, including custom and out-of-the-box stores supported by Joule.

Overview

Enrichment is applied at the field level whereby each returned data element is added to the defined field either as map of values or as a domain object.

The fields attribute is logical organised as three definition type:

  1. Query approach

  2. Response approach

  3. Binding store

Enrichment DSL structure

enricher:
  fields:      
    # field query definition
    deviceManufacturer:   
      ## Query and response per field
      ## :start          
         
      # 1. Query type and event variable value to use 
      by key: tac
      
      # 2. Response attribute/s              
      with values: [deviceManufacturer, year_released]

      # 3. Data store to query
      using: deviceStore
      
      ## :end

Query and response DSL explainer

Two key attributes are required for the enricher processor:

  1. with values: is to define which fields to enrich

  2. using: provides the data store binding

Attributes explainer

Attribute
Description

Fields

List of fields to populate with reference data using a lookup criteria.

Query type

Data is retrieved using either: - by key: Uses the indexed primary key within the query store for fast lookup. - by query: Uses ANSI SQL for data lookup, but the query must return only one row.

Response

Data store

Specifies which data store to query against, which can be either a custom or an OOTB supported store.

Query syntax

Contextual data is retrieved using one of two methods, by key or by query.

by key

Using the key based look up approach enables you to perform a look up against a store using either the primary key or the key within a caching solution.

Example returns specific attributes from ReferenceDataObject assigned to: deviceManufacturer

deviceManufacturer:
    by key: tac
    with values: [deviceManufacturer, year_released]
    using: deviceStore

Example returns a ReferenceDataObject as a linked object assigned to: modelDetails

modelDetails:
  by key: tac
  as object: true
  using: deviceStore

by query

To fine tune your enrichment process you can define a query rather than a strict key based look up. This would provide you with a greater flexibility to drive further pipeline processing.

Below represents a OQL based query using an in-memory cache solution.

contractedDataBundle:
    by query:  "select * from /userBundle where imsi = ?"
    query fields: [imsi]
    all attributes: true
    using: dataBundleStore

Attributes schema

Attribute
Description
Data Type

by query

Dependent upon linked data store

String

query fields

Event field values to be applied to the query

Ordered list of Strings

Response syntax

One of the attributes must be provided

Attribute
Description
Data Type

with values

Values to add to the field as a map of key value pairs

List of Strings

all attributes

Map all returned values attributes to event

Boolean

as object

Returned value is linked as a nobject to the event

Boolean

with values

Add specific attributes to the event.

Here we have selected the values deviceManufacturer and year_released to be included in the enrichment process.

deviceManufacturer:
    by key: tac
    with values: [deviceManufacturer, year_released]
    using: deviceStore

all attributes

Add all attributes to the event.

Here we have done a select * to ad all attributes to the enrichment process.

contractedDataBundle:
    by query:  "select * from /userBundle where imsi = ?"
    query fields: [imsi]
    all attributes: true
    using: dataBundleStore

as object

Add the returned object to the event using the field name.

deviceInformation:
    by key: tac
    as object: true    
    using: deviceStore

Binding stores syntax

Bind the field configuration to a data store using a logical store name. This would either be custom or using the pre-defined stores.

deviceInformation:
    by key: tac
    as object: true    
    using: deviceStore

Attribute schema

Attribute
Description
Data Type
Required

using

Store name to apply query processing. Either a custom or supported store

String

Supported stores

If either one of these are provided there is no need to specify the stores attribute.

  • JouleDB Use custom data sets imported on process initialisation such as static data.

  • MetricsDB Use computed live metrics.

PreviousKey conceptsNextBanking example

Last updated 6 months ago

Was this helpful?

A is returned on a successful query, which is unpacked using the defined attributes or linked to the event.

On a successful data retrieval the response object () key values are added directly in to the event or added as an object.

Here we have included the returned in the enrichment process.

ReferenceDataObject
ReferenceDataObejct
ReferenceDataObject