SDKs
Java SDK
Java SDK#
The Eventvisor Java SDK follows the same runtime contract as the JavaScript SDK. It consumes generated datafiles and supports attributes, event validation, conditions, sampling, transforms, effects, destinations, modules, diagnostics, and persistence.
Creating an instance#
import org.eventvisor.sdk.Eventvisor;import org.eventvisor.sdk.EventvisorOptions;Eventvisor eventvisor = Eventvisor.createEventvisor( new EventvisorOptions().datafile(datafileJson));eventvisor.onReady().join();Attributes and events#
eventvisor.setAttribute("userId", "user-123").join();eventvisor.setAttribute("country", "NL").join();Object tracked = eventvisor.track( "order_completed", Map.of("orderId", "order-1", "total", 49.95)).join();State changing operations are asynchronous and processed in call order. track returns the transformed event, or null when the event is rejected by the pipeline.
Modules and diagnostics#
Implement EventvisorModule to provide lookups, effect handlers, transports, persistence, flushing, and cleanup. Modules receive EventvisorModuleApi, which exposes the current revision, diagnostics, and cycle safe nested tracking.
Eventvisor eventvisor = Eventvisor.createEventvisor( new EventvisorOptions() .datafile(datafileJson) .addModule(analyticsModule) .onDiagnostic(diagnostic -> report( diagnostic.getCode(), diagnostic.getDetails() )));Diagnostics use stable codes and cannot interrupt SDK behaviour. Error and fatal diagnostics also emit the ERROR SDK event.
Updating datafiles#
Datafiles merge by default. Pass true to replace the current datafile.
eventvisor.setDatafile(nextDatafile).join();eventvisor.setDatafile(nextDatafile, true).join();Lifecycle#
eventvisor.flush().join();eventvisor.close().join();Removing a module flushes it before closing it. Closing the instance flushes transports, closes modules, and removes event and diagnostic subscriptions.
See the Eventvisor Java repository for installation details and the complete API.

