Java Event Manager
Java Event Manager routes events through trusted Java code compiled at runtime, and forwards an event to child tasks only when the snippet returns true.
Route events with code-level logic
Use Java Event Manager when event routing needs custom Java logic that is difficult to express with ordinary Event Manager rules. The component subscribes to the agent event bus, compiles configured Java code on startup, and calls it for every received event.
The generated method receives engine and event. Return true when the event should be forwarded to child tasks; return false when it should be ignored.
Name the routing component
Set Title to the routing purpose, for example advanced alarm filter, vendor event normalizer, or Java event debounce.
Keep imports minimal
Use Imports only for event classes, task classes, or utility types not covered by the default imports.
Write a fast event predicate
Java code runs on the event delivery path. It should inspect the event, make a quick routing decision, and return a boolean.
Configuration parameters
| Parameter | Required | Description | Default |
|---|---|---|---|
Title | Yes | Display name of the event routing component. | None |
Imports | Optional | Additional Java import statements appended to the generated class. | Empty |
Class properties | Optional | Additional class-level fields or helper methods compiled into the event consumer. Keep state thread-safe and bounded. | Empty |
Java code | Yes | Body of the boolean event consumer method. It receives engine and event, and returns whether child tasks should receive the event. | Print event and return true |
Events are filtered before child tasks run
For every received event, the compiled Java method decides whether to forward it. When true is returned, Banalytics creates an execution context, puts the current event into it, and calls child tasks in order. If a child task returns false, remaining child tasks are skipped.
Use Class properties for helper methods, constants, compiled patterns, or small caches. Avoid growing collections of events because the generated class can stay cached and long-lived.
Event predicate
Inspect event type and fields, then return true only for events that should continue downstream.
Forwarded context
Accepted events are placed into a new execution context for subscribed child tasks.
Runtime compilation
Compilation happens when the component starts; compile errors prevent it from starting.
Use Java for advanced event routing
Complex event filter
Check the concrete event class and several fields in Java, then return true only for the combination that should reach child tasks.
Event enrichment gateway
Normalize vendor-specific event metadata before forwarding the event to downstream tasks that expect a consistent shape.
Prototype advanced automation
Implement a custom condition quickly in Java, then move stable business rules to Event Manager when they can be maintained through the UI.
Stateful debounce or rate limit
Keep a small timestamp map in Class properties and suppress repeated events within a short interval. Bound the map by source or event type to avoid unbounded memory growth.
Development and troubleshooting
Start with a simple print and return false, verify the event shape, then replace logging with precise checks and enable forwarding.
Operational notes
Compilation controls startup
The code is compiled when the component starts. Compilation errors prevent startup until the snippet is fixed.
Stop on failure is intentional
The default restart-on-failure mode is stop-on-failure, which is appropriate for custom code because repeated automatic restarts can hide a broken snippet.
Handle unexpected event shapes
Exceptions thrown by the snippet are logged and handled as processing errors. Prefer explicit type checks and safe fallbacks instead of assuming every event has the same fields.
Use ordinary rules first
Use Event Manager for ordinary operator-managed rules. Use Java Event Manager only when code-level logic is genuinely needed and the maintainer is comfortable owning Java snippets.
Keep code non-blocking
Long I/O, sleeps, network calls, or heavy calculations can delay delivery of later events. Keep routing code fast and predictable.