Works with Spring AI, LangChain4j, and any LLM

Your AI models are smart. Your scheduling infrastructure should be too.

Every Java AI app hits the same wall: embedding generation is slow, ML pipelines crash mid-run, and LLM calls timeout under load. You end up writing more scheduling code than AI logic.

JobRunr fixes that. One dependency, your existing database, and your AI workloads run reliably in the background.

"Tasks like training large language models and updating embeddings often slow things down when handled synchronously. These challenges naturally aligned with what JobRunr does best: managing long-running tasks in the background."

Ronald Dehuysser

CTO & Co-founder, JobRunr

AI in Java is hard for the wrong reasons

Frameworks like Spring AI and LangChain4j make LLM integration straightforward. The hard part is everything around it.

  • Embedding generation blocks your app

    Computing vectors for thousands of documents takes time. Run it synchronously and your users wait. Run it in a thread pool and you lose work on restarts.

  • Pipelines fail silently

    A network glitch during an LLM API call loses an hour of processing. Without automatic retries and monitoring, failures go unnoticed until someone complains.

  • Scale is unpredictable

    Your RAG system works with 100 documents. What about 10 million? Distributing AI workloads across multiple servers shouldn't require a rewrite.

  • No visibility into what's running

    When your embedding sync job fails at 3 AM, how long before anyone notices? Log files and hope is not a monitoring strategy.

AI patterns that just work

Real code examples showing how Java developers use JobRunr to build reliable AI applications.

1

RAG Embedding Sync

Keep your vector database in sync with your knowledge base. A recurring job scans for changes and enqueues embedding updates. Workers process them in parallel. Failed jobs retry automatically.

  • Automatic retries with exponential backoff when LLM APIs fail
  • Parallel processing across configurable worker pools
  • Recurring schedule keeps embeddings fresh without manual triggers
EmbeddingService.java
@Recurring(id = "embedding-sync", cron = "0 * * * *")
@Job(name = "Sync embeddings with knowledge base")
public void syncEmbeddings() {
    List<Document> changed = documentRepo
        .findModifiedSince(lastSync);

    jobScheduler.enqueue(changed.stream(),
        doc -> embeddingManager
            .updateEmbedding(doc.getId()));
}

@Job(name = "Update embedding for document %0")
public void updateEmbedding(UUID documentId) {
    Document doc = documentRepo.findById(documentId);
    vectorStore.delete(doc.getId());
    List<float[]> embeddings = aiModel.embed(doc.getContent());
    vectorStore.save(doc.getId(), embeddings);
}
2

Keep Your API Fast

AI computation is too slow for the request path. Offload it to the background and respond instantly. In this example, a support ticket gets resolved and the embedding is computed asynchronously while the API returns in milliseconds.

  • Fire-and-forget heavy computation on any data change
  • API responds instantly while JobRunr handles the heavy lifting
  • Works with Oracle AI Vector Search, pgvector, any vector DB
TicketService.java
public Ticket closeTicket(UUID ticketId, String resolution) {
    Ticket ticket = ticketRepository
        .findById(ticketId).orElseThrow();
    ticket.close(resolution);
    ticketRepository.save(ticket);

    // Embedding computation happens in the background
    jobScheduler.enqueue(
        () -> computeAndStoreEmbedding(ticketId));

    return ticket; // API responds immediately
}

@Job(name = "Compute embedding for ticket %0")
public void computeAndStoreEmbedding(UUID ticketId) {
    Ticket ticket = ticketRepository
        .findById(ticketId).orElseThrow();
    double[] embedding = embeddingModel
        .embed(ticket.getContent());
    ticketRepository.updateEmbedding(ticketId, embedding);
}
3

AI Agent Scheduling

AI agents need to schedule tasks, run periodic jobs, and survive application restarts. AgentRunr, an open-source Java AI agent runtime, uses JobRunr as its scheduling backbone.

  • Agents self-schedule work through tool calls
  • Persistent tasks survive application restarts
  • Full visibility via the JobRunr dashboard
AgentSchedulingTool.java
// AI agents can schedule their own tasks via tool calls
@Tool("Schedule a recurring task for the agent")
public String scheduleTask(
        String cronExpression,
        String taskDescription) {

    jobScheduler.scheduleRecurrently(
        taskDescription.hashCode() + "",
        cronExpression,
        () -> agentService
            .executeTask(taskDescription));

    return "Task scheduled: " + taskDescription;
}

Production AI workloads powered by JobRunr

How companies use JobRunr to run AI and ML in production.

RAG Embedding Synchronization

Keep vector databases in sync with constantly changing knowledge bases. JobRunr manages recurring scans, parallel embedding updates, and automatic retries when LLM APIs fail.

  • Spring AI + pgvector integration with background embedding sync
  • Parallel processing across configurable workers
  • Automatic retries with exponential backoff
Full RAG tutorial →

Semantic Search with Vector Embeddings

