LogoLogo
IntegrationsInstallationAdministrationContact Support
XMPro Platform
XMPro Platform
  • What is XMPro?
  • Getting Started
    • Browser Requirements
    • End-To-End Use Case
  • Resources
    • What's New in 4.4
      • What's New in 4.3
      • What's New in 4.2
      • What's New in 4.1.13
      • What's New in 4.1
      • What's New in 4.0
    • Blueprints, Accelerators & Patterns
    • Integrations
    • Sizing Guideline
    • Platform Security
    • Icon Library
    • FAQs
      • Implementation FAQs
      • Configuration FAQs
      • Agent FAQs
      • General FAQs
      • External Content
        • Blogs
          • 2024
            • How to Build Multi-Agent Systems for Industry
            • Why Solving the Problem Doesn’t Solve the Problem: The Importance of Scalable Intelligent Operations
            • Content, Decision, and Hybrid: The Three Pillars of Multi-Agent Systems in Industry
            • Revolutionizing Manufacturing with AI and Generative AI: XMPro’s Intelligent Business Operations Sui
            • The Evolution of Skills: Lessons from Agriculture in the GenAI and MAGS Era
            • Part 1: From Railroads to AI: The Evolution of Game-Changing Utilities
            • Part2: The Future of Work: Harnessing Generative Agents in Manufacturing
            • Bridging Automation and Intelligence: XMPro’s Approach to Industrial Agent Management
            • XMPro APEX: Pioneering AgentOps for Industrial Multi Agent Generative Systems
            • Part 5 – Rules of Engagement: Establishing Governance for Multi-Agent Generative Systems
            • How to Achieve Scalable Predictive Maintenance for Industrial Operations
            • Understanding the Difference Between XMPro AI Assistant and AI Advisor
            • Part 3 – AI at the Core: LLMs and Data Pipelines for Industrial Multi-Agent Generative Systems
            • MAGS: The Killer App for Generative AI in Industrial Applications
            • The Importance of Pump Predictive Maintenance for Operational Efficiency
            • Progressing Through The Decision Intelligence Continuum With XMPro
            • The Value-First Approach to Industrial AI: Why MAGS Implementation Must Start with Business Outcomes
            • New Guide – The Ultimate Guide to Multi-Agent Generative Systems
            • The Ultimate Guide To Predictive Analytics
            • Part 4 – Pioneering Progress | Real-World Applications of Multi-Agent Generative Systems
            • Scaling Multi-Agent Systems with Data Pipelines: Solving Real-World Industrial Challenges
          • 2023
            • How to master Predictive Analytics using Composable Digital Twins
            • Accelerate Your AI Workflow: The 3 Key Business Advantages of XMPro Notebook
            • The Roadmap to Intelligent Digital Twins
            • What is edge computing, and how can digital twins utilize this technology?
            • THE TOP 5 USE CASES FOR COMPOSABLE DIGITAL TWINS IN RENEWABLES + HOW TO SUPERCHARGE RESULTS WITH AI
            • The Technology Behind Predictive Maintenance (PdM) : Hardware & Software
            • The Benefits of Using Digital Twins in Smart Manufacturing
            • XMPro I3C Intelligent Digital Twins Strategy Framework
            • The TOP 5 use cases for composable digital twins in mining – and how to use AI to supercharge result
            • The TOP 5 use cases for Composable Digital Twins in the Oil & Gas industry
            • Why Decision Intelligence with Digital Twins is “kinda like” DCS for Automation and Control
            • XMPro becomes an NVIDIA Cloud-Validated partner
            • From Reactive to Predictive : Introduction to Predictive Maintenance
            • Microsoft Azure Digital Twins : Everything You Need To Know
            • Unlocking Efficiency: The Right Time & Strategy to Launch Your Digital Twin for Enhanced Asset Manag
            • Revolutionize Your Supply Chain: How Digital Twins Can Boost Efficiency and Cut Costs
          • 2022
            • Create a Common Operating Picture of Your Operations with XMPro
            • 7 Trends for Industrial Digital Twins in 2022
            • How to Build a Digital Twin + 60 Use Cases By Industry
            • What are composable digital twins in the metaverse?
          • 2021
            • The Value of a Composable Digital Twin
          • 2020
            • Lean Digital Twin: Part 2
            • Digital Twin: Your Most Productive Remote Worker
            • From the Control Room to the Bedroom
            • Lean Digital Twin: Part 3
          • 2019
            • My Digital Twin: Digital Twin Applications for Real-time Operations (Like Me)
          • 2018
            • XMPro IoT Operational Capability Survey Results 2018
            • What is a Digital Business Platform and Why Should I Care?
            • [Robotic] Process Automation for IoT
            • 3 Patterns of Industrial IoT Use Cases
            • The CXO’s Guide to Digital Transformation – May The Five Forces Be With You
            • Is Security More Important Than Trustworthiness for Industrial IoT?
            • XMPro at bpmNEXT 2018: Watch The Presentation
          • 2017
            • The Top 5 Reasons to Invest in an IIoT Development Platform
            • IoT Business Solutions Start with Big Data & Create Business Outcomes
            • How AI Bots Bring Digital Twins to Life
          • 2016
            • How To Get Started With Industrial IoT
            • How To Overcome The Top 5 Challenges To Industrial IoT Adoption
            • What is an IoT Platform vs. an IoT Business Application Suite?
            • Industrial IoT: How To Get Started with Predictive Maintenance
            • 3 Ways The Internet of Things is Transforming Field Service
            • 7 Types of Industrial IoT Data Sources (And How To Use Them)
          • 2015
            • How Important Are Processes To The Internet Of Things?
            • Understanding the Value of Real Time KPI Management as Your Next Strategic Project
            • 6 Myths About Machine Learning
            • 10 Predictive Analytics Use Cases By Industry
            • What is a “Business Moment” in your business?
            • Does Operational Intelligence Make Business Intelligence Obsolete?
            • How To Reduce Operational Costs by 36% with Predictive Analytics
            • From Many, One – The Nature of Complex Event Processing
            • Herding Cats: What Enterprise Architects need to know about Business Process Management
          • 2014
            • Making Business Operations More Intelligent
          • 2013
            • Best Next Action Is The Next Big Thing For Intelligent Operations
            • The learns from two ‘Best in class’ organisations acquiring BPM technology
          • 2012
            • Why Intelligent Business Operations is Mobile, Social and Smart
            • Why Do You Want Intelligent Business Operations?
            • How big of a problem are ‘dark processes’?
            • Operational Risk: When You Stick Your Head In The Sand
            • The Difference Between Event-based And Workflow-based Processes
          • 2011
            • Is mobile BPM now essential to the business?
            • Stretch Socially Dynamic Processes To Fit Your Business
            • Social Listening – Get Control Of The Conversation
            • Operations Management – The Keys To KPIs
            • Benefits of BPM v 1.0
            • How to Prioritise Processes
          • 2010
            • The Business Drivers
            • Preserving Capability and Agility
            • Mobile BPM
        • Use Cases
          • Aging Pipe Predictive Maintenance in Water Utilities
          • Air Quality Monitoring For Agriculture
          • Alarm Management and Triage
          • Asset Condition Monitoring for Surface Processing Plants in the Mining Industry
          • Bogie Health Monitoring in the Rail Industry
          • Boiler Feed Water Pumps
          • CHPP Throughput Loss Monitoring
          • Casting Guidance
          • Conveyor Belt System Monitoring and Optimization in Automotive Manufacturing
          • Cooling Tower Fin Fan Monitoring
          • Cyclone/Slurry Pump Monitoring
          • Demand Planning to Reduce Stockholding in Stores
          • Demin Water Monitoring for Boiler Tube Corrosion
          • EV Battery Assembly Process Optimization for the Car Manufacturing Industry
          • Flood Prediction & Response in Water Utilities
          • Golden Batch For Culture Addition In The Dairy processing Industry.
          • Golden Batch Monitoring
          • Improve First Pass Yield (FPY)
          • Induced Draft (ID) Fan Monitoring
          • Long Conveyor Monitoring
          • Monitor Process Health to Reduce Cash-to-Cash Cycle
          • Monitor Storm Water Reservoirs For Flood Prevention
          • Monitor and Reduce Energy Consumption
          • Oil Well Maintenance Planning
          • Oil Well RTP Monitoring
          • Pipe Scaling Prediction for Roller Cooling
          • Precision Irrigation in Agriculture
          • Predict Heat Exchanger Fouling
          • Predictive Maintenance & Asset Health Monitoring For Haul Trucks In The Mining Industry
          • Predictive Maintenance For Mobile Assets Within The Mining Industry
          • Predictive Maintenance for Robotic Arms in the Automotive Industry
          • Predictive Maintenance for Wind Turbines
          • Pump Health Monitoring in Water Utilities
          • Pumping Station OEE
          • Real-time Balanced Business Scorecard (BBS)
          • Real-time Safety Monitoring
          • Short Term Inventory Planning
          • Strategic Performance & Safety Oversight for Global Mining Operations
          • Wheel and Track Wear Monitoring In The Rail Industry
          • Wind Turbine Performance Optimization
        • Youtube
          • 2024
            • Discover Gen AI Powered Operations With XMPro iBOS
            • Generative AI and Digital Twins in 2024 - XMPro Webinar
            • Go From Reactive To Predictive Operations In Water Utilities With XMPro iDTS
            • How to add Timestamps to Elements in XMPro App Designer
            • How to Build an AI Advisor for Industrial Operations Using XMPro
            • How XMPro Stream Hosts and Collections Enable Scalable, Real-Time Data Processing
            • Mind Blowing AI Agentic Operations For Industry With XMPro MAGS
            • The Ultimate Beginner's Guide To Predictive Analytics Podcast
            • XMPro's Flexible Deployment Options: Flexible Cloud & On-Premise Solutions For Industry
            • XMPro iBOS: The Only AI-Powered Suite for Scalable Intelligent Operations
          • 2023
            • 2023 XMPro Product Roadmap - Webinar
            • An Introduction To Intelligent Digital Twins - Webinar
            • Energy and Utilities Asset Optimisation through Digital Twin technology
            • Explore Model Governance using our MLflow Agent
            • Exploring XMPro Notebook and MLflow for Data Science and Model Governance
            • How Changing Properties For One Block Can Be Applied To All Blocks Within Same Style Group
            • How do I Use A Button To Update a Data Source In XMPro App Designer
            • How Does XMPro Compare To ESBs (Enterprise Service Buses)-
            • How to Configure and Integrity Check in Data Streams
            • How To Create A Widget Within XMPro App Designer
            • How to Create Intelligent Digital Twins Using XMPro AI
            • How to export grid data to Excel In XMPro App Designer
            • How to Revolutionize Your Supply Chain with Digital Twins
            • How To Rotate Text In App Designer
            • How To Update a Data Source Using A Button
            • How To Use & Clone XMPro Demos For Your Own Use
            • How To Use And Build 3rd Party Apps To Extend The Capabilities Of The XMPro App Designer.
            • How to use Avatars and why they are important
            • How to view stream host logs In XMPro Data Stream Designer
            • Logging Provider Support With XMPro
            • Mastering Health Check Endpoints: A Guide to Ensuring Service Uptime and Performance with XMPro
            • Mastering Root Cause Analysis with XMPro: Capture, Value, Impact
            • Microsoft Azure Digital Twins Everything You Need To Know
            • Model Based Predictive Maintenance (PdM) With XMPro
            • Monthly Webinar - Accelerate your digital twin use cases - XMPro Blueprints, Accelerators & Patterns
            • Optimizing Time Series Chart (TSC) Performance
            • Predictive Maintenance & Condition Monitoring - A Hot Seat Q&A Session
            • Predictive Maintenance with XMPro iDTS
            • Smart Facilities Management with Intelligent Digital Twins
            • The Benefits of using Digital Twins in Smart Manufacturing
            • The Four Industrial Revolutions Explained In Under 4 Minutes! #industry4 #smartmanufacturing
            • The Roadmap To Intelligent Digital Twins
            • The Technology Behind Predictive Maintenance (PdM) - The Hardware & Software that makes PdM Tick...
            • THE TOP USE CASES FOR COMPOSABLE DIGITAL TWINS IN RENEWABLES
            • Tips on how to use cache in agent configuration and get live updates
            • Webinar - XMPro 4.3 Release Showcase
            • What is a Digital Twin- Why Composable Digital Twins is the Future.
            • What Is Predictive Maintenance- (PdM)
            • What To Do When a Data Source Is Not Showing in Pass Page Parameter
            • XMPro - The World's Only AI - Powered Intelligent Digital Twin Suite
            • XMPro - The World's Only No Code Digital Twin Composition Platform
            • XMPro AI : How It Works
            • XMPro AI End To End Use Case
            • XMPro Auto Scale - Understanding Distributed Caching for Cloud-Native Applications
            • XMPro Promo Video - Dell Validated Design For Manufacturing Edge
          • 2022
            • Aggregate Transformation Agent Example - XMPRO Data Stream Designer
            • App Layout Best Practices for Desktop & Mobile - XMPro Lunch & Learn
            • Broadcast Transformation Agent Example - XMPRO Data Stream Designer
            • Calculated Field Transformation Agent Example - XMPRO Data Stream Designer
            • CRC16 Function Agent Example - XMPRO Data Stream Designer
            • Create a Common Operating Picture of Your Operations with XMPro
            • CSV Context Provider Agent Example - XMPro Data Stream Designer
            • CSV Simulator Agent Example - XMPRO Data Stream Designer
            • CSV Writer Agent Example - XMPRO Data Stream Designer
            • Data Conversion Transformation Agent Example - XMPro Data Stream Designer
            • Digital Twin Strategy To Execution Pyramid - XMPro Webinar
            • Event Printer Action Agent Example - XMPRO Data Stream Designer
            • File Listener Agent Example - XMPRO Data Stream Designer
            • Filter Transformation Agent Example - XMPRO Data Stream Designer
            • Group & Merge Transformation Agent Example - XMPRO Data Stream Designer
            • How To Bind Data To A Chart and Get It Working As Expected - XMPro Lunch & Learn
            • How To Send Data To My App (Including Caching Introduction) - XMPro Lunch & Learn
            • Join Transformation Agent Example - XMPRO Data Stream Designer
            • Min/Max Function Agent Example - XMPRO Data Stream Designer
            • PART 1- How To Manage Complex Operations in Real-time Using Composable Digital Twins
            • PART 3 - How To Manage Complex Operations in Real-time Using Composable Digital Twins
            • PART2 - How To Manage Complex Operations in Real-time Using Composable Digital Twins
            • Pass Through Agent Example - XMPRO Data Stream Designer
            • Pivot Table Transformation Agent Example - Count - XMPRO Data Stream Designer
            • Pivot Table Transformation Agent Example - Sum - XMPRO Data Stream Designer
            • Real-Time Is Real - How To Use Event Intelligence Tools to Manage Complex Operations in Real-time.
            • Row Count Agent Example - XMPRO Data Stream Designer
            • Sort Transformation Agent Example - XMPRO Data Stream Designer
            • Transpose Transformation Agent Example - Columns - XMPRO Data Stream Designer
            • Transpose Transformation Agent Example - Rows - XMPRO Data Stream Designer
            • Trim Name Transformation Agent Example - XMPRO Data Stream Designer
            • Twilio Action Agent Example - XMPRO Data Stream Designer
            • Union Transformation Agent Example - XMPRO Data Stream Designer
            • Variables & Expressions in App Designer - XMPro Lunch & Learn
            • Window Transformation Agent Example - XMPRO Data Stream Designer
            • XML File Reader Action Agent Example - XMPRO Data Stream Designer
          • 2021
            • The Value of a Composable Digital Twin - XMPro Webinar
          • 2020
            • 1. Understanding The Problem - UX Design - XMPRO
            • 1.1 Welcome - XMPRO UI Design Basics
            • 1.2 Introduction To UI Design - XMPRO UI Design Basics
            • 2. Creating User Stories - UX Design - XMPRO
            • 2.1 Responsive Design - XMPRO UI Design Basics
            • 2.2 Grids - XMPRO UI Design Basics
            • 2.3 Visual Hierarchy - XMPRO UI Design Basics
            • 2.4 Wireframes - XMPRO UI Design Basics
            • 3. Creating User Flow Diagrams - UX Design - XMPRO
            • 3.1 Color Palette - XMPRO UI Design Basics
            • 3.2 Typography - XMPRO UI Design Basics
            • 3.3 White Space - XMPRO UI Design Basics
            • 3.4 UI Elements - XMPRO UI Design Basics
            • 4. Plan Your App with Wireframes - UX Design - XMPRO
            • 4.1 Chart Types - XMPRO UI Design Basics
            • 4.2 Chart Styling - XMPRO UI Design Basics
            • 5. Designing for Dynamic Data - UX Design - XMPRO
            • Agents and Their Types - XMPRO Data Stream Designer
            • Data Wrangling: Row Transpose - XMPRO Data Stream Designer
            • Digital Twin: Your Most Productive Remote Worker - XMPRO Webinar
            • End-To-End Real-Time Condition Monitoring Demo - XMPRO Application Development Platform
            • Error Endpoints - XMPRO Data Stream Designer
            • Export and Import Recommendations - XMPRO App Designer
            • How To Add Buttons To Agents - XMPRO Data Stream Designer
            • How To Add EditLists to Agents - XMPRO Data Stream Designer
            • How To Change UI Language - XMPRO Subscription Manager
            • How To Configure a Stream Object - XMPRO Data Stream Designer
            • How To Configure The Aggregate Transformation - XMPRO Data Stream Designer
            • How To Configure The Anomaly Detection Agent - XMPRO Data Stream Designer
            • How To Configure The Azure SQL Action Agent - XMPRO Data Stream Designer
            • How To Configure The Azure SQL Context Provider - XMPRO Data Stream Designer
            • How To Configure The Azure SQL Listener - XMPRO Data Stream Designer
            • How To Configure The Calculated Field Transformation - XMPRO Data Stream Designer
            • How To Configure The CSV Context Provider - XMPRO Data Stream Designer
            • How To Configure The CSV Listener - XMPRO Data Stream Designer
            • How To Configure The Data Conversion Transformation - XMPRO Data Stream Designer
            • How To Configure The Edge Analysis Transformation - XMPRO Data Stream Designer
            • How To Configure The Email Action Agent - XMPRO Data Stream Designer
            • How To Configure The Email Listener - XMPRO Data Stream Designer
            • How To Configure The Event Printer Action Agent - XMPRO Data Stream Designer
            • How To Configure The Event Simulator Listener - XMPRO Data Stream Designer
            • How To Configure The FFT Function - XMPRO Data Stream Designer
            • How To Configure The File Listener - XMPRO Data Stream Designer
            • How To Configure The Filter Transformation - XMPRO Data Stream Designer
            • How To Configure The IBM Maximo Action Agent - XMPRO Data Stream Designer
            • How To Configure The IBM Maximo Context Provider - XMPRO Data Stream Designer
            • How To Configure The IBM Maximo Listener - XMPRO Data Stream Designer
            • How To Configure The Join Transformation - XMPRO Data Stream Designer
            • How To Configure The JSON File Reader Context Provider - XMPRO Data Stream Designer
            • How To Configure The MQTT Action Agent - XMPRO Data Stream Designer
            • How To Configure The MQTT Advanced Action Agent - XMPRO Data Stream Designer
            • How To Configure The MQTT Advanced Listener - XMPRO Data Stream Designer
            • How To Configure The MQTT Listener - XMPRO Data Stream Designer
            • How To Configure The Normalize Fields Function - XMPRO Data Stream Designer
            • How To Configure The OSIsoft PI Context Provider - XMPRO Data Stream Designer
            • How To Configure The OSIsoft PI Listener - XMPRO Data Stream Designer
            • How To Configure The Pass Through Transformation - XMPRO Data Stream Designer
            • How To Configure The PMML Agent - XMPRO Data Stream Designer
            • How To Configure The REST API Context Provider - XMPRO Data Stream Designer
            • How To Configure The RScript Agent - XMPRO Data Stream Designer
            • How To Configure The Run Recommendation Agent - XMPRO Data Stream Designer
            • How To Configure The Signal Filter - XMPRO Data Stream Designer
            • How To Configure The SQL Server Action Agent - XMPRO Data Stream Designer
            • How To Configure The SQL Server Context Provider - XMPRO Data Stream Designer
            • How To Configure The SQL Server Listener - XMPRO Data Stream Designer
            • How To Configure The SQL Server Writer Action Agent - XMPRO Data Stream Designer
            • How To Configure The Twilio Action Agent - XMPRO Data Stream Designer
            • How To Configure The Union Transformation - XMPRO Data Stream Designer
            • How To Configure The Unzip Function - XMPRO Data Stream Designer
            • How To Configure The Window Transformation - XMPRO Data Stream Designer
            • How To Create an App - XMPRO App Designer
            • How To Create and Manage Templates - XMPRO App Designer
            • How To Create and Publish a Use Case - XMPRO Data Stream Designer
            • How To Create and Use a Widget - XMPRO App Designer
            • How To Create App Data Connections - XMPRO App Designer
            • How To Create App Pages and Navigation - XMPRO App Designer
            • How To Create Recommendation Rules - XMPRO App Designer
            • How To Create Recurrent Data Streams - XMPRO Data Stream Designer
            • How To Do Integrity Checks - XMPRO Data Stream Designer
            • How To Edit Page Properties - XMPRO App Designer
            • How To Enable Audit Trails - XMPRO App Designer
            • How to Export, Import, and Clone a Data Stream - XMPRO Data Stream Designer
            • How To Export, Import and Clone an App - XMPRO App Designer
            • How to Export and Import an App - XMPRO App Designer
            • How To Find Help for an Agent - XMPRO Data Stream Designer
            • How To Install The XMPRO App Designer
            • How To Maintain and Capture Notes - XMPRO App Designer
            • How To Manage Agents - XMPRO Data Stream Designer
            • How To Manage and Use Server Variables - XMPRO Data Stream Designer
            • How To Manage Buffer Size - XMPRO Data Stream Designer
            • How to Manage Categories - XMPRO App Designer
            • How To Manage Categories - XMPRO Data Stream Designer
            • How To Pass Parameters Between Pages - XMPRO App Designer
            • How To Publish and Share an Application - XMPRO App Designer
            • How To Set Up and Use Charts in Live View - XMPRO Data Stream Designer
            • How To Set Up and Use Gauges in Live View - XMPRO Data Stream Designer
            • How To Share a Data Stream - XMPRO Data Stream Designer
            • How To Share a Use Case - XMPRO Data Stream Designer
            • How To Share an App For Design Collaboration - XMPRO App Designer
            • How To Troubleshoot a Use Case - XMPRO Data Stream Designer
            • How To Upgrade a Stream Object Version - XMPRO Data Stream Designer
            • How To Use App Files - XMPRO App Designer
            • How To Use Application Versions - XMPRO App Designer
            • How To Use Bar Gauge - XMPRO App Designer
            • How To Use Calendar - XMPRO App Designer
            • How To Use Chart Pan, Zoom and Aggregation - XMPRO App Designer
            • How To Use Chart Panes and Axes - XMPRO App Designer
            • How To Use Chart Print and Export- XMPRO App Designer
            • How To Use Charts - XMPRO App Designer Toolbox
            • How To Use Charts: Series - XMPRO App Designer
            • How To Use Collections - XMPRO Data Stream Designer
            • How To Use Content Card - XMPRO App Designer
            • How To Use D3 - XMPRO App Designer
            • How To Use Data Sources - XMPRO App Designer
            • How To Use Embedded Pages - XMPRO App Designer Toolbox
            • How To Use Fieldset and Field - XMPRO App Designer Toolbox
            • How To Use Flex Layout
            • How To Use Form Validation - XMPRO App Designer Toolbox
            • How To Use Input Mappings - XMPRO Data Stream Designer
            • How To Use Linear Gauges - XMPRO App Designer
            • How To Use Live View - XMPRO Data Stream Designer
            • How To Use Lookup - XMPRO App Designer
            • How To Use Maps - XMPRO App Designer
            • How To Use Page Layers - XMPRO App Designer
            • How To Use Pivot Grid - XMPRO App Designer
            • How To Use Polar Charts - XMPRO App Designer
            • How To Use Power BI - XMPRO App Designer
            • How To Use Radio Buttons - XMPRO App Designer Toolbox
            • How To Use Recommendations - XMPRO App Designer Toolbox
            • How To Use Select Box - XMPRO App Designer
            • How To Use Stacked Layouts - XMPRO App Designer Toolbox
            • How To Use Stream Host Local Variables - XMPRO Data Stream Designer
            • How To Use Tabs - XMPRO App Designer Toolbox
            • How To Use Tags - XMPRO App Designer Toolbox
            • How To Use Templated List - XMPRO App Designer
            • How To Use Templates - XMPRO App Designer
            • How To Use Text - XMPRO App Designer Toolbox
            • How To Use Text Area - XMPRO App Designer Toolbox
            • How To Use The Accordion - XMPRO App Designer Toolbox
            • How To Use The Block Styling Manager - XMPRO App Designer
            • How To Use The Box and Data Repeater Box - XMPRO App Designer Toolbox
            • How To Use The Button - XMPRO App Designer Toolbox
            • How To Use The Circular Gauge - XMPRO App Designer Toolbox
            • How To Use The Data Grid - XMPRO App Designer Toolbox
            • How To Use The HTML Editor - XMPRO App Designer Toolbox
            • How To Use The Hyperlink and Box Hyperlink - XMPro App Designer Toolbox
            • How To Use The Image - XMPRO App Designer Toolbox
            • How To Use The Indicator - XMPRO App Designer Toolbox
            • How To Use The Layout Grid - XMPRO App Designer Toolbox
            • How To Use The Number Selector - XMPRO App Designer Toolbox
            • How To Use The Pie Chart - XMPRO App Designer Toolbox
            • How To Use The Range Slider - XMPRO App Designer Toolbox
            • How To Use The Recommendation Chart - XMPRO App Designer Toolbox
            • How To Use The Scroll Box - XMPRO App Designer Toolbox
            • How To Use The Select Box - XMPRO App Designer Toolbox
            • How To Use The Sparkline - XMPRO App Designer Toolbox
            • How To Use The Textbox - XMPRO App Designer Toolbox
            • How To Use Tree Grid - XMPRO App Designer
            • How To Use Tree List - XMPRO App Designer
            • How To Use Unity - XMPRO App Designer Toolbox
            • How To Use Variables - XMPRO App Designer
            • How To Write and Maintain Notes and Business Case - XMPRO Data Stream Designer
            • Interactive 3D Models For Digital Twins - XMPRO Event Intelligence Platform
            • Manage Input Arrow Highlights - XMPRO Data Stream Designer
            • Manage Recommendation Access - XMPRO App Designer
            • Realize Value from End-To-End Condition Monitoring in 6 - 8 Weeks - XMPRO
            • Recommendation Versions - XMPRO App Designer
            • Solution Development Process For Event Intelligence Apps - XMPRO
            • Stream Hosts and How To Install Them - XMPRO Data Stream Designer
            • Use Case Versioning - XMPRO Data Stream Designer
            • XMPRO App Designer Overview - Event Intelligence Applications
            • XMPRO Data Stream Designer - Event Intelligence Applications
            • XMPRO Real-Time Event Intelligence Demo
            • XMPRO Recommendations - Event Intelligence Applications
          • 2019
            • Data Distribution Service: Using DDS in Your IoT Applications
            • My Digital Twin: Digital Twin Applications For Real-Time Operations (Like Me)
            • Setting up a Typical Industrial IoT Use Case with XMPro
            • XMPro Overview & Fin Fan Failure Demo
          • 2016
            • XMPro iBPMS Overview
          • 2013
            • XMPro Best Next Action - 3 Examples for XMPro blog
            • XMPro Case Management Example
            • XMPro Internet of Things Demo
          • 2012
            • Is Agile Business the New Normal
            • The Future of BPM Moving Towards Intelligent Business Operations
            • What industries does XMPro serve-
            • Who is XMPro for-
            • XMPro - The Social Listener - Why You Should Be Listening.wmv
            • XMPro Cool Vendor 2012
            • XMPro iBPMS For SharePoint
            • XMPro iBPMS v6 XMWeb for Intelligent Business Operations
            • XMPro News and Gartner BPM Sydney Summit Discount Offer.mp4
            • XMPro Version 6 - Introducing the Next Generation BPM for Intelligent Business Operations
    • Practice Notes
      • Unified Recommendation Alert Management
      • Performant Landing Pages in Real-Time Monitoring
  • Concepts
    • XMPro AI
      • XMPro Notebook
    • Data Stream
      • Stream Object Configuration
      • Verifying Stream Integrity
      • Running Data Streams
      • Timeline
    • Collection and Stream Host
    • Agent
      • Virtual vs Non-Virtual Agents
    • Application
      • Template
      • Page
      • Block
      • Canvas
      • Page Layers
      • Block Styling
      • Devices
      • Flex
      • Block Properties
      • Data Integration
      • Navigation and Parameters
      • Variables and Expressions
      • App Files
      • Metablocks
    • Recommendation
      • Rule
      • Execution Order
      • Auto Escalate
      • Form
      • Action Requests
      • Notification
      • Recommendation Alert
      • Deleted Items
      • Scoring
    • Connector
    • Landing Pages & Favorites
    • Version
    • Manage Access
    • Category
    • Variable
    • Insights
      • Data Delivery Insights
  • How-To Guides
    • Data Streams
      • Manage Data Streams
      • Manage Collections
      • Use Remote Receivers and Publishers
      • Manage Recurrent Data Streams
      • Use Business Case and Notes
      • Run an Integrity Check
      • Check Data Stream Logs
      • Use Live View
      • Use Stream Metrics
      • Troubleshoot a Data Stream
      • Upgrade a Stream Object Version
      • Setup Input Mappings
      • Use Error Endpoints
      • Use the Timeline
      • Context Menu
    • Application
      • Manage Apps
      • Manage Templates
      • Manage Pages
      • Import an App Page
      • Design Pages for Mobile
      • Navigate Between Pages
      • Pass Parameters Between Pages
      • Page Data
      • Manage Connections
      • Check Connector Logs
      • Manage Data Sources
      • Use Data Sources in the Page
      • Use Dynamic Properties
      • Use Expression Properties
      • Use Page Layers
      • Use Block Styling and Devices
      • Use Flex
      • Use Validation
      • Use Variables & Expressions
      • Create and Maintain Notes
      • Manage Widgets
      • Manage App Files
      • Manage Themes
    • Recommendations
      • Manage Categories
      • Manage Recommendations
      • Manage Rules
      • Manage Notifications
      • Manage Notification Templates
      • Subscribe to Notifications
      • Manage Forms
      • Manage Variables
      • Manage Alerts
      • Manage Alerts on Mobile
      • Manage Deleted Recommendation Items
    • Connectors
      • Manage Connectors
      • Building Connectors
      • Packaging Connectors
    • Stream Host
    • Agents
      • Manage Agents
      • Building Agents
      • Packaging Agents
      • Debugging an Agent
    • Manage Versions
    • Manage Access
    • Manage Categories
    • Manage Variables
    • Import, Export, and Clone
    • Publish
      • Admin Unpublish Override
    • Manage Site Settings
    • Manage Landing Pages & Favorites
  • Blocks
    • Common Properties
    • Layout
      • Accordion
      • Box & Data Repeater Box
      • Card & Content Card
      • Field & Fieldset
      • Layout Grid
      • Menu
      • Scroll Box
      • Stacked Layout Horizontal & Vertical
      • Tabs
      • Templated List
      • Toolbar
    • Basic
      • Calendar
      • Check Box
      • Color Selector
      • Data Grid
      • Date Selector
      • Dropdown Grid
      • Embedded Page
      • File Library
      • File Uploader
      • Html Editor
      • Image
      • Indicator
      • List
      • Lookup
      • Number Selector
      • Radio Buttons
      • Range Slider
      • Select Box
      • Switch
      • Tags
      • Text
      • Text Area
      • Textbox
      • Tree Grid
      • Tree List
    • Device Input
      • Location Capture
      • Visual Media Capture
    • AI
      • Azure Copilot
      • ChatGPT Copilot
    • Actions
      • Box Hyperlink
      • Button
      • Data Operations
      • Hyperlink
    • Recommendations
      • Alert Action
      • Alert Analytics
      • Alert Discussion
      • Alert Event Data
      • Alert Form
      • Alert List
      • Alert Timeline
      • Alert Triage
      • Alert Survey
      • Recommendation Chart
    • Visualizations
      • Autodesk Forge
      • Azure Digital Twin Hierarchy
      • Bar Gauge
      • Chart
      • Circular Gauge
      • D3 Visualization
      • Esri Map
      • Image Map
      • Linear Gauge
      • Live Feed
      • Map
      • Pie Chart
      • Pivot Grid
      • Polar Chart
      • Power BI
      • Sparkline
      • Time Series Analysis
      • Tree Map
      • Unity
      • Unity (Legacy)
    • Advanced
      • Metablock
    • Widgets
  • Administration
    • Administrative Accounts
    • Language
    • Companies
      • Register a Company
      • Manage a Company
      • Manage Company Subscriptions
      • Manage License
    • Subscriptions
      • Manage User Access
      • Setup Auto Approval/Default Subscriptions
      • Request and Apply a License
    • Users
      • Invite a User
      • Register an Account
      • Profile
      • Change Password
      • Reset Password
      • Delete a User
      • Change Business Role
  • Installation
    • Overview
    • 1. Preparation
    • 2. Install XMPro
      • Azure
      • AWS
      • Windows Server 2022
        • Prerequisites
        • Install
        • Upgrade
        • Troubleshooting
    • 3. Complete Installation
      • Configure Auto Scale (Optional)
      • Configure Health Checks (Optional)
      • Configure Logging (Optional)
      • Configure SSO (Optional)
        • SSO - Azure AD
        • SSO - ADFS
      • Create Base Company
      • Install Stream Host
        • Windows x64
        • Azure Web Job
        • Ubuntu 20.04 x64
        • Docker
          • Docker v4.4.2 - v4.4.18
      • Install Agents & Connectors
  • Release Notes
    • v4.4.19
    • v4.4.18
    • v4.4.17
    • v4.4.16
    • v4.4.15
    • v4.4.14
    • v4.4.13
    • v4.4.12
    • v4.4.11
    • v4.4.10
    • v4.4.9
    • v4.4.8
    • v4.4.7
    • v4.4.6
    • v4.4.5
    • v4.4.4
    • v4.4.3
    • v4.4.2
    • v4.4.1
    • v4.4.0
    • Archived
      • v4.3.12
      • v4.3.11
      • v4.3.10
      • v4.3.9
      • v4.3.8
      • v4.3.7
      • v4.3.6
      • v4.3.5
      • v4.3.4
      • v4.3.3
      • v4.3.2
      • v4.3.1
      • v4.3.0
        • v4.2.3
        • v4.2.2
        • v4.2.1
      • v4.2.0
      • v4.1.13
      • v4.1.0
      • v4.0.0
