Forage (original) (raw)

Forage Logo

Opinionated bean factories for Apache Camel.

Forage eliminates manual Java bean instantiation by providing factory classes configurable through properties files, environment variables, or system properties. Write your Camel routes — Forage handles the wiring.


Why Forage?

Apache Camel components often require manually creating and registering Java beans — data sources, connection factories, AI models, transaction managers. Forage replaces that boilerplate with a configuration-driven approach:

[](#%5F%5Fcodelineno-0-1)# "ordersDb" becomes a named bean — use it in routes as #ordersDb [](#%5F%5Fcodelineno-0-2)forage.ordersDb.jdbc.db.kind=postgresql [](#%5F%5Fcodelineno-0-3)forage.ordersDb.jdbc.url=jdbc:postgresql://localhost:5432/orders [](#%5F%5Fcodelineno-0-4)forage.ordersDb.jdbc.username=admin [](#%5F%5Fcodelineno-0-5)forage.ordersDb.jdbc.password=secret

No Java code. No Spring @Bean methods. No Quarkus producers. Just properties. The name you choose (e.g. ordersDb) registers a bean in the Camel registry, ready to reference in your routes as #ordersDb.

Features

Runtime Support

Forage works with all major Camel runtimes:

Runtime Support
Camel JBang Run directly with camel run (Forage plugin auto-discovers dependencies)
Camel Spring Boot Auto-configuration via starters
Camel Quarkus Native compilation ready

Quick Example

A complete AI agent with tool use in just two files:

Route (YAML)Configuration

[](#%5F%5Fcodelineno-1-1)- route: [](#%5F%5Fcodelineno-1-2) from: [](#%5F%5Fcodelineno-1-3) uri: timer:agent [](#%5F%5Fcodelineno-1-4) parameters: [](#%5F%5Fcodelineno-1-5) repeatCount: 1 [](#%5F%5Fcodelineno-1-6) steps: [](#%5F%5Fcodelineno-1-7) - setBody: [](#%5F%5Fcodelineno-1-8) constant: "give details of user 123" [](#%5F%5Fcodelineno-1-9) - to: [](#%5F%5Fcodelineno-1-10) uri: langchain4j-agent:myGraniteAgent [](#%5F%5Fcodelineno-1-11) parameters: [](#%5F%5Fcodelineno-1-12) agent: "#myGraniteAgent" [](#%5F%5Fcodelineno-1-13) - log: "${body}"

[](#%5F%5Fcodelineno-2-1)# "myGraniteAgent" — pick any name, then reference it in routes as #myGraniteAgent [](#%5F%5Fcodelineno-2-2)forage.myGraniteAgent.agent.model.kind=ollama [](#%5F%5Fcodelineno-2-3)forage.myGraniteAgent.agent.model.name=granite4:3b [](#%5F%5Fcodelineno-2-4)forage.myGraniteAgent.agent.base.url=http://localhost:11434

Getting Started

Ready to dive in? Head to the Getting Started guide.

Looking for working examples? Check out the Examples gallery.