Skip to content

Cat Facts Example

A pure Java Apache Camel application that fetches random cat facts, demonstrating integration with the Wanaku Camel Integration Capability plugin.

Overview

This example exposes a Camel route (cat-facts-route) that calls the MeowFacts API to retrieve random cat facts. The route is registered as an MCP tool via the Wanaku plugin.

Prerequisites

  • Java 21+
  • Maven 3.8+
  • Wanaku Router running (for plugin registration)

Building

bash
mvn -Pbuild-time clean package

Runtime plugin loading

bash
mvn -Pruntime clean package

Configuration

Environment Variables

VariableDescriptionExample
REGISTRATION_URLWanaku router URLhttp://localhost:8080
REGISTRATION_ANNOUNCE_ADDRESSAddress to announce for callbackslocalhost
GRPC_PORTgRPC server port9190
SERVICE_NAMEService name for registrationcat-facts-service
ROUTES_RULESPath to route rules filefile:///path/to/meow-rules.yaml
CLIENT_IDOAuth client IDwanaku-service
CLIENT_SECRETOAuth client secret<secret>

Route Rules

The ROUTES_RULES variable accepts:

  • File path: file:///path/to/meow-rules.yaml
  • Datastore reference: datastore://meow-rules.yaml

Running

With build-time plugin

bash
REGISTRATION_URL=http://localhost:8080 \
REGISTRATION_ANNOUNCE_ADDRESS=localhost \
GRPC_PORT=9190 \
SERVICE_NAME=cat-facts-service \
ROUTES_RULES=file://$PWD/config/meow-rules.yaml \
CLIENT_ID=wanaku-service \
CLIENT_SECRET=<secret> \
java -jar target/cat-facts-example-1.0-SNAPSHOT-jar-with-dependencies.jar

With runtime plugin

Download the plugin JAR and run with classpath:

bash
java -cp /path/to/camel-integration-capability-plugin-0.1.0-SNAPSHOT-shaded.jar:target/cat-facts-example-1.0-SNAPSHOT-jar-with-dependencies.jar \
ai.wanaku.demos.camel.core.CatFactsMain

MCP Tool

Once registered, the route is exposed as an MCP tool:

ToolDescriptionParameters
cat-facts-routeRetrieve random facts about catscount (int, required) - number of facts to retrieve