Powered by GitBook
On this page
  • Overview
  • Listeners
  • Action Agents/ Functions
  • Context Providers
  • Transformations
  • IAgent
  • Settings/Configurations
  • Validate
  • Output Payload
  • Create
  • Start
  • Destroy
  • Publishing Events
  • Decrypting Values
  • Custom Events
  • IPolling Agent
  • IReceivingAgent
  • Input Payload
  • Parent Outputs
  • Receiving Events
  • IPublishError
  • IAgentLogger
  • Example
  • Further Reading

Was this helpful?

Export as PDF
  1. How-To Guides
  2. Agents

Building Agents

PreviousManage AgentsNextPackaging Agents

Last updated 5 days ago

Was this helpful?

Overview

To get started with developing a new Agent, create a new C# library project in Visual Studio and import the NuGet package. When writing the code for an Agent, you will have to implement a number of interfaces. Which interfaces to implement depends on the category under which your Agent will fall:

Listeners

Listeners are created by implementing IAgent and IPollingAgent interfaces. To push the events to the next receiver, the OnPublish event should be invoked and the events should be passed as arguments.

Action Agents/ Functions

Action Agents are created by implementing the IAgent and IReceivingAgent interfaces. The Receive method will be called every time events are received by this Agent. To publish these events again, the same logic as per the Listener Agent can be used.

