TraceStax Docs
Java
The TraceStax Java SDK supports Spring Batch, Quartz Scheduler, and any custom executor-based worker. It works with Java 11+ and is available on Maven Central.
Requirements
Section titled “Requirements”- Java 11+
- Spring Boot 3.x (for Spring Batch integration) or any Quartz 2.x setup
Installation
Section titled “Installation”<dependency> <groupId>io.tracestax</groupId> <artifactId>tracestax-java</artifactId> <version>1.0.0</version></dependency>implementation 'io.tracestax:tracestax-java:1.0.0'Add the auto-configuration dependency and set your API key:
<dependency> <groupId>io.tracestax</groupId> <artifactId>tracestax-spring-batch</artifactId> <version>1.0.0</version></dependency>tracestax: api-key: ${TRACESTAX_API_KEY}The starter registers a JobExecutionListener and StepExecutionListener automatically — no changes to your @Job or @Step beans.
Register the TraceStax JobListener with your scheduler:
import io.tracestax.quartz.TraceStaxJobListener;
SchedulerFactory factory = new StdSchedulerFactory();Scheduler scheduler = factory.getScheduler();
scheduler.getListenerManager().addJobListener( new TraceStaxJobListener(TraceStaxConfig.builder() .apiKey(System.getenv("TRACESTAX_API_KEY")) .build()));
scheduler.start();For any ExecutorService or ThreadPoolExecutor based worker:
import io.tracestax.TraceStaxClient;import io.tracestax.TraceStaxEvent;
TraceStaxClient client = TraceStaxClient.builder() .apiKey(System.getenv("TRACESTAX_API_KEY")) .build();
executor.submit(() -> { TraceStaxEvent event = client.startJob("process-order", "default"); try { processOrder(orderId); event.succeed(); } catch (Exception e) { event.fail(e); throw e; }});Configuration
Section titled “Configuration”| Property | Env var | Default | Description |
|---|---|---|---|
tracestax.api-key | TRACESTAX_API_KEY | — | Required |
tracestax.worker-id | TRACESTAX_WORKER_ID | hostname + PID | Worker identifier |
tracestax.enabled | TRACESTAX_ENABLED | true | Set to false in tests |
tracestax.ingest-url | TRACESTAX_INGEST_URL | https://ingest.tracestax.com | Custom endpoint |
tracestax.timeout-ms | — | 3000 | HTTP timeout |
Testing
Section titled “Testing”tracestax: enabled: falseOr use the provided no-op client:
TraceStaxClient client = TraceStaxClient.noop();