### Processor Example Source: https://github.com/apache/camel/blob/main/docs/main/modules/getting-started/pages/index.adoc An example of implementing a processor to modify message bodies and configuring a route to use it. ```java public void process(Exchange exchange) { final String body = exchange.getMessage().getBody(String.class); System.out.println("Updated body: " + body.replace("city", "county")); // ... more code here } public void configure() { from("file:src/data?noop=true") .process(this::process); } ``` -------------------------------- ### Install jq (JSON Processor) Source: https://github.com/apache/camel/blob/main/components/camel-salesforce/it/resources/README.md Guides for installing jq, a lightweight and flexible command-line JSON processor, essential for parsing SF CLI JSON output. Installation methods vary by operating system. ```bash # macOS brew install jq ``` ```bash # Ubuntu/Debian sudo apt-get install jq ``` ```bash # RHEL/CentOS sudo yum install jq ``` -------------------------------- ### Project build output Source: https://github.com/apache/camel/blob/main/docs/main/modules/getting-started/pages/index.adoc Example output messages after running the Camel project, indicating successful startup and message processing. ```bash ...\n[che.camel.learn.MainApp.main()] MainSupport INFO Apache Camel (Main) 4.20.0 is starting\n[che.camel.learn.MainApp.main()] BaseMainSupport INFO Auto-configuration summary\n[che.camel.learn.MainApp.main()] XPathBuilder INFO Created default XPathFactory com.sun.org.apache.xpath.internal.jaxp.XPathFactoryImpl@33cc7a16\n[che.camel.learn.MainApp.main()] FileEndpoint INFO Endpoint is configured with noop=true so forcing endpoint to be idempotent as well\n[che.camel.learn.MainApp.main()] FileEndpoint INFO Using default memory based idempotent repository with cache max size: 1000\n[che.camel.learn.MainApp.main()] AbstractCamelContext INFO Apache Camel 4.20.0 (camel-1) is starting\n[che.camel.learn.MainApp.main()] AbstractCamelContext INFO Routes startup (started:1)\n[che.camel.learn.MainApp.main()] AbstractCamelContext INFO Started route1 (file://src/data)\n[che.camel.learn.MainApp.main()] AbstractCamelContext INFO Apache Camel 4.20.0 (camel-1) started in 89ms (build:12ms init:68ms start:9ms JVM-uptime:1s)\n[che.camel.learn.MainApp.main()] MainSupport INFO Waiting until complete: Duration max 2 messages processed\n[1) thread #1 - file://src/data] route1 INFO Other message\n[1) thread #1 - file://src/data] route1 INFO UK message\n ``` -------------------------------- ### Start Query Execution and Get Results as SelectList Source: https://github.com/apache/camel/blob/main/docs/components/modules/ROOT/pages/aws2-athena-component.adoc This example shows how to execute a query and retrieve results as a `SelectList`. This returns a `GetQueryResultsResponse` containing up to 1,000 rows and a `NextToken` header for manual pagination. ```APIDOC ## Start Query Execution and Get Results as SelectList This operation starts an Athena query execution and retrieves a limited set of results along with pagination information. ### Operations - `startQueryExecution`: Initiates the query execution. - `getQueryResults`: Retrieves the query results. ### Parameters for `getQueryResults` - `outputType` (string) - Required - Specifies the output format. Use `SelectList` to get a `GetQueryResultsResponse` with a `NextToken` header. ### Example Usage (Java DSL) ```java from("direct:start") .setBody(constant("SELECT 1")) .to("aws2-athena://label?operation=startQueryExecution&waitTimeout=60000&outputLocation=s3://bucket/path/") .to("aws2-athena://label?operation=getQueryResults&outputType=SelectList") .to("mock:result"); ``` ### Example Usage (XML DSL) ```xml SELECT 1 ``` ### Example Usage (YAML DSL) ```yaml - route: from: uri: direct:start steps: - setBody: constant: SELECT 1 - to: uri: aws2-athena://label parameters: operation: startQueryExecution waitTimeout: "60000" outputLocation: s3://bucket/path/ - to: uri: aws2-athena://label parameters: operation: getQueryResults outputType: SelectList - to: "mock:result" ``` ### Response Details The response body will contain a `GetQueryResultsResponse` object, and the `CamelAwsAthenaNextToken` header will be populated for manual pagination. ``` -------------------------------- ### MainApp Java Example Source: https://github.com/apache/camel/blob/main/docs/main/modules/getting-started/pages/index.adoc This Java code shows how to configure and run a Camel application using the Main component. ```java public class MainApp { public static void main(String... args) throws Exception { Main main = new Main(); main.configure().addRoutesBuilder(new MyRouteBuilder()); main.run(args); } } ``` -------------------------------- ### Build the project Source: https://github.com/apache/camel/blob/main/docs/main/modules/getting-started/pages/index.adoc Command to clean and package the Camel project. ```bash mvn clean package ``` -------------------------------- ### Start Query Execution and Get Results as SelectList Source: https://github.com/apache/camel/blob/main/components/camel-aws/camel-aws2-athena/src/main/docs/aws2-athena-component.adoc This example shows how to start a query execution and retrieve results as a `GetQueryResultsResponse`. The `outputType=SelectList` option returns a response containing at most 1,000 rows and a `CamelAwsAthenaNextToken` header for manual pagination. ```APIDOC ## Start Query Execution and Get Results as SelectList This example shows how to start a query execution and retrieve results as a `GetQueryResultsResponse`. The `outputType=SelectList` option returns a response containing at most 1,000 rows and a `CamelAwsAthenaNextToken` header for manual pagination. ### Method This operation is invoked by sending messages to the `aws2-athena://label` endpoint with the `operation=startQueryExecution` and `operation=getQueryResults` parameters. ### Parameters * `operation` (string) - Required - Specifies the AWS Athena operation to perform. Use `startQueryExecution` to begin a query and `getQueryResults` to fetch results. * `waitTimeout` (long) - Optional - The maximum time in milliseconds to wait for the query execution to complete. * `outputLocation` (string) - Required - The S3 bucket and path where Athena should store the query results. * `outputType` (string) - Optional - Specifies the format of the output. Use `SelectList` to get a `GetQueryResultsResponse` with a next token for manual pagination. ``` -------------------------------- ### Start Query Execution and Get Results as StreamList Source: https://github.com/apache/camel/blob/main/docs/components/modules/ROOT/pages/aws2-athena-component.adoc This example demonstrates how to start a query execution and then retrieve the results as a `StreamList`, which provides an iterable for paginating through all results. This is useful for processing large result sets directly in the application. ```APIDOC ## Start Query Execution and Get Results as StreamList This operation starts an Athena query execution and retrieves the results in a streaming format. ### Operations - `startQueryExecution`: Initiates the query execution. - `getQueryResults`: Retrieves the query results. ### Parameters for `getQueryResults` - `outputType` (string) - Required - Specifies the output format. Use `StreamList` to get an `GetQueryResultsIterable`. ### Example Usage (Java DSL) ```java from("direct:start") .setBody(constant("SELECT 1")) .to("aws2-athena://label?operation=startQueryExecution&waitTimeout=60000&outputLocation=s3://bucket/path/") .to("aws2-athena://label?operation=getQueryResults&outputType=StreamList") .to("mock:result"); ``` ### Example Usage (XML DSL) ```xml SELECT 1 ``` ### Example Usage (YAML DSL) ```yaml - route: from: uri: direct:start steps: - setBody: constant: SELECT 1 - to: uri: aws2-athena://label parameters: operation: startQueryExecution waitTimeout: "60000" outputLocation: s3://bucket/path/ - to: uri: aws2-athena://label parameters: operation: getQueryResults outputType: StreamList - to: "mock:result" ``` ### Java-only Processing Example ```java from("direct:start") .setBody(constant("SELECT * FROM (VALUES (1, 'a'), (2, 'b')) AS t (id, name)")) .to("aws2-athena://label?operation=startQueryExecution&waitTimeout=60000&outputLocation=s3://bucket/path/") .to("aws2-athena://label?operation=getQueryResults&outputType=StreamList") .split(body()).streaming() .process(exchange -> { GetQueryResultsResponse page = exchange.getMessage().getBody(GetQueryResultsResponse.class); for (Row row : page.resultSet().rows()) { String line = row.data().stream() .map(Datum::varCharValue) .collect(Collectors.joining(",")); System.out.println(line); } }) .to("mock:result"); ``` ``` -------------------------------- ### Start Bonita Case Example Source: https://github.com/apache/camel/blob/main/components/camel-bonita/src/main/docs/bonita-component.adoc Demonstrates how to start a new case in Bonita using different DSLs. The input variables for the case are expected in the message body as a Map. ```java from("direct:start").to("bonita:startCase?hostname=localhost&port=8080&processName=TestProcess&username=install&password=install"); ``` ```xml ``` ```yaml - route: from: uri: direct:start steps: - to: uri: bonita:startCase parameters: hostname: localhost port: 8080 processName: TestProcess username: install password: install ``` -------------------------------- ### Start Query Execution and Get Execution Details Source: https://github.com/apache/camel/blob/main/components/camel-aws/camel-aws2-athena/src/main/docs/aws2-athena-component.adoc This example first starts a query execution with a specified SQL statement and output location, then immediately retrieves the details of the just-started query. The `queryExecutionId` is automatically propagated via the `CamelAwsAthenaQueryExecutionId` header. ```java from("direct:start") .setBody(constant("SELECT 1")) .to("aws2-athena://label?operation=startQueryExecution&outputLocation=s3://bucket/path/") .to("aws2-athena://label?operation=getQueryExecution") .to("mock:result"); ``` ```xml SELECT 1 ``` ```yaml - route: from: uri: direct:start steps: - setBody: constant: SELECT 1 - to: uri: aws2-athena://label parameters: operation: startQueryExecution outputLocation: s3://bucket/path/ - to: uri: aws2-athena://label parameters: operation: getQueryExecution - to: uri: mock:result ``` -------------------------------- ### Generating the project Source: https://github.com/apache/camel/blob/main/docs/main/modules/getting-started/pages/index.adoc Run this command to create your first Camel Core project: ```bash mvn archetype:generate -B -DarchetypeGroupId=org.apache.camel.archetypes -DarchetypeArtifactId=camel-archetype-java -DarchetypeVersion=4.20.0 -Dpackage=org.apache.camel.learn -DgroupId=org.apache.camel.learn -DartifactId=first-camel-integration -Dversion=1.0.0-SNAPSHOT ``` -------------------------------- ### Start Query Execution and Get Results as S3Pointer Source: https://github.com/apache/camel/blob/main/docs/components/modules/ROOT/pages/aws2-athena-component.adoc This example demonstrates how to execute a query and retrieve the results as an S3 path pointer. This is useful when the query results are large and you prefer to access them directly from S3. ```APIDOC ## Start Query Execution and Get Results as S3Pointer This operation starts an Athena query execution and returns an S3 path where the results are stored. ### Operations - `startQueryExecution`: Initiates the query execution. - `getQueryResults`: Retrieves the query results. ### Parameters for `getQueryResults` - `outputType` (string) - Required - Specifies the output format. Use `S3Pointer` to get the S3 location of the results. ### Example Usage (Java DSL) ```java from("direct:start") .setBody(constant("SELECT 1")) .to("aws2-athena://label?operation=startQueryExecution&waitTimeout=60000&outputLocation=s3://bucket/path/") .to("aws2-athena://label?operation=getQueryResults&outputType=S3Pointer") .to("mock:result"); ``` ### Example Usage (XML DSL) ```xml SELECT 1 ``` ### Example Usage (YAML DSL) ```yaml - route: from: uri: direct:start steps: - setBody: constant: SELECT 1 - to: uri: aws2-athena://label parameters: operation: startQueryExecution waitTimeout: "60000" outputLocation: s3://bucket/path/ - to: uri: aws2-athena://label parameters: operation: getQueryResults outputType: S3Pointer - to: "mock:result" ``` ``` -------------------------------- ### Start Query Execution and Get Results (S3Pointer) - Java Source: https://github.com/apache/camel/blob/main/components/camel-aws/camel-aws2-athena/src/main/docs/aws2-athena-component.adoc Demonstrates starting a query execution and retrieving an S3 pointer to the results. Use S3Pointer to get a direct link to the output file. ```java from("direct:start") .setBody(constant("SELECT 1")) .to("aws2-athena://label?operation=startQueryExecution&waitTimeout=60000&outputLocation=s3://bucket/path/") .to("aws2-athena://label?operation=getQueryResults&outputType=S3Pointer") .to("mock:result"); ``` -------------------------------- ### Camunda Start Process JSON Request Example Source: https://github.com/apache/camel/blob/main/components/camel-camunda/src/main/docs/camunda-component.adoc Example of a JSON request body for starting a Camunda process, including process ID and variables. ```json { "process_id" : "Process_0e3ldfm", "variables" : { "v1": "a", "v2": 10 } } ``` -------------------------------- ### Configure a Route to Start Up Last (Java) Source: https://github.com/apache/camel/blob/main/docs/user-manual/modules/ROOT/pages/configuring-route-startup-ordering-and-autostartup.adoc Example of using a high `startupOrder` value (12345) to ensure a specific route starts up last, after routes with default ordering. ```java // use auto assigned startup ordering from("direct:start").to("seda:foo"); // should start first from("seda:foo").startupOrder(1).to("mock:result"); // should start last after the default routes from("direct:bar").startupOrder(12345).to("seda:bar"); // use auto assigned startup ordering from("seda:bar").to("mock:other"); ``` -------------------------------- ### Start EC2 Instances (Java) Source: https://github.com/apache/camel/blob/main/components/camel-aws/camel-aws2-ec2/src/main/docs/aws2-ec2-component.adoc This Java-only example shows how to start a list of EC2 instances. It requires setting the CamelAwsEC2InstancesIds header with a collection of instance IDs. ```java from("direct:start") .process(exchange -> { exchange.getIn().setHeader("CamelAwsEC2InstancesIds", List.of("myinstance")); }) .to("aws2-ec2://TestDomain?accessKey=xxxx&secretKey=xxxx&operation=startInstances"); ``` -------------------------------- ### Configure a Route to Start Up Last (XML) Source: https://github.com/apache/camel/blob/main/docs/user-manual/modules/ROOT/pages/configuring-route-startup-ordering-and-autostartup.adoc Example of using a high `startupOrder` attribute (12345) in XML to ensure a specific route starts up last, after routes with default ordering. ```xml ``` -------------------------------- ### Run the project Source: https://github.com/apache/camel/blob/main/docs/main/modules/getting-started/pages/index.adoc Command to run the Camel project using the camel:run goal. ```bash mvn camel:run ``` -------------------------------- ### Start Query Execution and Get Results (SelectList) - Java Source: https://github.com/apache/camel/blob/main/components/camel-aws/camel-aws2-athena/src/main/docs/aws2-athena-component.adoc Demonstrates starting a query execution and retrieving results as a selectable list. Use SelectList for retrieving up to 1,000 rows at a time with manual pagination support. ```java from("direct:start") .setBody(constant("SELECT 1")) .to("aws2-athena://label?operation=startQueryExecution&waitTimeout=60000&outputLocation=s3://bucket/path/") .to("aws2-athena://label?operation=getQueryResults&outputType=SelectList") .to("mock:result"); ``` -------------------------------- ### Download Camel Examples from GitHub Source: https://github.com/apache/camel/blob/main/docs/user-manual/modules/ROOT/pages/camel-jbang-tips.adoc Initialize a local project by downloading examples from GitHub. Use --directory to specify a download folder. Single files and Gists are also supported. ```bash camel init https://github.com/apache/kamelets-examples/tree/main/jbang/dependency-injection ``` ```bash camel run * ``` ```bash camel init https://github.com/apache/kamelets-examples/tree/main/jbang/dependency-injection --directory=myproject ``` ```bash camel init https://github.com/apache/kamelets-examples/blob/main/jbang/hello-yaml/hello.camel.yaml ``` ```bash camel init https://gist.github.com/davsclaus/477ddff5cdeb1ae03619aa544ce47e92 ``` -------------------------------- ### Start Query Execution and Get Results as StreamList Source: https://github.com/apache/camel/blob/main/components/camel-aws/camel-aws2-athena/src/main/docs/aws2-athena-component.adoc This example demonstrates how to start a query execution and retrieve results as a paginated stream. The `outputType=StreamList` option returns a `GetQueryResultsIterable` that can be used to page through all results. ```APIDOC ## Start Query Execution and Get Results as StreamList This example demonstrates how to start a query execution and retrieve results as a paginated stream. The `outputType=StreamList` option returns a `GetQueryResultsIterable` that can be used to page through all results. ### Method This operation is invoked by sending messages to the `aws2-athena://label` endpoint with the `operation=startQueryExecution` and `operation=getQueryResults` parameters. ### Parameters * `operation` (string) - Required - Specifies the AWS Athena operation to perform. Use `startQueryExecution` to begin a query and `getQueryResults` to fetch results. * `waitTimeout` (long) - Optional - The maximum time in milliseconds to wait for the query execution to complete. * `outputLocation` (string) - Required - The S3 bucket and path where Athena should store the query results. * `outputType` (string) - Optional - Specifies the format of the output. Use `StreamList` to get a paginated iterable of results. ``` -------------------------------- ### Start HTTP Server and Open Test Page Source: https://github.com/apache/camel/blob/main/components/camel-diagram/src/test/resources/integration-test.html Command to navigate to the component directory, start a local HTTP server, and open the integration test HTML file in the browser. ```bash cd components/camel-diagram/src/ python3 -m http.server 8080 && open http://localhost:8080/test/resources/integration-test.html ``` -------------------------------- ### Consumer and Producer Example - Setup Rule and Consume Events Source: https://github.com/apache/camel/blob/main/components/camel-aws/camel-aws2-eventbridge/src/main/docs/aws2-eventbridge-component.adoc Demonstrates setting up an EventBridge rule using the producer and then consuming events from that rule using the consumer. This shows a combined usage pattern. ```java // First create the rule from("direct:setup") .to("aws2-eventbridge://default?operation=putRule&eventPatternFile=file:eventpattern.json"); // Consume events matching the rule from("aws2-eventbridge://default?ruleName=my-rule&delay=2000") .log("Event: ${body}") .to("mock:events"); ``` ```xml ``` -------------------------------- ### Start Query Execution and Get Results as S3Pointer Source: https://github.com/apache/camel/blob/main/components/camel-aws/camel-aws2-athena/src/main/docs/aws2-athena-component.adoc This example demonstrates how to start a query execution and retrieve an S3 path pointing to the query results. The `outputType=S3Pointer` option returns the S3 location where Athena saved the results. ```APIDOC ## Start Query Execution and Get Results as S3Pointer This example demonstrates how to start a query execution and retrieve an S3 path pointing to the query results. The `outputType=S3Pointer` option returns the S3 location where Athena saved the results. ### Method This operation is invoked by sending messages to the `aws2-athena://label` endpoint with the `operation=startQueryExecution` and `operation=getQueryResults` parameters. ### Parameters * `operation` (string) - Required - Specifies the AWS Athena operation to perform. Use `startQueryExecution` to begin a query and `getQueryResults` to fetch results. * `waitTimeout` (long) - Optional - The maximum time in milliseconds to wait for the query execution to complete. * `outputLocation` (string) - Required - The S3 bucket and path where Athena should store the query results. * `outputType` (string) - Optional - Specifies the format of the output. Use `S3Pointer` to get the S3 path to the results. ``` -------------------------------- ### Execute Manual Salesforce Setup Script Source: https://github.com/apache/camel/blob/main/components/camel-salesforce/it/resources/README.md Instructions for running the Salesforce setup script manually from the resource directory instead of relying on automated Maven execution. ```bash cd it/resources ./setup-salesforce.sh ``` -------------------------------- ### Example: Loading a resource from Gist Source: https://github.com/apache/camel/blob/main/docs/components/modules/others/pages/resourceresolver-github.adoc This example shows how to load an XML file from a specific GitHub Gist. ```text gist:davsclaus:477ddff5cdeb1ae03619aa544ce47e92:cd1be96034748e42e43879a4d27ed297752b6115:mybeer.xml ``` -------------------------------- ### MyRouteBuilder Example Source: https://github.com/apache/camel/blob/main/docs/main/modules/getting-started/pages/index.adoc This Java code defines a Camel route that processes messages based on their content, routing them to different file destinations. ```java public class MyRouteBuilder extends RouteBuilder { public void configure() { from("file:src/data?noop=true") .choice() .when(xpath("/person/city = 'London'")) .log("UK message") .to("file:target/messages/uk") .otherwise() .log("Other message") .to("file:target/messages/others"); } } ``` -------------------------------- ### Start Minikube and Run Camel App Source: https://github.com/apache/camel/blob/main/docs/user-manual/modules/ROOT/pages/camel-jbang-kubernetes.adoc Use these commands to start Minikube with the registry addon, set up the Docker environment, and run a Camel application defined in demo.camel.yaml. ```bash minikube start --addons registry --driver=docker eval $(minikube -p minikube docker-env) camel kubernetes run demo.camel.yaml ``` -------------------------------- ### Install and Run docling-serve Source: https://github.com/apache/camel/blob/main/components/camel-ai/camel-docling/src/main/docs/docling-component.adoc Install the docling-serve Python package and run it on the specified host and port. Alternatively, use Docker to run the service. ```bash pip install docling-serve docling-serve --host 0.0.0.0 --port 5001 ``` ```bash docker run -p 5001:5001 ghcr.io/docling-project/docling-serve:latest ``` -------------------------------- ### Content Based Router Example Source: https://github.com/apache/camel/blob/main/docs/main/modules/getting-started/pages/index.adoc This Java DSL snippet demonstrates the Content Based Router EIP, routing messages based on an XPath condition. ```java // ... .choice() .when(xpath("/person/city = 'London'")) .log("UK message") .to("file:target/messages/uk") .otherwise() .log("Other message") .to("file:target/messages/others"); // ... ``` -------------------------------- ### Scripted Headless Recording with record.sh Source: https://github.com/apache/camel/blob/main/dsl/camel-jbang/camel-jbang-plugin-tui/docs/video/readme.md Execute a basic hello world demo using the record.sh script, specifying the example to run. ```bash ./record.sh camel-tui-hello --example=timer-log ``` -------------------------------- ### Run a Built-in Example Source: https://github.com/apache/camel/blob/main/docs/user-manual/modules/ROOT/pages/camel-jbang-getting-started.adoc Executes a ready-to-run example from the Camel CLI's catalog. ```bash camel run --example=timer-log ``` -------------------------------- ### Usage Source: https://github.com/apache/camel/blob/main/docs/user-manual/modules/ROOT/pages/jbang-commands/camel-jbang-plugin-get.adoc Get installed plugins ```bash camel plugin get [options] ``` -------------------------------- ### Camunda Start Process JSON Response Example Source: https://github.com/apache/camel/blob/main/components/camel-camunda/src/main/docs/camunda-component.adoc Example of a JSON response body after starting a Camunda process, indicating success and providing instance details. ```json { "success": true, "process_id": "Process_0e3ldfm", "process_instance_key": 2251799813688297, "process_version": 4, "process_key": 2251799813685906 } ``` -------------------------------- ### Run an Example in Development Mode Source: https://github.com/apache/camel/blob/main/docs/user-manual/modules/ROOT/pages/camel-jbang-getting-started.adoc Executes a built-in Camel example with live reload enabled. ```bash camel run --example=rest-api --dev ``` -------------------------------- ### Configuring Startup Conditions via Properties Source: https://github.com/apache/camel/blob/main/docs/user-manual/modules/ROOT/pages/startup-condition.adoc Shows how to enable and configure startup conditions using application.properties. This includes checking for environment variables or specifying custom condition class names. ```properties camel.startupcondition.enabled = true camel.startupcondition.environmentVariableExists = FOO_BAR camel.startupcondition.enabled = true camel.startupcondition.customClassNames = com.foo.MyStartupCondition ``` -------------------------------- ### startProcess Source: https://github.com/apache/camel/blob/main/components/camel-camunda/src/main/docs/camunda-component.adoc Creates and starts an instance of the specified process. ```APIDOC ## startProcess ### Description Creates and starts an instance of the specified process. ### Method POST ### Endpoint camunda://startProcess ### Request Body - **process_id** (string) - Required - The ID of the process to start. - **variables** (object) - Optional - A map of variables to pass to the process instance. ### Request Example ```json { "process_id" : "Process_0e3ldfm", "variables" : { "v1": "a", "v2": 10 } } ``` ### Response #### Success Response (200) - **success** (boolean) - Indicates if the process started successfully. - **process_id** (string) - The ID of the started process. - **process_instance_key** (long) - The unique key of the process instance. - **process_version** (integer) - The version of the process. - **process_key** (long) - The key of the process definition. #### Response Example ```json { "success": true, "process_id": "Process_0e3ldfm", "process_instance_key": 2251799813688297, "process_version": 4, "process_key": 2251799813685906 } ``` ``` -------------------------------- ### Wait for Workflow Instance Start Source: https://github.com/apache/camel/blob/main/components/camel-dapr/src/main/docs/dapr-component.adoc This example demonstrates how to wait for a Dapr workflow instance to start. ```APIDOC ## Wait for Workflow Instance Start ### Description Waits for a Dapr workflow instance to start. This operation is Java-only. ### Method POST ### Endpoint dapr:workflow?workflowOperation=waitForInstanceStart ### Parameters #### Query Parameters - **workflowOperation** (string) - Required - The operation to perform, must be 'waitForInstanceStart'. #### Headers - **CamelDaprWorkflowInstanceId** (string) - Required - The ID of the workflow instance to wait for. - **CamelDaprTimeout** (java.time.Duration) - Required - The maximum time to wait for the instance to start. ### Request Example ```java from("direct:start") .process(exchange -> { exchange.getIn().setHeader("CamelDaprWorkflowInstanceId", "myWorkflowInstanceId"); exchange.getIn().setHeader("CamelDaprTimeout", Duration.ofSeconds(30)); }) .to("dapr:workflow?workflowOperation=waitForInstanceStart") .to("mock:result"); ``` ### Response #### Success Response (200) Details of the success response are not explicitly provided in the documentation. ``` -------------------------------- ### Example Route in Java Source: https://github.com/apache/camel/blob/main/components/camel-pg-replication-slot/src/main/docs/pg-replication-slot-component.adoc Example of configuring a route using the pg-replication-slot component in Java. Ensure to provide valid credentials and slot options. ```java from("pg-replication-slot://localhost:5432/finance/sync_slot:test_decoding?user={{username}}&password={{password}}&slotOptions.skip-empty-xacts=true&slotOptions.include-xids=false") .to("mock:result"); ``` -------------------------------- ### Example: Get Document by ID Source: https://github.com/apache/camel/blob/main/components/camel-google/camel-google-firestore/src/main/docs/google-firestore-component.adoc This example shows how to retrieve a document with the ID 'user123' from the 'users' collection. ```APIDOC ## Example: Get Document by ID [tabs] ==== Java:: + [source,java] ---- from("direct:start") .setHeader("CamelGoogleFirestoreDocumentId", constant("user123")) .to("google-firestore://users?operation=getDocumentById&serviceAccountKey=/path/to/key.json&projectId=my-project") .to("log:result"); ---- XML:: + [source,xml] ---- user123 ---- YAML:: + [source,yaml] ---- - route: from: uri: direct:start steps: - setHeader: name: CamelGoogleFirestoreDocumentId constant: user123 - to: uri: google-firestore://users parameters: operation: getDocumentById serviceAccountKey: /path/to/key.json projectId: my-project - to: uri: log:result ---- ==== ``` -------------------------------- ### Hazelcast Replicated Map Producer - Get Operation (Java) Source: https://github.com/apache/camel/blob/main/components/camel-hazelcast/src/main/docs/hazelcast-replicatedmap-component.adoc Example of using the replicatedmap producer to perform a 'get' operation. Set the 'CamelHazelcastOperationType' header to 'get'. ```java from("direct:get") .setHeader("CamelHazelcastOperationType", constant("get")) .to("hazelcast-replicatedmap:bar") .to("seda:out"); ``` -------------------------------- ### Example: Loading a file from GitHub Source: https://github.com/apache/camel/blob/main/docs/components/modules/others/pages/resourceresolver-github.adoc This example demonstrates how to load a specific file from the 'apache/camel-kamelets' repository on GitHub. ```text github:apache:camel-kamelets:main:kamelets/aws-ddb-streams-source.kamelet.yaml ``` ```text github:apache:camel-kamelets:kamelets/aws-ddb-streams-source.kamelet.yaml ``` -------------------------------- ### Producer Example: Add, Commit, Push, Tag Source: https://github.com/apache/camel/blob/main/components/camel-git/src/main/docs/git-component.adoc Example route demonstrating adding a file, committing it, pushing to a remote, creating a tag, and pushing the tag. ```java from("direct:start") .setHeader("CamelGitFilename", constant("test.java")) .to("git:///tmp/testRepo?operation=add") .setHeader("CamelGitCommitMessage", constant("first commit")) .to("git:///tmp/testRepo?operation=commit") .to("git:///tmp/testRepo?operation=push&remotePath=https://foo.com/test/test.git&username=xxx&password=xxx") .to("git:///tmp/testRepo?operation=createTag&tagName=myTag") .to("git:///tmp/testRepo?operation=pushTag&tagName=myTag&remoteName=origin"); ``` -------------------------------- ### Hazelcast Replicated Map Producer - Get Operation (YAML) Source: https://github.com/apache/camel/blob/main/components/camel-hazelcast/src/main/docs/hazelcast-replicatedmap-component.adoc Example of using the replicatedmap producer in YAML to perform a 'get' operation. Set the 'hazelcast.operation.type' header to 'get'. ```yaml - route: from: uri: direct:get steps: - setHeader: name: hazelcast.operation.type constant: get - to: uri: hazelcast-replicatedmap:foo - to: uri: seda:out ``` -------------------------------- ### Hazelcast Replicated Map Producer - Get Operation (XML) Source: https://github.com/apache/camel/blob/main/components/camel-hazelcast/src/main/docs/hazelcast-replicatedmap-component.adoc Example of using the replicatedmap producer in XML to perform a 'get' operation. Set the 'hazelcast.operation.type' header to 'get'. ```xml get ``` -------------------------------- ### List Kubernetes Services (Java) Source: https://github.com/apache/camel/blob/main/components/camel-kubernetes/src/main/docs/kubernetes-services-component.adoc This example demonstrates how to list all services in a Kubernetes cluster using the `listServices` operation. ```java from("direct:list") .to("kubernetes-services:///?kubernetesClient=#kubernetesClient&operation=listServices") .to("mock:result"); ``` -------------------------------- ### Run Camel Routes Example Source: https://github.com/apache/camel/blob/main/dsl/camel-jbang/camel-jbang-core/src/main/resources/examples/routes/README.md Executes the Camel routes example. Camel will start a route that periodically provides a greeting message. ```sh camel run * ``` -------------------------------- ### Role Operations Source: https://github.com/apache/camel/blob/main/docs/components/modules/others/pages/keycloak-producer.adoc Examples for creating, getting, and assigning roles. ```APIDOC ## createRole ### Description Creates a new role in the specified Keycloak realm. ### Method POST ### Endpoint keycloak:admin?operation=createRole ### Parameters #### Headers - **CamelKeycloakRealmName** (String) - Required - The name of the realm. - **CamelKeycloakRoleName** (String) - Required - The name of the role to create. - **CamelKeycloakRoleDescription** (String) - Optional - A description for the role. ### Request Example ```java Map roleHeaders = new HashMap<>(); roleHeaders.put("CamelKeycloakRealmName", "my-realm"); roleHeaders.put("CamelKeycloakRoleName", "manager"); roleHeaders.put("CamelKeycloakRoleDescription", "Manager role with elevated privileges"); template.sendBodyAndHeaders("keycloak:admin?operation=createRole", null, roleHeaders); ``` ## getRole ### Description Retrieves information about a specific role in the specified Keycloak realm. ### Method GET ### Endpoint keycloak:admin?operation=getRole ### Parameters #### Headers - **CamelKeycloakRealmName** (String) - Required - The name of the realm. - **CamelKeycloakRoleName** (String) - Required - The name of the role to retrieve. ### Request Example ```java Map getRoleHeaders = new HashMap<>(); getRoleHeaders.put("CamelKeycloakRealmName", "my-realm"); getRoleHeaders.put("CamelKeycloakRoleName", "manager"); template.sendBodyAndHeaders("keycloak:admin?operation=getRole", null, getRoleHeaders); ``` ## assignRoleToUser ### Description Assigns a role to a user in the specified Keycloak realm. ### Method POST ### Endpoint keycloak:admin?operation=assignRoleToUser ### Parameters #### Headers - **CamelKeycloakRealmName** (String) - Required - The name of the realm. - **CamelKeycloakUsername** (String) - Required - The username of the user to assign the role to. - **CamelKeycloakRoleName** (String) - Required - The name of the role to assign. ``` -------------------------------- ### Create a Product with Price (Java) Source: https://github.com/apache/camel/blob/main/components/camel-stripe/src/main/docs/stripe-component.adoc This Java example demonstrates creating a Stripe product and then associating a price with it. It uses `Map.of()` for initial product details and a `process` lambda for constructing the price parameters, including recurring details. ```java from("direct:createProduct") .setBody(constant(Map.of( "name", "Premium Subscription", "description", "Monthly premium access" ))) .to("stripe:products?apiKey={{stripe.apiKey}}") .setProperty("productId", simple("${body.id}")) .process(exchange -> { Map priceParams = new HashMap<>(); priceParams.put("product", exchange.getProperty("productId", String.class)); priceParams.put("currency", "usd"); priceParams.put("unit_amount", 2999L); priceParams.put("recurring", Map.of("interval", "month")); exchange.getMessage().setBody(priceParams); }) .to("stripe:prices?apiKey={{stripe.apiKey}}") .log("Created product ${exchangeProperty.productId} with price ${body.id}"); ``` -------------------------------- ### Start Query Execution and Get Results Source: https://github.com/apache/camel/blob/main/docs/components/modules/ROOT/pages/aws2-athena-component.adoc This route starts a query, waits for it to complete, and then retrieves the results. The output location for results is specified. ```xml SELECT 1 ``` -------------------------------- ### startInstances Source: https://github.com/apache/camel/blob/main/docs/components/modules/ROOT/pages/aws2-ec2-component.adoc This operation will start a list of EC2 instances. ```APIDOC ## startInstances ### Description Starts a list of EC2 instances. ### Method POST ### Endpoint aws2-ec2://[label]?operation=startInstances ### Parameters #### Query Parameters - **accessKey** (string) - Required - AWS access key - **secretKey** (string) - Required - AWS secret key - **operation** (string) - Required - The operation to perform, must be 'startInstances' #### Headers - **CamelAwsEC2InstancesIds** (List) - Required - A collection of instance IDs to start. ### Request Example ```json { "example": "from(\"direct:start\")\n .process(exchange -> {\n exchange.getIn().setHeader(\"CamelAwsEC2InstancesIds\", List.of(\"myinstance\"));\n })\n .to(\"aws2-ec2://TestDomain?accessKey=xxxx&secretKey=xxxx&operation=startInstances\");" } ``` ``` -------------------------------- ### OpenAPI JSON Example Response Source: https://github.com/apache/camel/blob/main/docs/user-manual/modules/ROOT/pages/rest-dsl-openapi.adoc An example of a success GET response (200) for application/json content type within an OpenAPI specification. Camel uses the first example if multiple exist for the same content type. ```json "responses": { "200": { "description": "successful operation", "content": { "application/xml": { "schema": { "$ref": "#/components/schemas/Pet" } }, "application/json": { "schema": { "$ref": "#/components/schemas/Pet" }, "examples": { "success": { "summary": "A cat", "value": "{\"pet\": \"Jack the cat\"}" } } } } }, "400": { "description": "Invalid ID supplied" }, "404": { "description": "Pet not found" } } ``` -------------------------------- ### Run with verbose output Source: https://github.com/apache/camel/blob/main/docs/user-manual/modules/ROOT/pages/jbang-commands/camel-jbang-run.adoc Enables verbose output of startup activity, including dependency resolution and downloading. Use the --verbose flag for detailed startup information. ```bash camel run --verbose app.java ``` -------------------------------- ### Programmatic KeyStore and SchemeRegistry Setup Source: https://github.com/apache/camel/blob/main/components/camel-http/src/main/docs/http-component.adoc Demonstrates setting up a KeyStore, TrustStore, and SchemeRegistry for HTTPS connections programmatically in Java. ```java KeyStore keystore = ...; KeyStore truststore = ...; SchemeRegistry registry = new SchemeRegistry(); registry.register(new Scheme("https", 443, new SSLSocketFactory(keystore, "mypassword", truststore))); ``` -------------------------------- ### Run Route Topology Example with Kafka Stub Source: https://github.com/apache/camel/blob/main/dsl/camel-jbang/camel-jbang-core/src/main/resources/examples/route-topology/README.md Run the route topology example with Kafka stubbed out. This replaces the Kafka broker with an in-memory queue, allowing end-to-end message flow testing without a live Kafka instance. ```bash camel run route-topology.camel.yaml --stub=kafka ``` -------------------------------- ### Advise a route and start CamelContext Source: https://github.com/apache/camel/blob/main/docs/user-manual/modules/ROOT/pages/advice-with.adoc Advise a specific route by its ID and then start the CamelContext. This example demonstrates auto-mocking all endpoints within the specified route. ```java @Test public void testMockEndpoints() throws Exception { AdviceWith.adviceWith(context, "myRoute", a -> a.mockEndpoints(); ); context.start(); } ``` -------------------------------- ### Start Query Execution and Get Results (YAML) Source: https://github.com/apache/camel/blob/main/docs/components/modules/ROOT/pages/aws2-athena-component.adoc This route starts a query, waits for it to complete, and then retrieves the results. The output location for results is specified. ```yaml - route: from: uri: direct:start steps: - setBody: constant: SELECT 1 - to: uri: aws2-athena://label parameters: operation: startQueryExecution waitTimeout: "60000" outputLocation: s3://bucket/path/ - to: uri: aws2-athena://label parameters: operation: getQueryResults outputType: S3Pointer - to: uri: mock:result ``` -------------------------------- ### Time Window Examples for File Naming Source: https://github.com/apache/camel/blob/main/docs/components/modules/others/pages/aws2-s3-streaming.adoc Provides concrete examples of file names generated for a 5-minute time window, demonstrating how messages are grouped into distinct time intervals. ```text 08:00:00 - 08:04:59 → file_20240101_0800_0800-0805.txt ``` ```text 08:05:00 - 08:09:59 → file_20240101_0805_0805-0810.txt ``` ```text 08:10:00 - 08:14:59 → file_20240101_0810_0810-0815.txt ``` -------------------------------- ### Start Conjur with Docker Source: https://github.com/apache/camel/blob/main/docs/components/modules/ROOT/pages/cyberark-vault-component.adoc Bash command to start CyberArk Conjur using Docker, typically via the Conjur Quickstart. This is a prerequisite for testing the component. ```bash docker run -d --name conjur -p 8080:8080 -p 8443:8443 cyberark/conjur-appliance:latest ``` -------------------------------- ### Defining a Simple Route in Java Source: https://github.com/apache/camel/blob/main/docs/components/modules/ROOT/pages/spring-summary.adoc A basic example of defining a Camel route using Java DSL, starting from 'seda:start' and ending at 'mock:result'. ```java from("seda:start") .to("mock:result"); ``` -------------------------------- ### Start Query Execution and Get Results (StreamList) - Java Source: https://github.com/apache/camel/blob/main/components/camel-aws/camel-aws2-athena/src/main/docs/aws2-athena-component.adoc Demonstrates starting a query execution and retrieving results as a stream. Use StreamList for paginating through all results. ```java from("direct:start") .setBody(constant("SELECT 1")) .to("aws2-athena://label?operation=startQueryExecution&waitTimeout=60000&outputLocation=s3://bucket/path/") .to("aws2-athena://label?operation=getQueryResults&outputType=StreamList") .to("mock:result"); ``` -------------------------------- ### Mix Routes with and without Startup Order (XML) Source: https://github.com/apache/camel/blob/main/docs/user-manual/modules/ROOT/pages/configuring-route-startup-ordering-and-autostartup.adoc Demonstrates mixing routes with explicit `startupOrder` and routes without it in XML. Routes without `startupOrder` will be assigned a default order (e.g., 1000) and start after explicitly ordered routes. ```xml ``` -------------------------------- ### Producer and Consumer Example with Parameters (Java) Source: https://github.com/apache/camel/blob/main/components/camel-ai/camel-langchain4j-tools/src/main/docs/langchain4j-tools-component.adoc Demonstrates defining parameters for a tool endpoint, which can be used by both producers and consumers. Parameters can include type, description, required status, and enum values. ```java from("direct:test") .to("langchain4j-tools:test1?tags=users"); ``` -------------------------------- ### Example iCalendar Message Format Source: https://github.com/apache/camel/blob/main/components/camel-ical/src/main/docs/ical-dataformat.adoc This is an example of a typical iCalendar message format. It includes details like event start and end times, summary, and attendees. ```java BEGIN:VCALENDAR VERSION:2.0 PRODID:-//Events Calendar//iCal4j 1.0//EN CALSCALE:GREGORIAN BEGIN:VEVENT DTSTAMP:20130324T180000Z DTSTART:20130401T170000 DTEND:20130401T210000 SUMMARY:Progress Meeting TZID:America/New_York UID:00000000 ATTENDEE;ROLE=REQ-PARTICIPANT;CN=Developer 1:mailto:dev1@mycompany.com ATTENDEE;ROLE=OPT-PARTICIPANT;CN=Developer 2:mailto:dev2@mycompany.com END:VEVENT END:VCALENDAR ```