Context Providers

Context Providers are created by implementing the IAgent, IPollingAgent interfaces. They are very similar to Listeners; however, Context Providers publish all available records/events when polled instead of only publishing the newer/changed ones.

Transformations

Transformations are implemented in a similar way as Action Agents, except that all Transformations should have the Require Input Map flag set to false and must not implement the GetInputAttributes method, hence it should be:

public IEnumerable<XMIoT.Framework.Attribute> GetIntputAttributes(string endpoint, IDictionary<string, string> parameters)
{

throw new NotImplementedException();

}

The interfaces that can be implemented are as follows:

The matrix below shows which interface needs to be implemented for which category Agent:

Agent Category
IAgent
IPollingAgent
IReceivingAgent
IPublishesError
IAgentLogger

Listener

Required

Recommend

Optional

Optional

Optional

Context Provider

Required

Recommend

Optional

Optional

Optional

Transformation

Required

Optional

Required

Optional

Optional

Action Agent/ Function

Required

Optional

Required

Optional

Optional

AI & Machine Learning / Gen AI

Required

Optional

Required

Optional

Optional

The IPollingAgent interface is not strictly required for Listeners or Context Providers, however, it is generally used in most cases. Not implementing IPollingAgent for a Listener or Context Provider should be considered an advanced option.

