Skip to main content

When to Use Action Models

Action models (COLLAPSED models) are templates for structured data that you publish explicitly from within actions. They’re ideal when you need:
  • Control over timing - Publish only when specific conditions are met
  • Dynamic routing - Send data to different topics based on logic
  • Data transformation - Process and enrich data before structuring
Unlike basic models that trigger automatically on topic changes, action models let you decide exactly when and where structured data is created.

Example Use Case

Imagine you receive raw alarm data and need to:
  1. Extract relevant fields from JSON
  2. Add a unique ID and timestamp
  3. Route critical alarms to a special topic
  4. Publish a structured record

Step-by-Step Guide

1

Define a COLLAPSED Model

Create a template with all required fields. The COLLAPSED keyword indicates this model has no automatic trigger:
2

Create the Processing Action

Define an action that extracts data and publishes the model:
3

Test the Flow

Publish to: sensors/temp001/json_data
Result at: sensors/processed/temp001

Use Case Examples

Route alarms by severity while creating structured records:

Best Practices

Explicit type casting prevents runtime errors:
Check data before publishing:
Include identifiers in output topics for easy filtering:
Use RANDOM UUID for record identification:

Next Steps

Model Examples

See complete examples for common use cases.

Action Operations

Review available operations for action logic.
Last modified on May 22, 2026