Skip to main content

Overview

Integration builders provide a fluent API for constructing Camel integration applications. They handle route configuration, dependencies, properties, customizers, and deployment settings.

Builder hierarchy

AbstractIntegrationBuilder<SELF>
  ├── IntegrationBuilder
  └── AbstractGitIntegrationBuilder<SELF>
        └── AbstractMavenGitIntegrationBuilder<SELF>
              ├── SpringBootIntegrationBuilder
              └── QuarkusIntegrationBuilder

IntegrationBuilder

The standard integration builder for creating integrations from route builders. Package: software.tnb.product.integration.builder

Constructor

public IntegrationBuilder(String name)
name
String
required
The unique name identifier for the integration

Example

App app = product.createIntegration(
    new IntegrationBuilder("my-integration")
        .fromRouteBuilder(new MyRouteBuilder())
        .dependencies("kafka", "http")
        .addToApplicationProperties("camel.component.kafka.brokers", "localhost:9092")
);

AbstractIntegrationBuilder

Base class providing core integration building functionality. Package: software.tnb.product.integration.builder

Route configuration

fromRouteBuilder()

Adds Camel route builders to the integration.
public SELF fromRouteBuilder(RouteBuilder... routeBuilders)
public SELF fromRouteBuilder(RouteBuilder routeBuilder, Set<String> ignoredPackages)
routeBuilders
RouteBuilder...
required
One or more Camel RouteBuilder instances containing route definitions
ignoredPackages
Set<String>
Package prefixes to exclude from imports (defaults to software.tnb, org.junit, io.fabric8)
Example:
new IntegrationBuilder("kafka-test")
    .fromRouteBuilder(
        new RouteBuilder() {
            @Override
            public void configure() {
                from("kafka:input-topic")
                    .log("Message: ${body}")
                    .to("kafka:output-topic");
            }
        }
    )

Dependencies

dependencies()

Adds Maven dependencies to the integration.
public SELF dependencies(String... dependencies)
public SELF dependencies(Dependency... dependencies)
dependencies
String... | Dependency...
required
Dependency identifiers. Strings without colons are treated as Camel component names (e.g., “kafka” becomes “camel-kafka” or “camel-quarkus-kafka”). Strings with colons are treated as Maven coordinates (e.g., “org.apache.commons:commons-lang3:3.12.0”).
Example:
.dependencies("kafka", "http", "jackson")
.dependencies("org.postgresql:postgresql:42.6.0")

Properties

addToApplicationProperties()

Adds properties to the application configuration (application.properties for Spring Boot, application.yml for Quarkus).
public SELF addToApplicationProperties(String key, String value)
public SELF addToApplicationProperties(Map<String, String> properties)
public SELF addToApplicationProperties(Properties properties)
public SELF addToApplicationProperties(InputStream inputStream)
key
String
Property key
value
String
Property value
Example:
.addToApplicationProperties("camel.component.kafka.brokers", "localhost:9092")
.addToApplicationProperties(Map.of(
    "server.port", "8080",
    "logging.level.root", "INFO"
))

addToSystemProperties()

Adds JVM system properties.
public SELF addToSystemProperties(String key, String value)
public SELF addToSystemProperties(Map<String, String> properties)
public SELF addToSystemProperties(Properties properties)

Resources

addClasspathResource()

Adds a classpath resource to the integration.
public SELF addClasspathResource(String resource)
resource
String
required
Path to the resource on the classpath

addResource()

Adds a resource with explicit content.
public SELF addResource(Resource resource)

Customizers

addCustomizer()

Adds customizers to modify the integration.
public SELF addCustomizer(Customizer c, Customizer... others)
c
Customizer
required
Primary customizer instance
others
Customizer...
Additional customizers
Example:
.addCustomizer(new RestCustomizer())
.addCustomizer(Customizers.SPRINGBOOT.customize(builder -> {
    builder.dependencies("actuator");
}))
See Customizers for more details.

Port configuration

port()

Configures the application HTTP port.
public SELF port(int port)
public SELF port(int port, boolean configureDefaultServer)
port
int
required
The port number to expose
configureDefaultServer
boolean
default:"true"
Whether to configure this as the default HTTP server port. Set to false when using a component that starts its own server.
Example:
.port(8081)  // Application listens on 8081
.port(9090, false)  // Expose port 9090 but don't configure default server

addAdditionalPorts()

Exposes additional ports beyond the main HTTP port.
public SELF addAdditionalPorts(Integer... ports)

Additional classes

addClass()

Adds additional Java classes to the integration.
public SELF addClass(Class<?> clazz)
public SELF addClass(CompilationUnit cu)
public SELF addClass(Path file)
clazz
Class<?>
Java class to add (sources must be available)
cu
CompilationUnit
JavaParser compilation unit
file
Path
Path to Java source file or directory