IAgent

IAgent is the primary interface that must be implemented by all Agents as it provides the structure for the workings of the Agent. After implementing this interface, there are several methods you have to add to your project that forms part of this predefined structure.

Settings/Configurations

Some Agents need to be provided with configurations by the user, for example, for a CSV listener Agent to get records from a CSV file, it needs the following:

  • Polling interval (in seconds)

  • CSV file

  • CSV Definition

A template is a JSON representation of all the controls and their layout that will be used to capture the settings from a user.

  • Group (Data)

  • File Upload

  • Group (Payload)

  • Grid

Each control has a Key, which uniquely identifies it in the template and allows the Agent code to access its value at any time. To get the value contained in a setting, use the following code:

string mySetting = parameters[“myUniqueKey”];

Before a template is rendered on the screen, or if a postback occurs on any control in the template, the method below would be called to allow the Agent an opportunity to make any necessary runtime changes to the template, for example, verifying user credentials, displaying all tables of a selected database in a drop-down list, etc. In this example, no changes are being made to the template but, if needed, they can be added to the todo section.

For a postback to occur after a user navigates out of a setting field, the Postback property needs to be set to true when packaging the Agent.

public string GetConfigurationTemplate(string template, IDictionary<string, string> parameters)
{

//parse settings JSON into Settings object
var settings = Settings.Parse(template);
//populate the settings/configuration controls with the user selected values
new Populator(parameters).Populate(settings);
// ToDo: update the controls, values or the data sources here
//return the updated settings xml
return settings.ToString();

}

