Forage¶
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:
# "ordersDb" becomes a named bean — use it in routes as #ordersDb
forage.ordersDb.jdbc.db.kind=postgresql
forage.ordersDb.jdbc.url=jdbc:postgresql://localhost:5432/orders
forage.ordersDb.jdbc.username=admin
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¶
- JDBC — Auto-configured datasources with connection pooling
- JMS — Connection factories for ActiveMQ Artemis and more
- AI Agents — LangChain4j integration with tool use and memory
- Chat Models — OpenAI, Ollama, Gemini, Anthropic, and more
- Vector DBs — Qdrant, Milvus, PGVector, and more
- Transactions — XA distributed transactions with Narayana
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:
Getting Started¶
Ready to dive in? Head to the Getting Started guide.
Looking for working examples? Check out the Examples gallery.