EdgeStream
Plugin Registry
The Plugin Registry maintains a map of topic namespaces to plugin instances. It is used for auto-routing, validation, and discovery — when a message arrives, the registry identifies which plugin owns that topic and routes accordingly.
Registered Namespaces
| Namespace | Plugin | Server |
|---|---|---|
workflow | WorkflowEventPlugin | bas |
agent | AgentMessagePlugin | chat |
ui | UiActionPlugin | bas |
system | SystemEventPlugin | bas |
hil | (HIL suspension events) | bas |
notifications | (notification events) | bas |
Plugin Registry API
import { pluginRegistry } from 'edge-stream-js';
// Register a plugin
pluginRegistry.register(new InventoryEventPlugin());
// Look up a plugin by topic namespace
const plugin = pluginRegistry.getByNamespace('inventory');
// or by a full topic string
const plugin2 = pluginRegistry.getForTopic('inventory.lowStock');
// Check if a topic is registered
const isKnown = pluginRegistry.isRegistered('workflow');
// Get all registered namespaces
const namespaces = pluginRegistry.getNamespaces();
// ['workflow', 'agent', 'ui', 'system', 'inventory']
// Get all plugins
const all = pluginRegistry.getAll();
Auto-Validation via Registry
// Use the registry to validate incoming messages before processing
stream.subscribe('bas', 'workflow.*', (envelope) => {
const plugin = pluginRegistry.getForTopic(envelope.meta.topic);
if (plugin) {
const result = plugin.validate(envelope);
if (!result.valid) {
console.warn('Invalid message:', result.errors);
return; // drop invalid message
}
}
// Message is valid — proceed
workflowStore.handleEvent(envelope.body);
});
Namespace Conflict Detection
// Registering a plugin with a namespace that is already taken throws:
pluginRegistry.register(new WorkflowEventPlugin()); // 'workflow' → OK
pluginRegistry.register(new MyWorkflowPlugin()); // 'workflow' → throws Error:
// "Plugin namespace 'workflow' is already registered by WorkflowEventPlugin"
// To override: deregister first
pluginRegistry.deregister('workflow');
pluginRegistry.register(new MyWorkflowPlugin());
Application Bootstrap
// Register all plugins at application startup before stream.start()
import { pluginRegistry } from 'edge-stream-js';
import { WorkflowEventPlugin } from '@bizfirstgo/workflow-plugin';
import { AgentMessagePlugin } from '@bizfirstgo/agent-plugin';
import { UiActionPlugin } from '@bizfirstgo/ui-plugin';
import { SystemEventPlugin } from '@bizfirstgo/system-plugin';
function bootstrapEdgeStream() {
// 1. Register plugins
pluginRegistry.register(new WorkflowEventPlugin());
pluginRegistry.register(new AgentMessagePlugin());
pluginRegistry.register(new UiActionPlugin());
pluginRegistry.register(new SystemEventPlugin());
// 2. Create stream
const stream = createEdgeStream({ logLevel: 'info' });
stream.registerServer({ id: 'bas', ... });
stream.registerServer({ id: 'chat', ... });
// 3. Apply plugin hooks to servers
const basServer = stream.server('bas')!;
['workflow', 'ui', 'system'].forEach(ns => {
const plugin = pluginRegistry.getByNamespace(ns)!;
plugin.createDefaultHooks().forEach(hook =>
basServer.incomingPipeline.addHook(hook)
);
});
const chatServer = stream.server('chat')!;
pluginRegistry.getByNamespace('agent')!
.createDefaultHooks()
.forEach(hook => chatServer.incomingPipeline.addHook(hook));
return stream;
}
Next: Available Plugins
See the full catalog of pre-built EdgeStream plugins available for BizFirstGO applications. See Guide 10: Available Plugins.