Validate

If a user tries to run an Integrity Check on a Data Stream in Data Stream Designer, all Agents will be requested to validate the configurations they have been provided. An Agent has to use this opportunity to inform the user about any configurations that are incorrect, for example, credentials that have expired, required values that are missing, etc.

To validate the configurations/ settings in an Agent, the Validate method needs to be implemented. This method returns an array of errors that occurred. If validation was successful, an empty array would be returned.

The example code below verifies if a user has specified a broker address, topic, and payload definition for an MQTT Agent:

public string[] Validate(IDictionary<string, string> parameters)
{

int i = 1;
var errors = new List<string>();
this.config = new Configuration() { Parameters = parameters };

if (String.IsNullOrWhiteSpace(this.Broker))
errors.Add($”Error {i++}: Broker is not specified.”);

if (String.IsNullOrWhiteSpace(this.Topic))
errors.Add($”Error {i++}: Topic is not specified.”);

var grid = new Grid();
grid.Value = this.config[“PayloadDefinition”];
if (grid.Rows.Any() == false)
errors.Add($”Error {i++}: Payload Definition is not specified.”);
return errors.ToArray();

}

Output Payload

Each Agent has the responsibility to inform the Engine about the structure of the payload that will be produced by the Agent. To do this, implement the following method:

IEnumerable<Attribute> GetOutputAttributes(string endpoint, IDictionary<string, string> parameters)

