Skip to main content

Best Practices for Workflow Creation in RCOM Gateway

Creating workflows in RCOM Gateway is about more than assembling action blocks, it's about designing scalable, resilient automation that mirrors real-world processes. This guide outlines the key principles and checks to follow for effective and sustainable workflow development.

1. Plan Before You Build

  • Define the event clearly: Identify the exact trigger. Avoid vague conditions like “item moved”, prefer “item scanned at Dock A.”
  • Outline the data: List out what fields you'll receive (e.g., product ID, timestamp, location) and what is needed downstream.
  • Draft the logic: On paper or whiteboard, map out the workflow: conditions, branches, storage updates, alerts, etc.
  • Choose the right ingestion channel (REST, MQTT, Scheduler) depending on real-time vs scheduled behavior.

2. Structure Object Groups Thoughtfully

  • Define Object Groups for every logical data entity you persist (e.g., Products, Patients, Devices).
  • Use camelCase or underscores for internal identifiers (e.g., inventoryItems).
  • Design Object Structures with:
    • A primary identifier field (e.g., productId)
    • Clearly typed attributes (e.g., String, DateTime, Bool)
    • Nullable flags for optional fields
    • References for relational linking (e.g., linking pallet to storage zone)
  • Enable trigger-on-change if the workflow depends on object updates.

3. Workflow Design Tips

  • Name your workflow descriptively (e.g., ColdZoneEntryValidation).
  • Use parameters for input data passed from the Event Processor.
  • Keep workflows modular, use logical grouping of actions with labels and color coding.
  • Use action blocks judiciously:
    • Use Condition for branching
    • Cast* actions to convert types early (especially for numbers, booleans, dates)
    • SerializeToJson and JsonPathValue for handling dynamic payloads.

4. Connection Line Management

  • Understand how logic flows:
    • Green Solid: Required and successful
    • Red Solid: Required but failed
    • Dashed: Optional branches
  • Use minimal crisscrossing arrows for readability. Group conditionals clearly.

5. Data Access & Integrity

  • Use GetObjectsOfAttributes, GetObjectsOfObjectGroup or GetObjectsOfStorage for querying data.
  • Validate existence before using results.
  • Never assume attributes will exist, handle null or false cases.
  • When updating:
    • Ensure object group and structure match
    • Avoid overwriting unintended attributes

6. Error Handling and Logging

  • Add Log at critical decision or failure points.
  • Set log level appropriately: INFO for checkpoints, ERROR for breaks.
  • Use SetHttpResponse in API-based workflows to communicate outcomes to callers.

7. Testing and Debugging

  • Use the Workflow Logs and Context Viewer to inspect:
    • Runtime variable values
    • Execution trace and errors
  • Common statuses:
    • Completed: Success
    • AbortedDueToFailedAction: Broken logic or invalid data
    • CompletedButFailureOnDBUpdates: Likely object group/schema mismatch.

8. Performance Optimization

  • Avoid excessive While or nested ForEach blocks, these can bottleneck execution.
  • Use SetVar to batch set multiple values instead of one at a time.
  • Query only needed columns in GetObjectsOfObjectGroup to reduce memory and network overhead.

9. Security and Access Control

  • Use OAuth2 or Basic Auth in production REST endpoints.
  • Avoid noauth unless in development mode.
  • Control data visibility using Object Group Types and role-based access permissions.

10. Maintenance & Scalability

  • Version your workflows meaningfully (v1, v2, v2.1-beta).
  • Document non-obvious logic inside Description fields and action annotations.
  • Regularly review usage logs and job outcomes to refine or deprecate old workflows.