svc-loader-yaml¶
Load and reload processors at runtime from YAML or Java source. Hot-reload graphs without restarting the server.
<dependency>
<groupId>com.telamin</groupId>
<artifactId>svc-loader-yaml</artifactId>
<version>1.0.35</version>
</dependency>
When to use¶
- You ship processor topologies as YAML config and want operators to swap them at runtime.
- You need a "compile + load" admin command that builds a new processor from source.
- You're prototyping topologies and want fast iteration without server restarts.
Modes¶
| Mode | Source | Speed at runtime | Best for |
|---|---|---|---|
| Compiled | Java source | Fast | Production-grade dynamic loading |
| Interpreted | YAML | Slower at first event, fast steady-state | Pure-config topologies |
Sample¶
Register the loader as a service and point it at one or more processor topologies to instantiate at boot:
services:
- name: yamlLoaderService
service: !!com.telamin.mongoose.plugin.loader.yaml.EventHandlerLoader
loadAtStartup:
- { yamlFile: "config/log-processor.yaml", compile: true }
Or, programmatically from Java:
EventHandlerLoader.EventLoadAtStartup load = new EventHandlerLoader.EventLoadAtStartup();
load.setYamlFile("config/log-processor.yaml");
load.setCompile(true);
EventHandlerLoader loader = new EventHandlerLoader();
loader.setLoadAtStartup(Set.of(load));
MongooseServerConfig.builder()
.addService(ServiceConfig.<EventHandlerLoader>builder()
.service(loader)
.serviceClass(EventHandlerLoader.class)
.name("yamlLoaderService")
.build())
.build();
The processor YAML uses namedNodes or nodes plus SnakeYAML's !!ClassName tag:
MyHandler is a plain ObjectEventHandlerNode — no start() override or
explicit subscribeToNamedFeed(...) call required. Under broadcast=true
feeds (the catalogue's default), the dispatcher wires the dynamically-loaded
processor through the same subscription path as a statically-registered one.
When svc-admin-rest, svc-admin-telnet, or svc-admin-web is on the classpath, the loader
also registers four admin commands:
yamlLoader.compileProcessor <yamlFile> [group]— compile and add a YAML topologyyamlLoader.interpretProcessor <yamlFile> [group]— same, via the Fluxtion interpreter (no codegen)javaLoader.compileProcessor <javaFile> [group]— compile and add a JavaFluxtionGraphBuildersource filejavaLoader.interpretProcessor <javaFile> [group]— same, via the interpreter
Examples¶
- plugins/yaml-service-loader-example —
EventHandlerLoaderregistered as a service withloadAtStartup; instantiates a handler fromlog-processor.yaml, feeds it events from an in-memory source, prints them through the YAML-injected prefix. - getting-started/five-minute-yaml-tutorial — full YAML config flow into a booting server. Same config shape
svc-loader-yamlconsumes at runtime. - getting-started/app-integration-tutorial — multi-process YAML config across a data-generator + PnL calculator.
Gotchas¶
- SnakeYAML 2.x blocks
!!ClassNametags by default. Until the plugin ships a release that installs a permissiveTagInspector, pinorg.yaml:snakeyaml:1.33in the consumer pom. mongoose>= 1.0.9 required. Earlier versions miss event-processor agents that the loader registers during its ownstart()hook — the processor would init but never receive events. Fixed by a late-start pass inMongooseServer.start().