Plugins

addPlugin()

Adds Maven plugins to the integration build.
public SELF addPlugin(Plugin p, Plugin... others)

Advanced configuration

addJavaAgent()

Attaches a Java agent to the application.
public SELF addJavaAgent(String javaAgentPath)
javaAgentPath
String
required
Path to the Java agent JAR file

addVmArgument()

Adds JVM arguments.
public SELF addVmArgument(String argument)
argument
String
required
JVM argument (e.g., “Xmx256m”, “XX:+UseG1GC”)
Example:
.addVmArgument("Xmx512m")
.addVmArgument("XX:+HeapDumpOnOutOfMemoryError")

addBytemanRule()

Adds Byteman rules for bytecode manipulation.
public SELF addBytemanRule(Resource rule)

startupRegex()

Overrides the regex pattern used to detect application startup.
public SELF startupRegex(String regex)
regex
String
required
Regular expression pattern to match in application logs
Default: "(?m)^.*Apache Camel.*started in.*$"

runApplication()

Controls whether the application runs after build.
public SELF runApplication(boolean runApplication)

Volume configuration (OpenShift/Kubernetes)

addConfigMapVolume()

public SELF addConfigMapVolume(String name, String configMapName)

addSecretVolume()

public SELF addSecretVolume(String name, String secretName)

addEmptyDirVolume()

public SELF addEmptyDirVolume(String name)

addVolumeMount()

public SELF addVolumeMount(String volumeName, String mountPath, boolean readOnly)
Example:
.addConfigMapVolume("app-config", "my-configmap")
.addVolumeMount("app-config", "/etc/config", true)

SpringBootIntegrationBuilder

Specialized builder for Spring Boot integrations with Git repository support. Package: software.tnb.product.csb.integration.builder Extends: AbstractMavenGitIntegrationBuilder<SpringBootIntegrationBuilder>

Constructor

public SpringBootIntegrationBuilder(String integrationName)

Spring Boot specific methods

fromSpringBootXmlCamelContext()

Adds an XML-based Camel context configuration.
public SpringBootIntegrationBuilder fromSpringBootXmlCamelContext(String camelContextPath)
camelContextPath
String
required
Classpath location of the Spring Boot XML Camel context file
Example:
new SpringBootIntegrationBuilder("xml-integration")
    .fromSpringBootXmlCamelContext("camel-context.xml")
    .dependencies("spring-boot-starter")

useExistingJar()

Uses a pre-built JAR file instead of building from source.
public SpringBootIntegrationBuilder useExistingJar(Path existingJar)
existingJar
Path
Path to existing JAR file. Pass null to enable building.
Example:
new SpringBootIntegrationBuilder("prebuilt-app")
    .useExistingJar(Paths.get("/path/to/app.jar"))

Git repository methods

Inherited from AbstractGitIntegrationBuilder:

fromGitRepository()

public SELF fromGitRepository(String repositoryUrl)
repositoryUrl
String
required
Git repository URL (HTTP/HTTPS or SSH)

withSubDirectory()

public SELF withSubDirectory(String subDirectory)
subDirectory
String
Subdirectory within the repository containing the project

withBranch()

public SELF withBranch(String branch)
branch
String
default:"main"
Git branch to checkout

buildProject()

public SELF buildProject(boolean buildProject)
buildProject
boolean
default:"true"
Whether to build the Maven project after checkout

cleanBeforeBuild()

public SELF cleanBeforeBuild(boolean cleanBeforeBuild)
cleanBeforeBuild
boolean
default:"true"
Whether to run mvn clean before building

Maven configuration methods

Inherited from AbstractMavenGitIntegrationBuilder:

withMavenProperty()

public SELF withMavenProperty(String key, String value)
public SELF withMavenProperties(Map<String, String> props)

withJavaProperty()

public SELF withJavaProperty(String key, String value)
public SELF withJavaProperties(Map<String, String> props)

withProjectVersion()

public SELF withProjectVersion(String projectVersion)

withParentVersion()

public SELF withParentVersion(String parentVersion)

withFinalName()

public SELF withFinalName(String finalName)

withPreMavenBuildCustomizer()

public SELF withPreMavenBuildCustomizer(Consumer<Path> customizer)

Complete example

App app = product.createIntegration(
    new IntegrationBuilder("simple-route")
        .fromRouteBuilder(new RouteBuilder() {
            @Override
            public void configure() {
                from("timer:tick")
                    .log("Tick: ${body}")
                    .to("log:output");
            }
        })
        .dependencies("timer", "log")
);

Build docs developers (and LLMs) love