Build responsive search by computing embeddings in background jobs. API calls return instantly while JobRunr handles the heavy vector computation asynchronously.

  • Oracle AI Vector Search with ONNX model integration
  • Fire-and-forget embedding generation on data changes
  • Cosine similarity search for intelligent ticket matching
Semantic Search tutorial →

Medical Image Analysis (ML Pipelines)

A med-tech company distributes image analysis across multiple servers using JobRunr Pro, achieving 10x throughput improvement while keeping patient data on-premise.

  • Batch processing for parallel image classification
  • 10x throughput improvement via distributed processing
  • Data stays on-premise with no external service dependencies
Read the case study →

NLP at Scale: Sentiment Analysis

Process thousands of web pages through NLP models with parallel execution and fault tolerance. JobRunr distributes crawling jobs and retries failed requests automatically.

  • Parallel web crawling across multiple workers
  • Real-time monitoring of analysis progress via dashboard
  • Automatic retry for transient network failures
Read the case study →

Works with your existing Java AI stack

No new infrastructure. Just add the dependency and start scheduling AI workloads.

AI Frameworks

  • Spring AI
  • LangChain4j
  • Deep Java Library (DJL)

LLM Providers

  • OpenAI / Azure OpenAI
  • Anthropic (Claude)
  • Mistral / Ollama (local)

Vector Databases

  • pgvector (PostgreSQL)
  • Oracle AI Vector Search
  • Qdrant / Weaviate / Pinecone

Java Frameworks

  • Spring Boot 3
  • Quarkus
  • Micronaut / Plain Java

JobRunr Storage

  • PostgreSQL / MySQL / MariaDB
  • Oracle / SQL Server
  • MongoDB

Build Tools

  • Maven
  • Gradle
  • Any JVM build tool

With and without JobRunr

ChallengeWithout JobRunrWith JobRunr
Embedding syncCron scripts, manual retries, no visibility@Recurring + automatic retries + dashboard
LLM API failuresSilent failures, lost workAutomatic retry with exponential backoff
Scaling to N serversRewrite your schedulerAdd instances, same database, done
Pipeline monitoringLog files and hopeReal-time dashboard with full job history
Long-running ML tasksRequest timeouts, angry usersFire-and-forget background processing

Get started in 5 minutes

Add one dependency, two config lines, and schedule your first AI job.

Step 1: Add the dependency

<dependency>
    <groupId>org.jobrunr</groupId>
    <artifactId>jobrunr-spring-boot-3-starter</artifactId>
    <version>8.1.0</version>
</dependency>

Step 2: Enable the background server and dashboard

jobrunr.background-job-server.enabled=true
jobrunr.dashboard.enabled=true

Step 3: Schedule your first AI job

@Service
public class EmbeddingService {

    private final JobScheduler jobScheduler;
    private final VectorStore vectorStore;
    private final EmbeddingModel embeddingModel;

    // Constructor injection...

    public void onDocumentCreated(UUID documentId) {
        jobScheduler.enqueue(() -> generateEmbedding(documentId));
    }

    @Job(name = "Generate embedding for %0")
    public void generateEmbedding(UUID documentId) {
        Document doc = documentRepo.findById(documentId);
        float[] embedding = embeddingModel.embed(doc.getContent());
        vectorStore.save(documentId, embedding);
    }
}

That’s it. Your embedding generation now runs in the background, retries on failure, and shows up in the dashboard at http://localhost:8000.

FAQ

Common Questions

Answers for Java developers building AI applications with JobRunr.

JobRunr automates the scheduling, execution, and retry of embedding generation jobs. Instead of computing embeddings synchronously (which blocks your app) or building a custom scheduler (which takes months), you schedule embedding jobs with one line of code. JobRunr handles parallelization, retries on LLM API failures, and gives you a dashboard to monitor everything.
JobRunr works with any Java AI framework. It integrates naturally with Spring AI, LangChain4j, and Deep Java Library (DJL). Since JobRunr schedules plain Java methods, any code that calls an LLM API, generates embeddings, or runs inference can be scheduled as a background job.
Yes. JobRunr supports all major databases including PostgreSQL (with pgvector), Oracle (with AI Vector Search), and any other database you use for vector storage. The recurring job feature is ideal for keeping embeddings in sync with changing data sources.
Connect multiple application instances to the same database and JobRunr automatically distributes jobs across all workers. No configuration changes needed. A med-tech company achieved 10x throughput improvement by simply adding more instances to their medical image analysis pipeline.
No. JobRunr uses your existing SQL database for storage. No Redis, no RabbitMQ, no Kafka, no additional infrastructure. Add the Maven or Gradle dependency, set two config properties, and you’re running background AI jobs with a built-in dashboard.
AgentRunr is an open-source Java AI agent runtime that uses JobRunr as its scheduling backbone. It demonstrates how AI agents can self-schedule cron jobs, one-shot tasks, and recurring work through tool calls. JobRunr persists these tasks so they survive application restarts, and the dashboard provides full visibility into agent-scheduled work.
call to action

Ready to build reliable background jobs?

You focus on your business logic. We’ll take care of scheduling your background jobs reliably.

Get Started with JobRunr