Plugins and UDFs
Plugins and UDFs
eKuiper is designed to be highly extensible. The eKuiper Manager provides a centralized interface to manage Plugins (Sources, Sinks, and Functions) and JavaScript User-Defined Functions (UDFs). These extensions allow you to handle custom protocols, connect to proprietary data stores, and implement complex business logic that exceeds standard SQL capabilities.
Plugin Management
Plugins are compiled binaries (usually written in Go) or shared objects that extend the core capabilities of the eKuiper engine. The Manager allows you to view and manage these extensions across three primary categories.
Supported Plugin Types
| Type | Description |
| :--- | :--- |
| Sources | Custom connectors for ingesting data (e.g., a specific industrial protocol). |
| Sinks | Custom connectors for exporting processed data (e.g., a proprietary database). |
| Functions | Custom SQL functions that can be used within your SELECT statements. |
Viewing Plugins
You can retrieve the list of installed plugins via the Manager's interface or the underlying API.
API Example:
To list all installed function plugins using the EKuiperClient:
import { EKuiperClient } from "@/lib/ekuiper/client";
const client = new EKuiperClient("http://your-ekuiper-url:9081", undefined, 5000, true);
async function getPlugins() {
const functionPlugins = await client.listPlugins("functions");
const sourcePlugins = await client.listPlugins("sources");
const sinkPlugins = await client.listPlugins("sinks");
console.log("Available Functions:", functionPlugins);
}
JavaScript User Defined Functions (UDFs)
The eKuiper Manager supports JavaScript-based UDFs. Unlike compiled Go plugins, JS UDFs can be defined and deployed dynamically without restarting the eKuiper server. This is ideal for quick logic iterations or data transformations.
Managing UDFs
The Manager provides a streamlined way to list and manage your custom JavaScript logic.
Listing UDFs:
async function fetchUDFs() {
try {
const udfs = await client.listUDFs();
console.log("Current JavaScript UDFs:", udfs);
} catch (error) {
console.error("Failed to fetch UDFs:", error);
}
}
Key Advantages of JS UDFs:
- Portability: No cross-compilation required.
- Safety: Execution is sandboxed within the JavaScript runtime.
- Accessibility: Use standard modern JavaScript for data manipulation.
AI-Assisted Extensions
One of the unique features of the eKuiper Manager is its AI Assistant, which helps users navigate the complexity of custom extensions.
Analysis & Discovery
The AI Assistant can analyze your existing Rules and Streams to suggest where a custom Plugin or UDF might be more efficient than complex nested SQL.
- Logic Mapping: The AI can explain how data flows through custom function plugins within a rule topology.
- Troubleshooting: If a rule fails because a plugin is missing or incorrectly configured, the AI Assistant analyzes rule metrics and trace logs to highlight the specific extension causing the bottleneck.
Master Chat Integration
You can use the Master AI Assistant to query the status of your extensions globally:
"Are any of my custom source plugins currently reporting high latency or dropped messages?"
The assistant will scan the rule metrics and system info to provide a plain-English summary of your plugin health.
Technical Specifications
API Proxying
The Manager communicates with the eKuiper instance via a secure proxy. If you are interacting with the backend directly, extension-related requests follow this routing pattern:
POST /api/connections/[connection_id]/ekuiper/plugins/[type]
GET /api/connections/[connection_id]/ekuiper/udfs
Data Types
When defining functions (either via Plugins or UDFs), ensure your data types align with eKuiper's supported schema:
bigint,float,string,boolean,datetime,bytea,array,struct.