This method returns a collection that has an Attribute type, which is a type that represents the name and type of a given attribute in the outgoing payload. As from XMPro.IOT.Framework version 3.0.2, comparison/ equality operations are also supported in Attribute, for example:

new XMIoT.Framework.Attribute(“Name1”, Types.DateTime).Equals(new XMIoT.Framework.Attribute(“Name2”, Types.String));

Create

Each Agent needs to implement a method called Create, which will be invoked when your Agent is being hosted. User-defined configuration is passed as a parameter to this method and should be stored in a class variable as far as possible for later use. This is a good point to provide any resources needed for the working of your Agent.

void Create(Configuration configuration)
{
    this.config = configuration;
    // ToDo: Provision any resources or write Startup logic.
}

Start

The Start method needs to be implemented by all Agents. This method will be invoked when your Agent is hosted and starts to work.

void Start()

Destroy

Each Agent needs to implement a Destroy method, which will be invoked if the Create method was called successfully, when a data stream is either being unpublished or it encounters an error and fails to start.

Use this method to release any resources or memory that your Agent may have acquired during its creation and lifetime.

void Destroy()

Publishing Events

To push the events to the next Agent, your Agent should invoke the OnPublish event with the events passed as arguments:

this.OnPublish?.Invoke(this, new OnPublishArgs(new JArray(), “EndpointName”));

