Skip to content

Camel Integration Capability Plugin ​

The Camel Integration Capability can be embedded into an existing Apache Camel application as a plugin using the standard ContextServicePlugin SPI mechanism.

Installation ​

Add the plugin dependency to your project:

xml
<dependency>
    <groupId>ai.wanaku</groupId>
    <artifactId>camel-integration-capability-plugin</artifactId>
    <version>0.1.1</version>
</dependency>

The plugin is automatically discovered via Java's ServiceLoader when the jar is on the classpath. No additional configuration is needed in your Camel application code.

Configuration ​

The plugin is configured through a properties file and/or environment variables. Environment variables take precedence over properties file values.

Properties File ​

Create a file named camel-integration-capability.properties in your classpath (e.g., src/main/resources/):

properties
# Registration (required)
registration.url=http://localhost:8080

# Registration announce address (default: auto)
registration.announce.address=auto

# gRPC Configuration (default: 9190)
grpc.port=9190

# Service Identity (default: camel)
service.name=my-service

# Routes Configuration (required)
routes.ref=file:///path/to/routes.yaml

# Rules (optional)
rules.ref=file:///path/to/rules.yaml

# Authentication (required)
token.endpoint=http://localhost:8080/oauth/token
client.id=my-client
client.secret=my-secret

# Dependencies (optional)
dependencies=

# Repositories (optional)
repositories=

# Initialization (optional)
init.from=git@github.com:example/repo.git
data.dir=/tmp

Environment Variables ​

All properties can be overridden using environment variables. This is the recommended approach for container deployments (OpenShift, Kubernetes).

PropertyEnvironment VariableDescription
registration.urlREGISTRATION_URLWanaku registration endpoint URL
registration.announce.addressREGISTRATION_ANNOUNCE_ADDRESSAddress announced to discovery service
grpc.portGRPC_PORTgRPC server port
service.nameSERVICE_NAMEService name for registration
routes.refROUTES_PATHReference to Camel routes YAML
rules.refROUTES_RULESReference to exposure rules YAML
token.endpointTOKEN_ENDPOINTOAuth token endpoint
client.idCLIENT_IDOAuth client ID
client.secretCLIENT_SECRETOAuth client secret
dependenciesDEPENDENCIESComma-separated dependency refs
repositoriesREPOSITORIESComma-separated repository URLs
init.fromINIT_FROMGit repository URL to clone
data.dirDATA_DIRData directory path

OpenShift / Kubernetes Deployment ​

When deploying to OpenShift or Kubernetes, configure the plugin using environment variables in your deployment:

yaml
apiVersion: apps/v1
kind: Deployment
metadata:
  name: my-camel-app
spec:
  template:
    spec:
      containers:
        - name: app
          image: my-camel-app:latest
          env:
            - name: REGISTRATION_URL
              value: "http://wanaku-router:8080"
            - name: SERVICE_NAME
              value: "my-camel-service"
            - name: GRPC_PORT
              value: "9190"
            - name: ROUTES_PATH
              value: "file:///data/routes.yaml"
            - name: CLIENT_ID
              valueFrom:
                secretKeyRef:
                  name: wanaku-credentials
                  key: client-id
            - name: CLIENT_SECRET
              valueFrom:
                secretKeyRef:
                  name: wanaku-credentials
                  key: client-secret
          ports:
            - containerPort: 9190
              name: grpc

Plugin Lifecycle ​

The plugin integrates with Apache Camel's lifecycle:

  1. load() - Called after CamelContext creation, before routes start:

    • Loads configuration from properties/environment
    • Initializes data directory
    • Runs initializers (e.g., git clone)
    • Downloads resources
    • Starts gRPC server
    • Registers with discovery service
  2. unload() - Called during CamelContext shutdown:

    • Deregisters from discovery service
    • Stops gRPC server
    • Releases resources

Comparison with Standalone Application ​

FeaturePluginStandalone
ConfigurationProperties + EnvironmentCLI arguments
DeploymentEmbedded in existing appSeparate process
Container supportVia host appNative Dockerfile
Use caseAdd capability to existing Camel appDedicated capability service

For standalone deployment, see usage.md.