Events are represented as JSON Objects and have to be pushed as a collection, i.e. JArray.

Please note that OnPublishArgs(Array rtr) is obsolete from XMPro.IOT.Framework 3.0.2 onwards. You are now required to specify the endpoint name on which you would like to publish (i.e. OnPublishArgs(Array rtr, string Endpoint))

Decrypting Values

If an Agent’s configuration contains a Secure/Password Textbox, its value will automatically be encrypted. To decrypt the value, use the following set of instructions:

var request = new OnDecryptRequestArgs(value);
this.OnDecryptRequestArgs?.Invoke(this, request);
var decryptedVal = request.DecryptedValue;

Custom Events

While building your Agent, you may need to use external libraries or third-party event subscriptions to handle custom events. If these are used, you must catch any exceptions from the event handlers yourself, to prevent uncaught exceptions that could possibly crash the Data Stream if they get through.

IPolling Agent

The IPollingAgent interface allows time-based operations. Implementing this interface, and opting in to Polling by returning true from the RequiresPolling method, will automatically add a PollingInterval setting to the configuration template of your Agent, which can be used by the user to specify the interval for polling. The Poll method will be invoked every time the poll interval elapses.

void Poll()

This method will be called at regular intervals according to the Configuration settings, and can be used to perform any work or logic you wish, for example, querying a third-party system for changes.

bool RequiresPolling(IDictionary<string, string> parameters)

The RequiresPolling method is an advanced option. It is expected that in most cases, this method should simply return a true value, which will not change the behaviour of the Agent. The PollingInterval setting will display as normal, and the Poll method will be called at that interval, as normal.

Advanced users, however, can use this method to decide to opt-out of Polling settings, by returning false. The parameters method parameter will contain the Stream Object's Configuration, allowing you to determine whether to return true to opt-in, or false to opt out, depending on what settings the user has selected. Opting out will cause the PollingInterval setting to not appear in the configuration tab, and the Poll method to never be called when the Stream is published.

This may be useful when the agent you are building can be configured to either actively query its configured third-party system for data at regular intervals, or set up a persistent connection to the third-party service and passively wait for that connection to deliver data.

If the Agent does not need to query for data at regular intervals, or perform other work or logic on a specific schedule, it is recommended to not implement IPollingAgent rather than always returning false from the RequiresPolling method.

IReceivingAgent

If your Agent is required to receive inputs from other Agents, you should implement the IReceivingAgent interface.

Input Payload

Each Agent is responsible to inform the Engine about the structure of the payload it consumes. To achieve this in your Agent, implement the following method:

IEnumerable<Attribute> GetInputAttributes(string endpoint, IDictionary<string, string> parameters)

This method returns a collection consisting of Attribute, which is a type that represents the name and type of a given attribute in the incoming payload.

Input Mapping

In most cases, if an incoming payload structure is supposed to be different from what the parent is sending, i.e. the Input Payload has been specified above, the user will have to map parent outputs to the current Agent’s inputs. To enable this, mark the Require Input Map flag as true in the Stream Integration Manager when packaging the Agent.

Endpoint

Parent Outputs

All receiving Agents can query the structure of parent Agent outputs connected at a given endpoint by invoking an event, as demonstrated in the example below:

var args = new OnRequestParentOutputAttributesArgs(this.UniqueId, “Input”);
this.OnRequestParentOutputAttributes.Invoke(this, args);
var pOuts = args.ParentOutputs;

Receiving Events

Events published to a receiving Agent can be received by implementing the following method:

void Receive(string endpointName, JArray events)

The endpointName parameter will identify which endpoint the events have been received at.

It is not guaranteed that the Start method will be invoked before the Receive method. Use the Create method to execute any logic that needs to be executed before the Receive method is called.

IPublishError

An Agent can publish messages to an error endpoint by implementing the IPublishesError interface. An unhandled error in an Agent will be captured and error information will be published to the error endpoint.

Implement the interface member:

public event EventHandler<OnErrorArgs> OnPublishError;

To push the error to the next Agent, the OnPublishError event should be invoked, and the error information should be passed as arguments:

this.OnPublishError?.Invoke(this, new OnErrorArgs(AgentId, Timestamp, Source, Error, DetailedError, Data));

Error endpoints should be enabled in XMPro Stream Integration Manager when packaging the Agent. This can be done by selecting the “Add On Error Endpoint?” checkbox. See the image on the right for an example.

IAgentLogger

  1. Add an empty constructor to your Agent entry point class and another constructor that accepts an IAgentLogger. See following code for the contents of the two constructors:

    private readonly AgentLoggerProxy _loggerProxy;
    
    public BaseAgent
    {
        _loggerProxy = new AgentLoggerProxy();
    }
    
    public BaseAgent(IAgentLogger logger)
    {
        _loggerProxy = new AgentLoggerProxy(logger);
    }
  2. The IAgentLogger interface contains the logging methods but a proxy class is needed to execute it to avoid compatibility issues with older SH and DS. Create the AgentLoggerProxy class with the following contents:

    public class AgentLoggerProxy
    {
        private readonly object? _logger;
        private readonly Type? _loggerType;
        private readonly Dictionary<string, MethodInfo?> _methods;
    
        public AgentLoggerProxy(object? logger = null)
        {
            _logger = logger;
            _loggerType = logger?.GetType();
            _methods = new Dictionary<string, MethodInfo?>();
    
            if (logger != null)
            {
                // Cache all method infos
                _methods["LogInfo"] = _loggerType?.GetMethod("LogInfo",
                    new[] { typeof(string), typeof(object[]) });
    
                _methods["LogErrorWithException"] = _loggerType?.GetMethod("LogError",
                    new[] { typeof(Exception), typeof(string), typeof(object[]) });
    
                _methods["LogError"] = _loggerType?.GetMethod("LogError",
                    new[] { typeof(string), typeof(object[]) });
    
                _methods["LogWarning"] = _loggerType?.GetMethod("LogWarning",
                    new[] { typeof(string), typeof(object[]) });
    
                _methods["LogDebug"] = _loggerType?.GetMethod("LogDebug",
                    new[] { typeof(string), typeof(object[]) });
            }
        }
    
        public void LogInfo(string messageTemplate, params object[] args)
        {
            if (_logger != null && _methods["LogInfo"] != null)
            {
                _methods["LogInfo"]!.Invoke(_logger, new object[] { messageTemplate, args });
            }
        }
    
        public void LogError(Exception ex, string messageTemplate, params object[] args)
        {
            if (_logger != null && _methods["LogErrorWithException"] != null)
            {
                _methods["LogErrorWithException"]!.Invoke(_logger, new object[] { ex, messageTemplate, args });
            }
        }
    
        public void LogError(string messageTemplate, params object[] args)
        {
            if (_logger != null && _methods["LogError"] != null)
            {
                _methods["LogError"]!.Invoke(_logger, new object[] { messageTemplate, args });
            }
        }
    
        public void LogWarning(string messageTemplate, params object[] args)
        {
            if (_logger != null && _methods["LogWarning"] != null)
            {
                _methods["LogWarning"]!.Invoke(_logger, new object[] { messageTemplate, args });
            }
        }
    
        public void LogDebug(string messageTemplate, params object[] args)
        {
            if (_logger != null && _methods["LogDebug"] != null)
            {
                _methods["LogDebug"]!.Invoke(_logger, new object[] { messageTemplate, args });
            }
        }
    
        public bool HasLogger => _logger != null;
    }
  3. Call the logging methods of the proxy class. This will now display the logs on Stream Host.

    protected void LogMessage(string source, string message)
    {
        if (_loggerProxy.HasLogger)
        {
            loggerProxy.LogInfo($"[{source}] {message}");
        }
    }
    
    protected void LogError(Exception? ex, string message)
    {
        if (_loggerProxy.HasLogger)
        {
            _loggerProxy.LogError(ex, message);
        }
    }

Example

The code below is an example of a basic MQTT Listener Agent. Take note of how the interfaces and methods have been implemented.

Please note that this example uses the M2MqttDotnetCore 1.0.7 NuGet package.

using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using uPLibrary.Networking.M2Mqtt;
using uPLibrary.Networking.M2Mqtt.Messages;
using XMIoT.Framework;
using XMIoT.Framework.Settings;
using XMIoT.Framework.Settings.Enums;namespace XMPro.MQTTAgents
{
    public class Listener : IAgent
    { 
        private Configuration config;
        private MqttClient client;
        private string Broker => this.config[“Broker”];
        private string Topic => this.config[“Topic”];
        
        public long UniqueId { get; set; }
        public event EventHandler<OnPublishArgs> OnPublish;
        public event EventHandler<OnDecryptRequestArgs> OnDecryptRequest;
        
        public void Create(Configuration configuration)
        {
            this.config = configuration;
            this.client = new MqttClient(this.Broker);
            this.client.MqttMsgPublishReceived += Client_MqttMsgPublishReceived;
        }
        
        public void Start()
        {
            if (this.client.IsConnected == false)
            {
                this.client.Connect(Guid.NewGuid().ToString());
                this.client.Subscribe(new string[] { this.Topic }, new byte[] { MqttMsgBase.QOS_LEVEL_EXACTLY_ONCE });
            }
        }
        
        private void Client_MqttMsgPublishReceived(object sender, uPLibrary.Networking.M2Mqtt.Messages.MqttMsgPublishEventArgs e)
        {
            try
            {
                var message = Encoding.UTF8.GetString(e.Message);
                this.OnPublish?.Invoke(this, new OnPublishArgs(JArray.Parse(message), “Output”));
            }
            catch (Exception ex)
            {
                Console.WriteLine($”{DateTime.UtcNow}|ERROR|XMPro.MQTTAgents.Listener|{ex.ToString()}“);
            }
        }
        
        public void Destroy()
        {
            if (this.client?.IsConnected == true)
                this.client.Disconnect();
        }
        
        public string GetConfigurationTemplate(string template, IDictionary<string, string> parameters)
        {
            var settings = Settings.Parse(template);
            new Populator(parameters).Populate(settings);
            return settings.ToString();
        }
        
        public string[] Validate(IDictionary<string, string> parameters)
        {
            int i = 1;
            var errors = new List<string>();
            this.config = new Configuration() { Parameters = parameters };
            
            if (String.IsNullOrWhiteSpace(this.Broker))
                errors.Add($”Error {i++}: Broker is not specified.”);
            
            if (String.IsNullOrWhiteSpace(this.Topic))
                errors.Add($”Error {i++}: Topic is not specified.”);
            
            var grid = new Grid();
            grid.Value = this.config[“PayloadDefinition”];
            
            if (grid.Rows.Any() == false)
                errors.Add($”Error {i++}: Payload Definition is not specified.”);
            
            return errors.ToArray();
        }
        
        public IEnumerable<XMIoT.Framework.Attribute> GetOutputAttributes(string endpoint, IDictionary<string, string> parameters)
        {
            var grid = new Grid();
            grid.Value = parameters[“PayloadDefinition”];
            foreach (var row in grid.Rows)
            {
                yield return new XMIoT.Framework.Attribute(row[“Name”].ToString(), (Types)Enum.Parse(typeof(Types), row[“Type”].ToString()));
            }
        }
    }
}

Further Reading

(v4.4.19)

Each of these settings should be referenced in the code and must correspond to the settings template created when .

An example of the settings template (generated using the ) is shown in the image below. The settings in this example consist of the following controls:

Each Agent can have a number of input and output . Endpoints are the points where incoming or outgoings arrows are connected. Each endpoint consists of a Name<String> attribute. You will be passed an endpoint name when queried for an Input payload definition. Be sure to specify the endpoint name when querying the parent’s output payload definition.

An Agent can output logging to the the by implementing the IAgentLogger interface. Like , this can be used for errors, but it can also be used to log information or warning messages too.

The prerequisite to use this interface are v4.4.19+ and Data Stream Designer v4.4.19+.

XMPro.IoT.Framework
packaging your Agent
XMPro Package Manager
XMPro.IoT.Framework
Packaging Agents
IAgent
IPollingAgent
IReceivingAgent
IPublishesError
IAgentLogger
Data Stream Logs
IPublishError
endpoints