├── .asf.yaml ├── .gitattributes ├── .github ├── dependabot.yml ├── generate-test-groups.groovy ├── pull_request_template.md └── workflows │ └── ci-build.yaml ├── .gitignore ├── .mvn └── wrapper │ ├── maven-wrapper.jar │ └── maven-wrapper.properties ├── LICENSE.txt ├── NOTICE.txt ├── README.adoc ├── artemis-elasticsearch ├── README.adoc ├── eclipse-formatter-config.xml ├── pom.xml └── src │ ├── main │ ├── java │ │ └── org │ │ │ └── acme │ │ │ └── Routes.java │ └── resources │ │ └── application.properties │ └── test │ └── java │ └── org │ └── acme │ ├── ElasticSearchIT.java │ ├── ElasticSearchTest.java │ └── resource │ ├── CustomPahoTestResource.java │ └── ElasticSearchTestResource.java ├── aws-lambda ├── README.adoc ├── eclipse-formatter-config.xml ├── payload.json ├── pom.xml ├── results.png └── src │ ├── main │ ├── docker │ │ ├── Dockerfile.jvm │ │ ├── Dockerfile.legacy-jar │ │ ├── Dockerfile.native │ │ └── Dockerfile.native-micro │ └── java │ │ └── org │ │ └── acme │ │ └── aws │ │ └── lambda │ │ ├── AWSLambdaHandler.java │ │ ├── CamelRoute.java │ │ ├── GreetService.java │ │ └── Person.java │ └── test │ └── java │ └── org │ └── acme │ └── aws │ └── lambda │ ├── AWSLambdaHandlerTest.java │ └── AWSLambdaHandlerTestIT.java ├── cluster-leader-election ├── README.adoc ├── eclipse-formatter-config.xml ├── figure1.png ├── pom.xml └── src │ ├── main │ ├── java │ │ └── org │ │ │ └── acme │ │ │ └── master │ │ │ └── CamelRoute.java │ ├── kubernetes │ │ └── service-account.yaml │ └── resources │ │ └── application.properties │ └── test │ └── java │ └── org │ └── acme │ └── master │ ├── MasterIT.java │ └── MasterTest.java ├── cxf-soap ├── README.adoc ├── eclipse-formatter-config.xml ├── pom.xml └── src │ ├── main │ ├── java │ │ └── org │ │ │ └── acme │ │ │ └── cxf │ │ │ └── soap │ │ │ ├── adapter │ │ │ └── DataTypeAdapter.java │ │ │ ├── pojo │ │ │ ├── MyPojoRouteBuilder.java │ │ │ └── service │ │ │ │ ├── Address.java │ │ │ │ ├── Contact.java │ │ │ │ ├── ContactService.java │ │ │ │ ├── ContactType.java │ │ │ │ ├── Contacts.java │ │ │ │ ├── NoSuchContactException.java │ │ │ │ └── impl │ │ │ │ └── ContactServiceInMemoryImpl.java │ │ │ └── wsdl │ │ │ ├── MyWsdlRouteBuilder.java │ │ │ └── repository │ │ │ └── CustomerRepository.java │ └── resources │ │ ├── application.properties │ │ ├── binding.xml │ │ ├── requests │ │ ├── contact │ │ │ ├── add.xml │ │ │ └── getAll.xml │ │ └── customer │ │ │ └── getByName.xml │ │ └── wsdl │ │ └── CustomerService.wsdl │ └── test │ └── java │ └── org │ └── acme │ └── cxf │ └── soap │ ├── BaseTest.java │ ├── PojoClientTest.java │ ├── PojoClientTestIT.java │ ├── WsdlClientTest.java │ └── WsdlClientTestIT.java ├── data-extract-langchain4j ├── README.adoc ├── eclipse-formatter-config.xml ├── pom.xml ├── schema.png ├── schemas-source.odp ├── send-conversations-to-camel-route.sh └── src │ ├── main │ ├── java │ │ └── org │ │ │ └── acme │ │ │ └── extraction │ │ │ ├── CustomPojoExtractionService.java │ │ │ ├── CustomPojoStore.java │ │ │ └── Routes.java │ └── resources │ │ └── application.properties │ └── test │ ├── java │ └── org │ │ └── acme │ │ └── extraction │ │ ├── OllamaTestResource.java │ │ ├── RouteIT.java │ │ └── RouteTest.java │ └── resources │ ├── mappings │ ├── api_chat-06cec226-1f5d-4cb4-8e01-5df16f809497.json │ ├── api_chat-c3c87953-6b35-4fd9-bdb2-b7cc4d7bc13d.json │ └── api_chat-e2dbcf66-5f06-4c87-a137-bb3a7781fefa.json │ └── transcripts │ ├── 01_sarah-london-10-07-1986-satisfied.json │ ├── 02_john-doe-01-11-2001-unsatisfied.json │ └── 03_kate-boss-13-08-1999-satisfied.json ├── docs ├── antora.yml └── modules │ └── ROOT │ ├── attachments │ └── examples.json │ └── nav.adoc ├── eclipse-formatter-config.xml ├── fhir ├── README.adoc ├── eclipse-formatter-config.xml ├── pom.xml └── src │ ├── main │ ├── docker │ │ ├── Dockerfile.jvm │ │ ├── Dockerfile.legacy-jar │ │ ├── Dockerfile.native │ │ └── Dockerfile.native-micro │ ├── java │ │ └── org │ │ │ └── acme │ │ │ └── fhir │ │ │ └── Routes.java │ ├── kubernetes │ │ ├── kubernetes.yml │ │ └── openshift.yml │ └── resources │ │ └── application.properties │ └── test │ ├── java │ └── org │ │ └── acme │ │ └── fhir │ │ ├── FHIRIT.java │ │ ├── FHIRTest.java │ │ └── FHIRTestResource.java │ └── resources │ └── data │ └── hl7v2.patient ├── file-bindy-ftp ├── README.adoc ├── eclipse-formatter-config.xml ├── pom.xml └── src │ ├── main │ ├── java │ │ └── org │ │ │ └── acme │ │ │ └── bindy │ │ │ └── ftp │ │ │ ├── Book.java │ │ │ ├── BookGenerator.java │ │ │ └── Routes.java │ ├── kubernetes │ │ ├── kubernetes.yml │ │ └── openshift.yml │ └── resources │ │ └── application.properties │ └── test │ └── java │ └── org │ └── acme │ └── bindy │ └── ftp │ ├── FileToFtpIT.java │ ├── FileToFtpTest.java │ └── FtpTestResource.java ├── file-split-log-xml ├── README.adoc ├── eclipse-formatter-config.xml ├── pom.xml └── src │ ├── main │ ├── java │ │ └── org │ │ │ └── acme │ │ │ └── file │ │ │ └── xml │ │ │ └── DummyClass.java │ └── resources │ │ ├── application.properties │ │ ├── file │ │ └── customerlist.csv │ │ └── routes │ │ └── camel-routes.xml │ └── test │ └── java │ └── org │ └── acme │ └── file │ └── xml │ ├── FileSplitLogXmlIT.java │ └── FileSplitLogXmlTest.java ├── header.txt ├── health ├── README.adoc ├── eclipse-formatter-config.xml ├── pom.xml └── src │ ├── main │ ├── java │ │ └── org │ │ │ └── acme │ │ │ └── health │ │ │ ├── MyRouteBuilder.java │ │ │ └── RunTooLongHealthCheck.java │ └── resources │ │ └── application.properties │ └── test │ └── java │ └── org │ └── acme │ └── health │ ├── HealthIT.java │ └── HealthTest.java ├── http-log ├── README.adoc ├── eclipse-formatter-config.xml ├── pom.xml ├── rss-memory.sh ├── run-many.sh └── src │ ├── main │ ├── java │ │ └── org │ │ │ └── acme │ │ │ └── http │ │ │ ├── CamelRoute.java │ │ │ └── ExampleResource.java │ └── resources │ │ └── application.properties │ └── test │ └── java │ └── org │ └── acme │ └── http │ ├── HttpLogIT.java │ └── HttpLogTest.java ├── jdbc-datasource ├── README.adoc ├── eclipse-formatter-config.xml ├── pom.xml └── src │ ├── main │ ├── java │ │ └── org │ │ │ └── acme │ │ │ └── jdbc │ │ │ ├── JdbcRoutes.java │ │ │ ├── JdbcService.java │ │ │ └── JdbcTestHarness.java │ └── resources │ │ └── application.properties │ └── test │ ├── java │ └── org │ │ └── acme │ │ └── jdbc │ │ ├── JdbcIT.java │ │ ├── JdbcTest.java │ │ ├── PostgresSourceDatabaseTestResource.java │ │ └── PostgresTargetDatabaseTestResource.java │ └── resources │ ├── init-source-db.sql │ └── init-target-db.sql ├── jms-jpa ├── README.adoc ├── eclipse-formatter-config.xml ├── pom.xml └── src │ ├── main │ ├── java │ │ └── org │ │ │ └── acme │ │ │ ├── AuditLog.java │ │ │ ├── CamelRoutes.java │ │ │ ├── DummyXAResource.java │ │ │ ├── DummyXAResourceRecovery.java │ │ │ └── XAJmsComponent.java │ └── resources │ │ └── application.properties │ └── test │ └── java │ └── org │ └── acme │ ├── JtaIT.java │ └── JtaTest.java ├── jpa-idempotent-repository ├── README.adoc ├── eclipse-formatter-config.xml ├── pom.xml ├── schema.png ├── schemas-source.odp └── src │ ├── main │ ├── java │ │ └── org │ │ │ └── acme │ │ │ └── jpa │ │ │ └── idempotent │ │ │ └── repository │ │ │ ├── CostlyApiService.java │ │ │ ├── ExampleHarnessRoutes.java │ │ │ └── JpaIdempotentRoute.java │ ├── kubernetes │ │ ├── kubernetes.yml │ │ └── openshift.yml │ └── resources │ │ ├── application.properties │ │ └── db │ │ └── migration │ │ └── V1.0.0__add_camel_message_processed.sql │ └── test │ └── java │ └── org │ └── acme │ └── jpa │ └── idempotent │ └── repository │ ├── JpaIdempotentRepositoryIT.java │ ├── JpaIdempotentRepositoryTest.java │ └── JpaIdempotentRepositoryTestResource.java ├── jta-jpa ├── README.adoc ├── eclipse-formatter-config.xml ├── pom.xml └── src │ ├── main │ ├── java │ │ └── org │ │ │ └── acme │ │ │ ├── AuditLog.java │ │ │ ├── CamelRoutes.java │ │ │ ├── DummyXAResource.java │ │ │ └── DummyXAResourceRecovery.java │ └── resources │ │ └── application.properties │ └── test │ └── java │ └── org │ └── acme │ ├── JtaIT.java │ └── JtaTest.java ├── kafka ├── README.adoc ├── eclipse-formatter-config.xml ├── kubefiles │ └── secret-example.yml ├── pom.xml └── src │ ├── main │ ├── docker │ │ ├── Dockerfile.jvm │ │ ├── Dockerfile.legacy-jar │ │ ├── Dockerfile.native │ │ └── Dockerfile.native-micro │ ├── java │ │ └── org │ │ │ └── acme │ │ │ └── kafka │ │ │ ├── KafkaResource.java │ │ │ └── Routes.java │ └── resources │ │ └── application.properties │ └── test │ └── java │ └── org │ └── acme │ └── kafka │ ├── KafkaIT.java │ └── KafkaTest.java ├── kamelet-chucknorris ├── README.adoc ├── eclipse-formatter-config.xml ├── pom.xml └── src │ ├── main │ ├── java │ │ └── org │ │ │ └── acme │ │ │ └── kamelet │ │ │ └── MyRoute.java │ └── resources │ │ ├── application.properties │ │ └── kamelets │ │ └── chuck-norris-source.kamelet.yaml │ └── test │ ├── java │ └── org │ │ └── acme │ │ └── kamelet │ │ ├── ChuckNorrisIT.java │ │ ├── ChuckNorrisTest.java │ │ └── ChuckNorrisTestResource.java │ └── resources │ └── mappings │ └── chuck-norris-joke.json ├── license-properties-headerdefinition.xml ├── message-bridge ├── .gitignore ├── README.adoc ├── eclipse-formatter-config.xml ├── pom.xml └── src │ ├── main │ ├── java │ │ └── org │ │ │ └── acme │ │ │ └── message │ │ │ └── bridge │ │ │ ├── DummyXAResource.java │ │ │ ├── DummyXAResourceRecovery.java │ │ │ ├── MessageBridgeRoute.java │ │ │ └── Producers.java │ └── resources │ │ ├── application.properties │ │ └── resources.yml │ └── test │ └── java │ └── org │ └── acme │ └── message │ └── bridge │ ├── MessageBridgeITCase.java │ └── resource │ └── IBMMQTestResource.java ├── mvnw ├── mvnw-for-each.sh ├── mvnw.cmd ├── observability ├── README.adoc ├── docker-compose.yml ├── eclipse-formatter-config.xml ├── pom.xml └── src │ ├── main │ ├── java │ │ └── org │ │ │ └── acme │ │ │ └── observability │ │ │ ├── Routes.java │ │ │ ├── TimerRoute.java │ │ │ ├── health │ │ │ ├── camel │ │ │ │ ├── CustomLivenessCheck.java │ │ │ │ └── CustomReadinessCheck.java │ │ │ └── microprofile │ │ │ │ └── CamelUptimeHealthCheck.java │ │ │ └── micrometer │ │ │ └── TimerCounter.java │ └── resources │ │ └── application.properties │ └── test │ └── java │ └── org │ └── acme │ └── observability │ ├── ObservabilityIT.java │ └── ObservabilityTest.java ├── openapi-contract-first ├── README.adoc ├── eclipse-formatter-config.xml ├── pom.xml └── src │ ├── main │ ├── java │ │ └── org │ │ │ └── acme │ │ │ └── examples │ │ │ └── openapi │ │ │ └── contract │ │ │ └── first │ │ │ └── PetStoreRoute.java │ ├── openapi │ │ └── petstore.json │ └── resources │ │ └── application.properties │ └── test │ └── java │ └── org │ └── acme │ └── examples │ └── openapi │ └── contract │ └── first │ ├── ExamplesOpenapiContractFirstIT.java │ └── ExamplesOpenapiContractFirstTest.java ├── platform-http-security-keycloak ├── README.adoc ├── config │ └── realm-export.json ├── docs │ └── modules │ │ └── ROOT │ │ └── attachments │ │ └── examples.json ├── eclipse-formatter-config.xml ├── pom.xml └── src │ ├── main │ ├── java │ │ └── org │ │ │ └── acme │ │ │ └── http │ │ │ └── security │ │ │ └── Routes.java │ └── resources │ │ └── application.properties │ └── test │ └── java │ └── org │ └── acme │ └── timer │ └── log │ ├── BearerTokenAuthenticationTest.java │ └── BearerTokenAuthenticationTestIT.java ├── rest-json ├── README.adoc ├── eclipse-formatter-config.xml ├── pom.xml └── src │ ├── main │ ├── java │ │ └── org │ │ │ └── acme │ │ │ └── rest │ │ │ └── json │ │ │ ├── Fruit.java │ │ │ ├── Legume.java │ │ │ └── Routes.java │ └── resources │ │ ├── META-INF │ │ └── resources │ │ │ ├── fruits.html │ │ │ └── legumes.html │ │ └── application.properties │ └── test │ └── java │ └── org │ └── acme │ └── rest │ └── json │ ├── RestJsonIT.java │ └── RestJsonTest.java ├── saga ├── README.adoc ├── doc-resources │ ├── compesate-diagram.png │ ├── logic-diagram.png │ └── tech-diagram.png ├── eclipse-formatter-config.xml ├── pom.xml ├── run.sh ├── saga-app │ ├── pom.xml │ └── src │ │ └── main │ │ ├── java │ │ └── org │ │ │ └── apache │ │ │ └── camel │ │ │ └── example │ │ │ └── saga │ │ │ └── SagaRoute.java │ │ └── resources │ │ └── application.yml ├── saga-flight-service │ ├── pom.xml │ └── src │ │ └── main │ │ ├── java │ │ └── org │ │ │ └── apache │ │ │ └── camel │ │ │ └── example │ │ │ └── saga │ │ │ └── FlightRoute.java │ │ └── resources │ │ └── application.yml ├── saga-payment-service │ ├── pom.xml │ └── src │ │ └── main │ │ ├── java │ │ └── org │ │ │ └── apache │ │ │ └── camel │ │ │ └── example │ │ │ └── saga │ │ │ └── PaymentRoute.java │ │ └── resources │ │ └── application.yml ├── saga-train-service │ ├── pom.xml │ └── src │ │ └── main │ │ ├── java │ │ └── org │ │ │ └── apache │ │ │ └── camel │ │ │ └── example │ │ │ └── saga │ │ │ └── TrainRoute.java │ │ └── resources │ │ └── application.yml └── stop.sh ├── timer-log-main ├── README.adoc ├── eclipse-formatter-config.xml ├── pom.xml └── src │ ├── main │ ├── java │ │ └── org │ │ │ └── acme │ │ │ └── main │ │ │ ├── Main.java │ │ │ └── TimerRoute.java │ └── resources │ │ └── application.properties │ └── test │ └── java │ └── org │ └── acme │ └── main │ ├── TimerLogMainIT.java │ └── TimerLogMainTest.java ├── timer-log ├── README.adoc ├── eclipse-formatter-config.xml ├── pom.xml └── src │ ├── main │ ├── java │ │ └── org │ │ │ └── acme │ │ │ └── timer │ │ │ └── log │ │ │ ├── ExchangeFormatterProducer.java │ │ │ ├── GreetingBean.java │ │ │ └── TimerRoute.java │ └── resources │ │ ├── application.properties │ │ └── camel │ │ └── my-routes.yaml │ └── test │ └── java │ └── org │ └── acme │ └── timer │ └── log │ ├── TimerLogIT.java │ └── TimerLogTest.java └── vertx-websocket-chat ├── README.adoc ├── eclipse-formatter-config.xml ├── pom.xml └── src ├── main ├── java │ └── org │ │ └── acme │ │ └── websocket │ │ ├── ChatMessage.java │ │ ├── SessionManager.java │ │ └── WebSocketRoutes.java └── resources │ ├── META-INF │ └── resources │ │ └── index.html │ └── application.properties └── test └── java └── org └── acme └── websocket ├── WebSocketRoutesIT.java └── WebSocketRoutesTest.java /.asf.yaml: -------------------------------------------------------------------------------- 1 | # 2 | # Licensed to the Apache Software Foundation (ASF) under one or more 3 | # contributor license agreements. See the NOTICE file distributed with 4 | # this work for additional information regarding copyright ownership. 5 | # The ASF licenses this file to You under the Apache License, Version 2.0 6 | # (the "License"); you may not use this file except in compliance with 7 | # the License. You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | # 17 | 18 | github: 19 | description: "Apache Camel Quarkus Examples" 20 | homepage: https://camel.apache.org 21 | labels: 22 | - camel 23 | - integration 24 | - java 25 | - quarkus 26 | enabled_merge_buttons: 27 | merge: false 28 | rebase: true 29 | squash: true 30 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | * text=auto eol=lf 2 | *.cmd text eol=crlf 3 | 4 | -------------------------------------------------------------------------------- /.github/dependabot.yml: -------------------------------------------------------------------------------- 1 | # 2 | # Licensed to the Apache Software Foundation (ASF) under one or more 3 | # contributor license agreements. See the NOTICE file distributed with 4 | # this work for additional information regarding copyright ownership. 5 | # The ASF licenses this file to You under the Apache License, Version 2.0 6 | # (the "License"); you may not use this file except in compliance with 7 | # the License. You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | # 17 | 18 | version: 2 19 | 20 | updates: 21 | - package-ecosystem: "github-actions" 22 | target-branch: "camel-quarkus-main" 23 | directory: "/" 24 | schedule: 25 | interval: "daily" 26 | - package-ecosystem: "maven" 27 | target-branch: "camel-quarkus-main" 28 | groups: 29 | maven: 30 | applies-to: version-updates 31 | patterns: 32 | - "*" 33 | directories: 34 | - "**/*" 35 | schedule: 36 | interval: "daily" 37 | allow: 38 | # Quarkiverse extensions 39 | - dependency-name: "io.quarkiverse.*:*" 40 | - dependency-name: "org.zeroturnaround:zt-exec" 41 | # Test dependencies 42 | - dependency-name: "org.assertj:assertj-core" 43 | - dependency-name: "org.wiremock:wiremock-standalone" 44 | # Maven plugins 45 | - dependency-name: "*:*-maven-plugin" 46 | - dependency-name: "org.apache.maven.plugins:*" 47 | ignore: 48 | # Quarkus is upgraded manually 49 | - dependency-name: "io.quarkus:*" 50 | - dependency-name: "io.quarkus.platform:*" 51 | # Camel & Camel Quarkus is upgraded manually 52 | - dependency-name: "org.apache.camel:*" 53 | - dependency-name: "org.apache.camel.maven:*" 54 | - dependency-name: "org.apache.camel.quarkus:*" 55 | -------------------------------------------------------------------------------- /.github/generate-test-groups.groovy: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | import groovy.json.JsonOutput; 18 | 19 | final int MAX_GROUPS = 10 20 | final List> GROUPS = new ArrayList<>() 21 | int groupId = 0 22 | 23 | // Distribute example projects across a bounded set of test groups and output as JSON 24 | new File(".").eachFileRecurse { file -> 25 | if (file.getName() == "pom.xml" && file.getParentFile().getParentFile().getName() == ".") { 26 | if (file.getParentFile().getName() == "saga") { 27 | // saga is put into a dedicated group as it's a multi-module build 28 | return 29 | } 30 | 31 | if (GROUPS[groupId] == null) { 32 | GROUPS[groupId] = [:] 33 | GROUPS[groupId].name = "group-${String.format("%02d", groupId + 1)}" 34 | GROUPS[groupId].tests = "" 35 | } 36 | 37 | String separator = GROUPS[groupId].tests == "" ? "" : "," 38 | 39 | GROUPS[groupId].tests = "${GROUPS[groupId].tests}${separator}${file.parentFile.name}" 40 | 41 | groupId += 1; 42 | if (groupId == MAX_GROUPS) { 43 | groupId = 0 44 | } 45 | } 46 | } 47 | 48 | // Add saga to a dedicated group 49 | GROUPS[MAX_GROUPS] = [:] 50 | GROUPS[MAX_GROUPS].name = "group-${String.format("%02d", MAX_GROUPS + 1)}" 51 | GROUPS[MAX_GROUPS].tests = "saga" 52 | 53 | print JsonOutput.toJson(["include": GROUPS]) 54 | -------------------------------------------------------------------------------- /.github/pull_request_template.md: -------------------------------------------------------------------------------- 1 | Note that the `main` branch points at the latest stable Camel Quarkus release. 2 | Pull requests should be generally send against the `camel-quarkus-main` branch pointing at the current Camel Quarkus SNAPSHOT. -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Maven 2 | target/ 3 | pom.xml.tag 4 | pom.xml.releaseBackup 5 | pom.xml.versionsBackup 6 | pom.xml.next 7 | release.properties 8 | dependency-reduced-pom.xml 9 | 10 | # Eclipse 11 | .project 12 | .classpath 13 | .settings/ 14 | bin/ 15 | 16 | # IDEA 17 | .idea 18 | *.ipr 19 | *.iml 20 | *.iws 21 | 22 | # IDEA lsp plugin 23 | lsp/ 24 | 25 | # NetBeans 26 | nb-configuration.xml 27 | 28 | # KDE 29 | .directory 30 | 31 | # OSX 32 | .DS_Store 33 | 34 | # VS CODE 35 | .vscode 36 | *.code-workspace 37 | .factorypath 38 | 39 | # Vi/Vim 40 | *.swp 41 | 42 | # Quarkus 43 | quarkus.log* 44 | 45 | # Saga 46 | payment.* 47 | flight.* 48 | train.* 49 | app.* 50 | 51 | -------------------------------------------------------------------------------- /.mvn/wrapper/maven-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apache/camel-quarkus-examples/3ab40d177967cd808f87611e686054db2f918c48/.mvn/wrapper/maven-wrapper.jar -------------------------------------------------------------------------------- /.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one 2 | # or more contributor license agreements. See the NOTICE file 3 | # distributed with this work for additional information 4 | # regarding copyright ownership. The ASF licenses this file 5 | # to you under the Apache License, Version 2.0 (the 6 | # "License"); you may not use this file except in compliance 7 | # with the License. You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, 12 | # software distributed under the License is distributed on an 13 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | # KIND, either express or implied. See the License for the 15 | # specific language governing permissions and limitations 16 | # under the License. 17 | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.9/apache-maven-3.9.9-bin.zip 18 | wrapperUrl=https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.2.0/maven-wrapper-3.2.0.jar 19 | -------------------------------------------------------------------------------- /NOTICE.txt: -------------------------------------------------------------------------------- 1 | ========================================================================= 2 | == NOTICE file corresponding to the section 4 d of == 3 | == the Apache License, Version 2.0, == 4 | == in this case for the Apache Camel distribution. == 5 | ========================================================================= 6 | 7 | This product includes software developed by 8 | The Apache Software Foundation (http://www.apache.org/). 9 | 10 | Please read the different LICENSE files present in the licenses directory of 11 | this distribution. 12 | -------------------------------------------------------------------------------- /README.adoc: -------------------------------------------------------------------------------- 1 | = Apache Camel Quarkus Examples 2 | 3 | Useful links: 4 | 5 | * https://camel.apache.org/camel-quarkus/latest/user-guide/examples.html[List of Camel Quarkus examples] with short descriptions 6 | * https://camel.apache.org/camel-quarkus/latest/user-guide/index.html[Camel Quarkus User guide] 7 | * https://camel.apache.org/camel-quarkus/latest/contributor-guide/index.html[Camel Quarkus Contributor guide] 8 | * https://github.com/apache/camel-quarkus[Camel Quarkus source repository] 9 | 10 | == Feedback 11 | 12 | Please report bugs and propose improvements via https://github.com/apache/camel-quarkus/issues[GitHub issues of Camel Quarkus] project. 13 | 14 | == Contributing 15 | 16 | === Branches 17 | 18 | The `main` branch should always point at the latest https://repo1.maven.org/maven2/io/quarkus/platform/quarkus-bom[Quarkus Platform] release. 19 | The `camel-quarkus-main` branch points at the Camel Quarkus snapshot version currently available in Camel Quarkus `main` branch. 20 | 21 | === Upgrading Camel Quarkus or Quarkus Platform BOM 22 | 23 | See the dedicated section in https://camel.apache.org/camel-quarkus/latest/contributor-guide/release-guide.html#_upgrade_and_tag_examples[Camel Quarkus Release guide]. -------------------------------------------------------------------------------- /artemis-elasticsearch/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | ## --------------------------------------------------------------------------- 2 | ## Licensed to the Apache Software Foundation (ASF) under one or more 3 | ## contributor license agreements. See the NOTICE file distributed with 4 | ## this work for additional information regarding copyright ownership. 5 | ## The ASF licenses this file to You under the Apache License, Version 2.0 6 | ## (the "License"); you may not use this file except in compliance with 7 | ## the License. You may obtain a copy of the License at 8 | ## 9 | ## http://www.apache.org/licenses/LICENSE-2.0 10 | ## 11 | ## Unless required by applicable law or agreed to in writing, software 12 | ## distributed under the License is distributed on an "AS IS" BASIS, 13 | ## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | ## See the License for the specific language governing permissions and 15 | ## limitations under the License. 16 | ## --------------------------------------------------------------------------- 17 | 18 | 19 | # The URL for the MQTT broker 20 | camel.component.paho.brokerUrl=tcp://localhost:1883 21 | 22 | # The URL for the ElasticSearch host 23 | camel.component.elasticsearch-rest-client.host-addresses-list=http://localhost:9200 24 | -------------------------------------------------------------------------------- /artemis-elasticsearch/src/test/java/org/acme/ElasticSearchIT.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package org.acme; 18 | 19 | import io.quarkus.test.junit.QuarkusIntegrationTest; 20 | 21 | @QuarkusIntegrationTest 22 | class ElasticSearchIT extends ElasticSearchTest { 23 | } 24 | -------------------------------------------------------------------------------- /aws-lambda/payload.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Ravishankar" 3 | } -------------------------------------------------------------------------------- /aws-lambda/results.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apache/camel-quarkus-examples/3ab40d177967cd808f87611e686054db2f918c48/aws-lambda/results.png -------------------------------------------------------------------------------- /aws-lambda/src/main/docker/Dockerfile.native: -------------------------------------------------------------------------------- 1 | ## --------------------------------------------------------------------------- 2 | ## Licensed to the Apache Software Foundation (ASF) under one or more 3 | ## contributor license agreements. See the NOTICE file distributed with 4 | ## this work for additional information regarding copyright ownership. 5 | ## The ASF licenses this file to You under the Apache License, Version 2.0 6 | ## (the "License"); you may not use this file except in compliance with 7 | ## the License. You may obtain a copy of the License at 8 | ## 9 | ## http://www.apache.org/licenses/LICENSE-2.0 10 | ## 11 | ## Unless required by applicable law or agreed to in writing, software 12 | ## distributed under the License is distributed on an "AS IS" BASIS, 13 | ## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | ## See the License for the specific language governing permissions and 15 | ## limitations under the License. 16 | ## --------------------------------------------------------------------------- 17 | #### 18 | # This Dockerfile is used in order to build a container that runs the Quarkus application in native (no JVM) mode. 19 | # 20 | # Before building the container image run: 21 | # 22 | # mvn package -Dnative 23 | # 24 | # Then, build the image with: 25 | # 26 | # docker build -f src/main/docker/Dockerfile.native -t quarkus/aws-lambda . 27 | # 28 | # Then run the container using: 29 | # 30 | # docker run -i --rm -p 8080:8080 quarkus/aws-lambda 31 | # 32 | # The ` registry.access.redhat.com/ubi9/ubi-minimal:9.5` base image is based on UBI 9. 33 | # To use UBI 8, switch to `quay.io/ubi8/ubi-minimal:8.10`. 34 | ### 35 | FROM registry.access.redhat.com/ubi9/ubi-minimal:9.5 36 | WORKDIR /work/ 37 | RUN chown 1001 /work \ 38 | && chmod "g+rwX" /work \ 39 | && chown 1001:root /work 40 | COPY --chown=1001:root --chmod=0755 target/*-runner /work/application 41 | 42 | EXPOSE 8080 43 | USER 1001 44 | 45 | ENTRYPOINT ["./application", "-Dquarkus.http.host=0.0.0.0"] 46 | -------------------------------------------------------------------------------- /aws-lambda/src/main/docker/Dockerfile.native-micro: -------------------------------------------------------------------------------- 1 | ## --------------------------------------------------------------------------- 2 | ## Licensed to the Apache Software Foundation (ASF) under one or more 3 | ## contributor license agreements. See the NOTICE file distributed with 4 | ## this work for additional information regarding copyright ownership. 5 | ## The ASF licenses this file to You under the Apache License, Version 2.0 6 | ## (the "License"); you may not use this file except in compliance with 7 | ## the License. You may obtain a copy of the License at 8 | ## 9 | ## http://www.apache.org/licenses/LICENSE-2.0 10 | ## 11 | ## Unless required by applicable law or agreed to in writing, software 12 | ## distributed under the License is distributed on an "AS IS" BASIS, 13 | ## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | ## See the License for the specific language governing permissions and 15 | ## limitations under the License. 16 | ## --------------------------------------------------------------------------- 17 | #### 18 | # This Dockerfile is used in order to build a container that runs the Quarkus application in native (no JVM) mode. 19 | # It uses a micro base image, tuned for Quarkus native executables. 20 | # It reduces the size of the resulting container image. 21 | # Check https://quarkus.io/guides/quarkus-runtime-base-image for further information about this image. 22 | # 23 | # Before building the container image run: 24 | # 25 | # mvn package -Dnative 26 | # 27 | # Then, build the image with: 28 | # 29 | # docker build -f src/main/docker/Dockerfile.native-micro -t quarkus/aws-lambda . 30 | # 31 | # Then run the container using: 32 | # 33 | # docker run -i --rm -p 8080:8080 quarkus/aws-lambda 34 | # 35 | # The `quay.io/quarkus/ubi9-quarkus-micro-image:2.0` base image is based on UBI 9. 36 | # To use UBI 8, switch to `quay.io/quarkus/quarkus-micro-image:2.0`. 37 | ### 38 | FROM quay.io/quarkus/ubi9-quarkus-micro-image:2.0 39 | WORKDIR /work/ 40 | RUN chown 1001 /work \ 41 | && chmod "g+rwX" /work \ 42 | && chown 1001:root /work 43 | COPY --chown=1001:root --chmod=0755 target/*-runner /work/application 44 | 45 | EXPOSE 8080 46 | USER 1001 47 | 48 | ENTRYPOINT ["./application", "-Dquarkus.http.host=0.0.0.0"] 49 | -------------------------------------------------------------------------------- /aws-lambda/src/main/java/org/acme/aws/lambda/AWSLambdaHandler.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package org.acme.aws.lambda; 18 | 19 | import com.amazonaws.services.lambda.runtime.Context; 20 | import com.amazonaws.services.lambda.runtime.LambdaLogger; 21 | import com.amazonaws.services.lambda.runtime.RequestHandler; 22 | import jakarta.inject.Inject; 23 | import jakarta.inject.Named; 24 | import org.apache.camel.ProducerTemplate; 25 | 26 | @Named("awsLambdaHandler") 27 | public class AWSLambdaHandler implements RequestHandler { 28 | 29 | @Inject 30 | ProducerTemplate template; 31 | 32 | @Override 33 | public String handleRequest(Person input, Context context) { 34 | LambdaLogger logger = context.getLogger(); 35 | logger.log("Calling Camel Route :)"); 36 | return template.requestBody("direct:input", input, String.class); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /aws-lambda/src/main/java/org/acme/aws/lambda/CamelRoute.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package org.acme.aws.lambda; 18 | 19 | import jakarta.enterprise.context.ApplicationScoped; 20 | import jakarta.inject.Inject; 21 | import org.apache.camel.builder.RouteBuilder; 22 | 23 | @ApplicationScoped 24 | public class CamelRoute extends RouteBuilder { 25 | 26 | @Inject 27 | GreetService greetService; 28 | 29 | @Override 30 | public void configure() { 31 | from("direct:input").routeId("Test") 32 | .log("Inside Camel Route Received Payload ==> ${body}") 33 | .setBody().body(Person.class, p -> greetService.greet(p.getName())) 34 | .end(); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /aws-lambda/src/main/java/org/acme/aws/lambda/GreetService.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package org.acme.aws.lambda; 18 | 19 | import jakarta.enterprise.context.ApplicationScoped; 20 | 21 | @ApplicationScoped 22 | public class GreetService { 23 | 24 | public String greet(String name) { 25 | return String.format("Hello %s ! How are you? from GreetService", name); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /aws-lambda/src/main/java/org/acme/aws/lambda/Person.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package org.acme.aws.lambda; 18 | 19 | public class Person { 20 | 21 | private String name; 22 | 23 | public String getName() { 24 | return name; 25 | } 26 | 27 | public Person setName(String name) { 28 | this.name = name; 29 | return this; 30 | } 31 | 32 | @Override 33 | public String toString() { 34 | return String.format("Person[name= %s]", this.name); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /aws-lambda/src/test/java/org/acme/aws/lambda/AWSLambdaHandlerTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package org.acme.aws.lambda; 18 | 19 | import io.quarkus.test.junit.QuarkusTest; 20 | import io.restassured.RestAssured; 21 | import io.restassured.http.ContentType; 22 | import org.junit.jupiter.api.Test; 23 | 24 | import static org.hamcrest.Matchers.is; 25 | 26 | @QuarkusTest 27 | public class AWSLambdaHandlerTest { 28 | 29 | @Test 30 | public void invokeLambdaForStuShouldReturnStuGreeting() { 31 | Person in = new Person(); 32 | in.setName("Stu"); 33 | 34 | RestAssured.given() 35 | .contentType(ContentType.JSON) 36 | .accept(ContentType.JSON) 37 | .body(in) 38 | .when() 39 | .post() 40 | .then() 41 | .statusCode(200) 42 | .body(is("\"Hello Stu ! How are you? from GreetService\"")); 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /aws-lambda/src/test/java/org/acme/aws/lambda/AWSLambdaHandlerTestIT.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package org.acme.aws.lambda; 18 | 19 | import io.quarkus.test.junit.QuarkusIntegrationTest; 20 | 21 | @QuarkusIntegrationTest 22 | public class AWSLambdaHandlerTestIT extends AWSLambdaHandlerTest { 23 | 24 | // Execute the same tests but in native mode. 25 | } 26 | -------------------------------------------------------------------------------- /cluster-leader-election/figure1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apache/camel-quarkus-examples/3ab40d177967cd808f87611e686054db2f918c48/cluster-leader-election/figure1.png -------------------------------------------------------------------------------- /cluster-leader-election/src/main/java/org/acme/master/CamelRoute.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package org.acme.master; 18 | 19 | import jakarta.enterprise.context.ApplicationScoped; 20 | import org.apache.camel.builder.endpoint.EndpointRouteBuilder; 21 | 22 | @ApplicationScoped 23 | public class CamelRoute extends EndpointRouteBuilder { 24 | 25 | @Override 26 | public void configure() throws Exception { 27 | // This route is configured to be local (see application.properties) 28 | // so it will be started regardless of the leadership status of 29 | // this node. 30 | from("timer:heartbeat?period=10000") 31 | .routeId("heartbeat") 32 | .log("HeartBeating route (timer) {{node.id}} ..."); 33 | 34 | // This route is configured to be clustered so it will be started 35 | // by the controller only when this node is leader 36 | from("master:{{node.namespace}}:timer:clustered?period=5000") 37 | .routeId("clustered") 38 | .log("Clustered route (timer) {{node.id}} ..."); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /cluster-leader-election/src/main/kubernetes/service-account.yaml: -------------------------------------------------------------------------------- 1 | # 2 | # Licensed to the Apache Software Foundation (ASF) under one or more 3 | # contributor license agreements. See the NOTICE file distributed with 4 | # this work for additional information regarding copyright ownership. 5 | # The ASF licenses this file to You under the Apache License, Version 2.0 6 | # (the "License"); you may not use this file except in compliance with 7 | # the License. You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | # 17 | 18 | apiVersion: v1 19 | kind: ServiceAccount 20 | metadata: 21 | name: camel-leader-election 22 | --- 23 | apiVersion: rbac.authorization.k8s.io/v1 24 | kind: Role 25 | metadata: 26 | name: camel-leader-election 27 | rules: 28 | - apiGroups: 29 | - "" 30 | - "coordination.k8s.io" 31 | resources: 32 | - configmaps 33 | - secrets 34 | - pods 35 | - leases 36 | verbs: 37 | - create 38 | - delete 39 | - deletecollection 40 | - get 41 | - list 42 | - patch 43 | - update 44 | - watch 45 | --- 46 | apiVersion: rbac.authorization.k8s.io/v1 47 | kind: RoleBinding 48 | metadata: 49 | name: camel-leader-election 50 | subjects: 51 | - kind: ServiceAccount 52 | name: camel-leader-election 53 | roleRef: 54 | kind: Role 55 | name: camel-leader-election 56 | apiGroup: rbac.authorization.k8s.io 57 | -------------------------------------------------------------------------------- /cluster-leader-election/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | ## --------------------------------------------------------------------------- 2 | ## Licensed to the Apache Software Foundation (ASF) under one or more 3 | ## contributor license agreements. See the NOTICE file distributed with 4 | ## this work for additional information regarding copyright ownership. 5 | ## The ASF licenses this file to You under the Apache License, Version 2.0 6 | ## (the "License"); you may not use this file except in compliance with 7 | ## the License. You may obtain a copy of the License at 8 | ## 9 | ## http://www.apache.org/licenses/LICENSE-2.0 10 | ## 11 | ## Unless required by applicable law or agreed to in writing, software 12 | ## distributed under the License is distributed on an "AS IS" BASIS, 13 | ## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | ## See the License for the specific language governing permissions and 15 | ## limitations under the License. 16 | ## --------------------------------------------------------------------------- 17 | # 18 | # Quarkus 19 | # 20 | quarkus.banner.enabled = false 21 | quarkus.log.file.enable = true 22 | 23 | # No need for k8s dev services in this project 24 | quarkus.kubernetes-client.devservices.enabled = false 25 | 26 | # 27 | # Quarkus - Camel 28 | # 29 | node.namespace = camel-master 30 | node.id = ${quarkus.uuid} 31 | 32 | # 33 | # Camel 34 | # 35 | camel.context.name = camel-quarkus-examples-cluster-leader-election 36 | 37 | # 38 | # Kubernetes 39 | # 40 | quarkus.kubernetes.replicas=2 41 | quarkus.kubernetes-client.generate-rbac=false 42 | quarkus.kubernetes.service-account=camel-leader-election 43 | 44 | # 45 | # OpenShift 46 | # 47 | quarkus.openshift.service-account=camel-leader-election 48 | 49 | quarkus.camel.cluster.file.enabled = true 50 | quarkus.camel.cluster.file.id = ${node.id} 51 | quarkus.camel.cluster.file.root = target/cluster 52 | 53 | -------------------------------------------------------------------------------- /cluster-leader-election/src/test/java/org/acme/master/MasterIT.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package org.acme.master; 18 | 19 | import io.quarkus.test.junit.QuarkusIntegrationTest; 20 | 21 | @QuarkusIntegrationTest 22 | class MasterIT extends MasterTest { 23 | } 24 | -------------------------------------------------------------------------------- /cluster-leader-election/src/test/java/org/acme/master/MasterTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package org.acme.master; 18 | 19 | import java.nio.charset.StandardCharsets; 20 | import java.nio.file.Files; 21 | import java.nio.file.Paths; 22 | import java.util.concurrent.TimeUnit; 23 | 24 | import io.quarkus.test.junit.QuarkusTest; 25 | import org.junit.jupiter.api.Test; 26 | 27 | import static org.awaitility.Awaitility.await; 28 | 29 | @QuarkusTest 30 | public class MasterTest { 31 | 32 | @Test 33 | public void testLog() { 34 | await().atMost(10L, TimeUnit.SECONDS).pollDelay(1, TimeUnit.SECONDS).until(() -> { 35 | String log = new String(Files.readAllBytes(Paths.get("target/quarkus.log")), StandardCharsets.UTF_8); 36 | return log.contains("Clustered route (timer)"); 37 | }); 38 | } 39 | 40 | } 41 | -------------------------------------------------------------------------------- /cxf-soap/src/main/java/org/acme/cxf/soap/pojo/MyPojoRouteBuilder.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package org.acme.cxf.soap.pojo; 18 | 19 | import jakarta.enterprise.context.ApplicationScoped; 20 | import jakarta.enterprise.inject.Produces; 21 | import jakarta.inject.Named; 22 | import org.acme.cxf.soap.pojo.service.ContactService; 23 | import org.apache.camel.builder.RouteBuilder; 24 | import org.apache.camel.component.cxf.jaxws.CxfEndpoint; 25 | 26 | /** 27 | * This class demonstrate how to expose a SOAP endpoint starting from java classes 28 | */ 29 | @ApplicationScoped 30 | public class MyPojoRouteBuilder extends RouteBuilder { 31 | 32 | @Produces 33 | @ApplicationScoped 34 | @Named 35 | CxfEndpoint contact() { 36 | CxfEndpoint contactEndpoint = new CxfEndpoint(); 37 | contactEndpoint.setServiceClass(ContactService.class); 38 | contactEndpoint.setAddress("/contact"); 39 | 40 | return contactEndpoint; 41 | } 42 | 43 | @Override 44 | public void configure() throws Exception { 45 | from("cxf:bean:contact") 46 | .recipientList(simple("bean:inMemoryContactService?method=${header.operationName}")); 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /cxf-soap/src/main/java/org/acme/cxf/soap/pojo/service/ContactService.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package org.acme.cxf.soap.pojo.service; 18 | 19 | import jakarta.jws.WebService; 20 | 21 | @WebService(name = "ContactService", serviceName = "ContactService", targetNamespace = ContactService.TARGET_NS) 22 | public interface ContactService { 23 | public static final String TARGET_NS = "http://camel.apache.org/test/ContactService"; 24 | 25 | void addContact(Contact contact); 26 | 27 | Contact getContact(String name) throws NoSuchContactException; 28 | 29 | Contacts getContacts(); 30 | 31 | void updateContact(String name, Contact contact) 32 | throws NoSuchContactException; 33 | 34 | void removeContact(String name) throws NoSuchContactException; 35 | } 36 | -------------------------------------------------------------------------------- /cxf-soap/src/main/java/org/acme/cxf/soap/pojo/service/ContactType.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package org.acme.cxf.soap.pojo.service; 18 | 19 | import jakarta.xml.bind.annotation.XmlEnum; 20 | import jakarta.xml.bind.annotation.XmlType; 21 | 22 | @XmlType(name = "ContactType") 23 | @XmlEnum 24 | public enum ContactType { 25 | PERSONAL, WORK, OTHER, 26 | } 27 | -------------------------------------------------------------------------------- /cxf-soap/src/main/java/org/acme/cxf/soap/pojo/service/Contacts.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package org.acme.cxf.soap.pojo.service; 18 | 19 | import java.util.Collection; 20 | 21 | import jakarta.xml.bind.annotation.XmlAccessType; 22 | import jakarta.xml.bind.annotation.XmlAccessorType; 23 | import jakarta.xml.bind.annotation.XmlType; 24 | 25 | @XmlAccessorType(XmlAccessType.FIELD) 26 | @XmlType(name = "Contacts", propOrder = { 27 | "contacts" 28 | }) 29 | public class Contacts { 30 | 31 | private Collection contacts; 32 | 33 | public Contacts() { 34 | } 35 | 36 | public Contacts(Collection contacts) { 37 | super(); 38 | this.contacts = contacts; 39 | } 40 | 41 | public Collection getContacts() { 42 | return contacts; 43 | } 44 | 45 | public void setContacts(Collection contacts) { 46 | this.contacts = contacts; 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /cxf-soap/src/main/java/org/acme/cxf/soap/pojo/service/NoSuchContactException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package org.acme.cxf.soap.pojo.service; 18 | 19 | import jakarta.xml.ws.WebFault; 20 | 21 | @WebFault(name = "NoSuchContact") 22 | public class NoSuchContactException extends Exception { 23 | 24 | private static final long serialVersionUID = 1L; 25 | 26 | private String faultInfo; 27 | 28 | public NoSuchContactException(String name) { 29 | super("Contact \"" + name + "\" does not exist."); 30 | this.faultInfo = "Contact \"" + name + "\" does not exist."; 31 | } 32 | 33 | public NoSuchContactException(String message, String faultInfo) { 34 | super(message); 35 | this.faultInfo = faultInfo; 36 | } 37 | 38 | public NoSuchContactException(String message, String faultInfo, Throwable cause) { 39 | super(message, cause); 40 | this.faultInfo = faultInfo; 41 | } 42 | 43 | public String getFaultInfo() { 44 | return this.faultInfo; 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /cxf-soap/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | ## --------------------------------------------------------------------------- 2 | ## Licensed to the Apache Software Foundation (ASF) under one or more 3 | ## contributor license agreements. See the NOTICE file distributed with 4 | ## this work for additional information regarding copyright ownership. 5 | ## The ASF licenses this file to You under the Apache License, Version 2.0 6 | ## (the "License"); you may not use this file except in compliance with 7 | ## the License. You may obtain a copy of the License at 8 | ## 9 | ## http://www.apache.org/licenses/LICENSE-2.0 10 | ## 11 | ## Unless required by applicable law or agreed to in writing, software 12 | ## distributed under the License is distributed on an "AS IS" BASIS, 13 | ## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | ## See the License for the specific language governing permissions and 15 | ## limitations under the License. 16 | ## --------------------------------------------------------------------------- 17 | # 18 | # Quarkus 19 | # 20 | quarkus.banner.enabled = false 21 | quarkus.log.file.enable = true 22 | quarkus.log.file.rotation.max-backup-index = 0 23 | 24 | # 25 | # CXF 26 | # 27 | quarkus.cxf.path=/cxf/services 28 | quarkus.cxf.codegen.wsdl2java.includes = wsdl/CustomerService.wsdl 29 | quarkus.cxf.codegen.wsdl2java.additional-params = -b,src/main/resources/binding.xml 30 | 31 | # 32 | # Camel 33 | # 34 | camel.context.name = camel-quarkus-examples-cxf-soap 35 | 36 | # 37 | # Kubernetes 38 | # 39 | # https://github.com/quarkusio/quarkus/issues/29209 40 | quarkus.kubernetes.image-pull-policy=IfNotPresent 41 | quarkus.kubernetes.ports."http".host-port=8080 -------------------------------------------------------------------------------- /cxf-soap/src/main/resources/binding.xml: -------------------------------------------------------------------------------- 1 | 2 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /cxf-soap/src/main/resources/requests/contact/add.xml: -------------------------------------------------------------------------------- 1 | 19 | 20 | 21 | 22 | 23 | 24 | Lukas 25 | 26 | New York 27 | Sky 1234 28 | 29 | PERSONAL 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /cxf-soap/src/main/resources/requests/contact/getAll.xml: -------------------------------------------------------------------------------- 1 | 19 | 20 | 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /cxf-soap/src/main/resources/requests/customer/getByName.xml: -------------------------------------------------------------------------------- 1 | 19 | 20 | 21 | 22 | 23 | test 24 | 25 | 26 | -------------------------------------------------------------------------------- /cxf-soap/src/test/java/org/acme/cxf/soap/BaseTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package org.acme.cxf.soap; 18 | 19 | import io.quarkus.runtime.LaunchMode; 20 | import org.eclipse.microprofile.config.Config; 21 | import org.eclipse.microprofile.config.ConfigProvider; 22 | 23 | public class BaseTest { 24 | protected String getServerUrl() { 25 | Config config = ConfigProvider.getConfig(); 26 | final int port = LaunchMode.current().equals(LaunchMode.TEST) ? config.getValue("quarkus.http.test-port", Integer.class) 27 | : config.getValue("quarkus.http.port", Integer.class); 28 | return String.format("http://localhost:%d", port); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /cxf-soap/src/test/java/org/acme/cxf/soap/PojoClientTestIT.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package org.acme.cxf.soap; 18 | 19 | import io.quarkus.test.junit.QuarkusIntegrationTest; 20 | 21 | @QuarkusIntegrationTest 22 | public class PojoClientTestIT extends PojoClientTest { 23 | } 24 | -------------------------------------------------------------------------------- /cxf-soap/src/test/java/org/acme/cxf/soap/WsdlClientTestIT.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package org.acme.cxf.soap; 18 | 19 | import io.quarkus.test.junit.QuarkusIntegrationTest; 20 | 21 | @QuarkusIntegrationTest 22 | public class WsdlClientTestIT extends WsdlClientTest { 23 | } 24 | -------------------------------------------------------------------------------- /data-extract-langchain4j/schema.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apache/camel-quarkus-examples/3ab40d177967cd808f87611e686054db2f918c48/data-extract-langchain4j/schema.png -------------------------------------------------------------------------------- /data-extract-langchain4j/schemas-source.odp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apache/camel-quarkus-examples/3ab40d177967cd808f87611e686054db2f918c48/data-extract-langchain4j/schemas-source.odp -------------------------------------------------------------------------------- /data-extract-langchain4j/send-conversations-to-camel-route.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # 3 | # Licensed to the Apache Software Foundation (ASF) under one or more 4 | # contributor license agreements. See the NOTICE file distributed with 5 | # this work for additional information regarding copyright ownership. 6 | # The ASF licenses this file to You under the Apache License, Version 2.0 7 | # (the "License"); you may not use this file except in compliance with 8 | # the License. You may obtain a copy of the License at 9 | # 10 | # http://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, software 13 | # distributed under the License is distributed on an "AS IS" BASIS, 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | # See the License for the specific language governing permissions and 16 | # limitations under the License. 17 | # 18 | 19 | mkdir -p target/transcripts-tmp 20 | mkdir -p target/transcripts 21 | cp -rf src/test/resources/transcripts/* target/transcripts-tmp 22 | mv target/transcripts-tmp/*.json target/transcripts/ 23 | -------------------------------------------------------------------------------- /data-extract-langchain4j/src/main/java/org/acme/extraction/CustomPojoStore.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package org.acme.extraction; 18 | 19 | import java.util.List; 20 | import java.util.concurrent.CopyOnWriteArrayList; 21 | import java.util.stream.Collectors; 22 | 23 | import jakarta.enterprise.context.ApplicationScoped; 24 | import org.acme.extraction.CustomPojoExtractionService.CustomPojo; 25 | import org.apache.camel.Handler; 26 | import org.jboss.logging.Logger; 27 | 28 | @ApplicationScoped 29 | public class CustomPojoStore { 30 | 31 | private static final Logger LOG = Logger.getLogger(CustomPojoStore.class); 32 | 33 | private List pojos = new CopyOnWriteArrayList<>(); 34 | 35 | @Handler 36 | CustomPojo addPojo(CustomPojo pojo) { 37 | LOG.info("An extracted POJO has been added to the store: " + pojo); 38 | pojos.add(pojo); 39 | return pojo; 40 | } 41 | 42 | String asString() { 43 | StringBuilder sb = new StringBuilder("{ \"pojos\": ["); 44 | String pojoString = pojos.stream().map(CustomPojo::toString).collect(Collectors.joining(",")); 45 | sb.append(pojoString); 46 | sb.append("] }"); 47 | return sb.toString(); 48 | } 49 | 50 | } 51 | -------------------------------------------------------------------------------- /data-extract-langchain4j/src/main/java/org/acme/extraction/Routes.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package org.acme.extraction; 18 | 19 | import jakarta.enterprise.context.ApplicationScoped; 20 | import jakarta.inject.Inject; 21 | import org.apache.camel.builder.RouteBuilder; 22 | 23 | @ApplicationScoped 24 | public class Routes extends RouteBuilder { 25 | 26 | @Inject 27 | CustomPojoStore customPojoStore; 28 | 29 | @Override 30 | public void configure() { 31 | 32 | // Consumes file documents that contain conversation transcripts (JSON format) 33 | from("file:target/transcripts?sortBy=file:name") 34 | .log("A document has been received by the camel-quarkus-file extension: ${body}") 35 | .setHeader("expectedDateFormat", constant("YYYY-MM-DD")) 36 | // The CustomPojoExtractionService transforms the conversation transcript into a CustomPojoExtractionService.CustomPojo 37 | .bean(CustomPojoExtractionService.class) 38 | // Store extracted CustomPojoExtractionService.CustomPojos objects into the CustomPojoStore for later inspection 39 | .bean(customPojoStore); 40 | 41 | // This route make it possible to inspect the extracted POJOs, mainly used for demo and test 42 | from("platform-http:/custom-pojo-store?produces=application/json") 43 | .bean(customPojoStore, "asString"); 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /data-extract-langchain4j/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | ## --------------------------------------------------------------------------- 2 | ## Licensed to the Apache Software Foundation (ASF) under one or more 3 | ## contributor license agreements. See the NOTICE file distributed with 4 | ## this work for additional information regarding copyright ownership. 5 | ## The ASF licenses this file to You under the Apache License, Version 2.0 6 | ## (the "License"); you may not use this file except in compliance with 7 | ## the License. You may obtain a copy of the License at 8 | ## 9 | ## http://www.apache.org/licenses/LICENSE-2.0 10 | ## 11 | ## Unless required by applicable law or agreed to in writing, software 12 | ## distributed under the License is distributed on an "AS IS" BASIS, 13 | ## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | ## See the License for the specific language governing permissions and 15 | ## limitations under the License. 16 | ## --------------------------------------------------------------------------- 17 | 18 | quarkus.devservices.enabled=false 19 | quarkus.banner.enabled = false 20 | 21 | # Configure Quarkus LangChain4j that handle interactions with the Large Language Model 22 | quarkus.langchain4j.ollama.base-url = http://localhost:11434 23 | quarkus.langchain4j.ollama.timeout = 3m 24 | quarkus.langchain4j.ollama.chat-model.model-id = granite3.2:2b 25 | quarkus.langchain4j.ollama.chat-model.temperature = 0 26 | # Uncomment lines below to log Ollama client requests and responses 27 | #quarkus.langchain4j.ollama.log-requests=true 28 | #quarkus.langchain4j.ollama.log-responses=true 29 | 30 | # Or uncomment lines below to log HTTP traffic between LangChain4j & the LLM API 31 | #quarkus.rest-client.logging.scope=request-response 32 | #quarkus.rest-client.logging.body-limit=10000 33 | #quarkus.log.category."org.jboss.resteasy.reactive.client.logging".level=DEBUG 34 | 35 | # Configure Quarkus LangChain4j to keep a single message in memory, forgetting about previous data extractions 36 | quarkus.langchain4j.chat-memory.memory-window.max-messages = 1 37 | 38 | quarkus.default-locale=en_US 39 | -------------------------------------------------------------------------------- /data-extract-langchain4j/src/test/java/org/acme/extraction/RouteIT.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package org.acme.extraction; 18 | 19 | import io.quarkus.test.junit.QuarkusIntegrationTest; 20 | 21 | @QuarkusIntegrationTest 22 | public class RouteIT extends RouteTest { 23 | 24 | } 25 | -------------------------------------------------------------------------------- /data-extract-langchain4j/src/test/resources/transcripts/01_sarah-london-10-07-1986-satisfied.json: -------------------------------------------------------------------------------- 1 | { 2 | "id": 1, 3 | "content": "Operator: Hello, how may I help you ?\nCustomer: Hello, I'm calling because I need to declare an accident on my main vehicle.\nOperator: Ok, can you please give me your name ?\nCustomer: My name is Sarah London.\nOperator: Could you please give me your birth date ?\nCustomer: 1986, July the 10th.\nOperator: Ok, I've got your contract and I'm happy to share with you that we'll be able to reimburse all expenses linked to this accident.\nCustomer: Oh great, many thanks." 4 | } -------------------------------------------------------------------------------- /data-extract-langchain4j/src/test/resources/transcripts/02_john-doe-01-11-2001-unsatisfied.json: -------------------------------------------------------------------------------- 1 | { 2 | "id": 2, 3 | "content": "Operator: Hello, how may I help you ?\nCustomer: Hello, I'm John. I need to share a problem with you. Actually, the insurance has reimbursed only half the money I have spent due to the accident.\nOperator: Hello John, could you please give me your last name so that I can find your contract.\nCustomer: Sure, my surname is Doe.\nOperator: And last thing, I need to know the date you were born.\nCustomer: Yes, so I was born in 2001, actually during the first day of November.\nOperator: Great, I see your contract now. Actually, the full reimbursement option has been cancelled automatically by our system. This explain the half reimbursement.\nCustomer: Ah damn, this is not acceptable. I've not even been notified about this automatic change.\nOperator: Oh, I'm sorry to hear that but the full reimbursement option was free for one year and at the time of subscription you were not interested in automatic renewal.\nCustomer: I don't discuss that. The important fact is that I should have been notified.\nOperator: Sure, I understand your resentment. The best I can do is to inform my manager.\nCustomer: OK, let's do that. Good bye.\nOperator: Good bye. And again let me apologize for the issue." 4 | } -------------------------------------------------------------------------------- /data-extract-langchain4j/src/test/resources/transcripts/03_kate-boss-13-08-1999-satisfied.json: -------------------------------------------------------------------------------- 1 | { 2 | "id": 3, 3 | "content": "Operator: Hello, how may I help you?\nCustomer: Hello, I am currently at the police station because I've got an accident. The police would need a proof that I have an insurance. Could you please help me?\nOperator: Sure, could you please remind me your name and birth date?\nCustomer: Of course, my name is Kate Hart and I was born on August the thirteen in the year nineteen ninety nine.\nOperator: I'm sorry Kate, but we don't have any contract in our records.\nCustomer: Oh, I'm sorry that I've made a mistake. Actually, my last name is not Hart, but Boss. It changed since I'm married.\nOperator: Indeed, I have now found your contract and everything looks good. Shall I send the proof of insurance to the police station?\nCustomer: Oh, if possible, my husband will go directly to your office in order to get it.\nOperator: Yes, that's possible. I will let the paper at the entrance. Your beloved could just ask it to the front desk.\nCustomer: Many thanks. I'm happy. You made a great job, I'm satisfied.\nOperator: Sure, you're welcome Kate. Please come back to us any time in case more information is needed. Bye.\nCustomer: Bye." 4 | } -------------------------------------------------------------------------------- /docs/antora.yml: -------------------------------------------------------------------------------- 1 | # 2 | # Licensed to the Apache Software Foundation (ASF) under one or more 3 | # contributor license agreements. See the NOTICE file distributed with 4 | # this work for additional information regarding copyright ownership. 5 | # The ASF licenses this file to You under the Apache License, Version 2.0 6 | # (the "License"); you may not use this file except in compliance with 7 | # the License. You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | # 17 | 18 | name: camel-quarkus-examples 19 | title: Camel Quarkus examples 20 | version: latest 21 | -------------------------------------------------------------------------------- /docs/modules/ROOT/nav.adoc: -------------------------------------------------------------------------------- 1 | // empty, because the pages are just dummy holders of metadata 2 | -------------------------------------------------------------------------------- /fhir/src/main/docker/Dockerfile.native: -------------------------------------------------------------------------------- 1 | ## --------------------------------------------------------------------------- 2 | ## Licensed to the Apache Software Foundation (ASF) under one or more 3 | ## contributor license agreements. See the NOTICE file distributed with 4 | ## this work for additional information regarding copyright ownership. 5 | ## The ASF licenses this file to You under the Apache License, Version 2.0 6 | ## (the "License"); you may not use this file except in compliance with 7 | ## the License. You may obtain a copy of the License at 8 | ## 9 | ## http://www.apache.org/licenses/LICENSE-2.0 10 | ## 11 | ## Unless required by applicable law or agreed to in writing, software 12 | ## distributed under the License is distributed on an "AS IS" BASIS, 13 | ## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | ## See the License for the specific language governing permissions and 15 | ## limitations under the License. 16 | ## --------------------------------------------------------------------------- 17 | #### 18 | # This Dockerfile is used in order to build a container that runs the Quarkus application in native (no JVM) mode. 19 | # 20 | # Before building the container image run: 21 | # 22 | # mvn package -Dnative 23 | # 24 | # Then, build the image with: 25 | # 26 | # docker build -f src/main/docker/Dockerfile.native -t quarkus/fhir . 27 | # 28 | # Then run the container using: 29 | # 30 | # docker run -i --rm -p 8080:8080 quarkus/fhir 31 | # 32 | # The ` registry.access.redhat.com/ubi9/ubi-minimal:9.5` base image is based on UBI 9. 33 | # To use UBI 8, switch to `quay.io/ubi8/ubi-minimal:8.10`. 34 | ### 35 | FROM registry.access.redhat.com/ubi9/ubi-minimal:9.5 36 | WORKDIR /work/ 37 | RUN chown 1001 /work \ 38 | && chmod "g+rwX" /work \ 39 | && chown 1001:root /work 40 | COPY --chown=1001:root --chmod=0755 target/*-runner /work/application 41 | 42 | EXPOSE 8080 43 | USER 1001 44 | 45 | ENTRYPOINT ["./application", "-Dquarkus.http.host=0.0.0.0"] 46 | -------------------------------------------------------------------------------- /fhir/src/main/docker/Dockerfile.native-micro: -------------------------------------------------------------------------------- 1 | ## --------------------------------------------------------------------------- 2 | ## Licensed to the Apache Software Foundation (ASF) under one or more 3 | ## contributor license agreements. See the NOTICE file distributed with 4 | ## this work for additional information regarding copyright ownership. 5 | ## The ASF licenses this file to You under the Apache License, Version 2.0 6 | ## (the "License"); you may not use this file except in compliance with 7 | ## the License. You may obtain a copy of the License at 8 | ## 9 | ## http://www.apache.org/licenses/LICENSE-2.0 10 | ## 11 | ## Unless required by applicable law or agreed to in writing, software 12 | ## distributed under the License is distributed on an "AS IS" BASIS, 13 | ## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | ## See the License for the specific language governing permissions and 15 | ## limitations under the License. 16 | ## --------------------------------------------------------------------------- 17 | #### 18 | # This Dockerfile is used in order to build a container that runs the Quarkus application in native (no JVM) mode. 19 | # It uses a micro base image, tuned for Quarkus native executables. 20 | # It reduces the size of the resulting container image. 21 | # Check https://quarkus.io/guides/quarkus-runtime-base-image for further information about this image. 22 | # 23 | # Before building the container image run: 24 | # 25 | # mvn package -Dnative 26 | # 27 | # Then, build the image with: 28 | # 29 | # docker build -f src/main/docker/Dockerfile.native-micro -t quarkus/fhir . 30 | # 31 | # Then run the container using: 32 | # 33 | # docker run -i --rm -p 8080:8080 quarkus/fhir 34 | # 35 | # The `quay.io/quarkus/ubi9-quarkus-micro-image:2.0` base image is based on UBI 9. 36 | # To use UBI 8, switch to `quay.io/quarkus/quarkus-micro-image:2.0`. 37 | ### 38 | FROM quay.io/quarkus/ubi9-quarkus-micro-image:2.0 39 | WORKDIR /work/ 40 | RUN chown 1001 /work \ 41 | && chmod "g+rwX" /work \ 42 | && chown 1001:root /work 43 | COPY --chown=1001:root --chmod=0755 target/*-runner /work/application 44 | 45 | EXPOSE 8080 46 | USER 1001 47 | 48 | ENTRYPOINT ["./application", "-Dquarkus.http.host=0.0.0.0"] 49 | -------------------------------------------------------------------------------- /fhir/src/test/java/org/acme/fhir/FHIRIT.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package org.acme.fhir; 18 | 19 | import io.quarkus.test.junit.QuarkusIntegrationTest; 20 | 21 | @QuarkusIntegrationTest 22 | class FHIRIT extends FHIRTest { 23 | } 24 | -------------------------------------------------------------------------------- /fhir/src/test/resources/data/hl7v2.patient: -------------------------------------------------------------------------------- 1 | MSH|^~\&|Amalga HIS|BUM|New Tester|MS|20111121103141||ORU^R01|2847970-201111211031|P|2.4|||AL|NE|764|ASCII||| PID||100005056|100005056||Price^Vincent^""^^""|""|19810813000000|F||CA|Street 1^""^""^""^34000^SGP^^""~""^""^""^""^Danling Street 5th^THA^^""||326-2275^PRN^PH^^66^675~476-5059^ORN^CP^^66^359~(123)456-7890^ORN^FX^^66^222~^NET^X.400^a@a.a~^NET^X.400^dummy@hotmail.com|(123)456-7890^WPN^PH^^66|UNK|S|BUD||BP000111899|D99999^""||CA|Bangkok|||THA||THA|""|N PV1||OPD ||||""^""^""||||CNSLT|||||C|VIP|||6262618|PB1||||||||||||||||||||||||20101208134638 PV2|||^Unknown|""^""||||""|""|0||""|||||||||||||||||||||||||||||HP1 ORC|NW|""|BMC1102771601|""|CM||^^^^^""|||||||||""^""^^^"" OBR|1|""|BMC1102771601|""^Brain (CT)||20111028124215||||||||||||||||||CTSCAN|F||^^^^^ROUTINE|||""||||||""|||||||||||^"" OBX|1|FT|""^Brain (CT)||++++ text of report goes here +++|||REQAT|||FINAL|||20111121103040||75929^Gosselin^Angelina -------------------------------------------------------------------------------- /file-bindy-ftp/src/test/java/org/acme/bindy/ftp/FileToFtpIT.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package org.acme.bindy.ftp; 18 | 19 | import io.quarkus.test.junit.QuarkusIntegrationTest; 20 | 21 | @QuarkusIntegrationTest 22 | class FileToFtpIT extends FileToFtpTest { 23 | 24 | } 25 | -------------------------------------------------------------------------------- /file-split-log-xml/src/main/java/org/acme/file/xml/DummyClass.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package org.acme.file.xml; 18 | 19 | public class DummyClass { 20 | } 21 | -------------------------------------------------------------------------------- /file-split-log-xml/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | ## --------------------------------------------------------------------------- 2 | ## Licensed to the Apache Software Foundation (ASF) under one or more 3 | ## contributor license agreements. See the NOTICE file distributed with 4 | ## this work for additional information regarding copyright ownership. 5 | ## The ASF licenses this file to You under the Apache License, Version 2.0 6 | ## (the "License"); you may not use this file except in compliance with 7 | ## the License. You may obtain a copy of the License at 8 | ## 9 | ## http://www.apache.org/licenses/LICENSE-2.0 10 | ## 11 | ## Unless required by applicable law or agreed to in writing, software 12 | ## distributed under the License is distributed on an "AS IS" BASIS, 13 | ## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | ## See the License for the specific language governing permissions and 15 | ## limitations under the License. 16 | ## --------------------------------------------------------------------------- 17 | # 18 | # Quarkus 19 | # 20 | quarkus.banner.enabled = false 21 | quarkus.log.file.enable = true 22 | 23 | # 24 | # Camel 25 | # 26 | camel.context.name = camel-quarkus-xml 27 | camel.main.routes-include-pattern = file:src/main/resources/routes/camel-routes.xml 28 | camel.file.route.folder = src/main/resources/file 29 | camel.file.repeat.interval = 30000 30 | camel.file.split.parallel = false 31 | -------------------------------------------------------------------------------- /file-split-log-xml/src/main/resources/file/customerlist.csv: -------------------------------------------------------------------------------- 1 | name,surname 2 | Michael,SMITH 3 | James,JOHNSON 4 | John,WILLIAMS 5 | Robert,BROWN 6 | David,JONES 7 | William,MILLER 8 | Mary,DAVIS 9 | Christopher,GARCIA 10 | Joseph,RODRIGUEZ 11 | Richard,WILSON 12 | -------------------------------------------------------------------------------- /file-split-log-xml/src/main/resources/routes/camel-routes.xml: -------------------------------------------------------------------------------- 1 | 2 | 20 | 21 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | ${headers.CamelSplitIndex} == 0 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | -------------------------------------------------------------------------------- /file-split-log-xml/src/test/java/org/acme/file/xml/FileSplitLogXmlIT.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package org.acme.file.xml; 18 | 19 | import io.quarkus.test.junit.QuarkusIntegrationTest; 20 | 21 | @QuarkusIntegrationTest 22 | class FileSplitLogXmlIT extends FileSplitLogXmlTest { 23 | 24 | } 25 | -------------------------------------------------------------------------------- /file-split-log-xml/src/test/java/org/acme/file/xml/FileSplitLogXmlTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package org.acme.file.xml; 18 | 19 | import java.nio.charset.StandardCharsets; 20 | import java.nio.file.Files; 21 | import java.nio.file.Paths; 22 | import java.util.concurrent.TimeUnit; 23 | 24 | import io.quarkus.test.junit.QuarkusTest; 25 | import org.junit.jupiter.api.Test; 26 | 27 | import static org.awaitility.Awaitility.await; 28 | 29 | @QuarkusTest 30 | public class FileSplitLogXmlTest { 31 | 32 | @Test 33 | public void testFileSplitLogXml() { 34 | // Verify that all 10 items were output to the log 35 | await().atMost(10L, TimeUnit.SECONDS).pollDelay(1, TimeUnit.SECONDS).until(() -> { 36 | String log = new String(Files.readAllBytes(Paths.get("target/quarkus.log")), StandardCharsets.UTF_8); 37 | return log.contains("line 10 contains: Richard,WILSON"); 38 | }); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /header.txt: -------------------------------------------------------------------------------- 1 | Licensed to the Apache Software Foundation (ASF) under one or more 2 | contributor license agreements. See the NOTICE file distributed with 3 | this work for additional information regarding copyright ownership. 4 | The ASF licenses this file to You under the Apache License, Version 2.0 5 | (the "License"); you may not use this file except in compliance with 6 | the License. You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | -------------------------------------------------------------------------------- /health/src/main/java/org/acme/health/MyRouteBuilder.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package org.acme.health; 18 | 19 | import org.apache.camel.builder.RouteBuilder; 20 | 21 | public class MyRouteBuilder extends RouteBuilder { 22 | 23 | @Override 24 | public void configure() { 25 | from("timer:foo?period={{myPeriod}}").routeId("timer").log("Doing one more task"); 26 | 27 | // this route is invalid and fails during startup 28 | // the supervising route controller will take over and attempt 29 | // to restart this route 30 | from("netty:tcp:unknownhost").to("log:dummy").routeId("netty"); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /health/src/test/java/org/acme/health/HealthIT.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package org.acme.health; 18 | 19 | import io.quarkus.test.junit.QuarkusIntegrationTest; 20 | 21 | @QuarkusIntegrationTest 22 | class HealthIT extends HealthTest { 23 | } 24 | -------------------------------------------------------------------------------- /health/src/test/java/org/acme/health/HealthTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package org.acme.health; 18 | 19 | import io.quarkus.test.junit.QuarkusTest; 20 | import io.restassured.RestAssured; 21 | import org.hamcrest.Matchers; 22 | import org.junit.jupiter.api.Test; 23 | 24 | import static org.hamcrest.CoreMatchers.is; 25 | 26 | @QuarkusTest 27 | public class HealthTest { 28 | 29 | @Test 30 | public void testHealth() throws InterruptedException { 31 | RestAssured.get("/q/health") 32 | .then() 33 | .statusCode(503) 34 | .body("status", is("DOWN"), 35 | "checks.findAll { it.name == 'toolong' }.status", Matchers.contains("UP"), 36 | "checks.findAll { it.name == 'context' }.status", Matchers.contains("UP", "UP"), 37 | "checks.findAll { it.name == 'camel-routes' }.status", Matchers.contains("DOWN"), 38 | "checks.findAll { it.name == 'camel-consumers' }.status", Matchers.contains("DOWN")); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /http-log/rss-memory.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 3 | # Licensed to the Apache Software Foundation (ASF) under one or more 4 | # contributor license agreements. See the NOTICE file distributed with 5 | # this work for additional information regarding copyright ownership. 6 | # The ASF licenses this file to You under the Apache License, Version 2.0 7 | # (the "License"); you may not use this file except in compliance with 8 | # the License. You may obtain a copy of the License at 9 | # 10 | # http://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, software 13 | # distributed under the License is distributed on an "AS IS" BASIS, 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | # See the License for the specific language governing permissions and 16 | # limitations under the License. 17 | # 18 | 19 | # script to aggregate the total RSS memory used by the processes in MB. 20 | # the script includes itself so that adds about 2mb extra in total memory. 21 | # the script is a bit hackish and improvements is welcome. 22 | ps -o rss -o command | grep $1 | awk '{print $1}' | head -n 100 | awk '{sum+=$1/1024}END{print sum}' 23 | -------------------------------------------------------------------------------- /http-log/run-many.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 3 | # Licensed to the Apache Software Foundation (ASF) under one or more 4 | # contributor license agreements. See the NOTICE file distributed with 5 | # this work for additional information regarding copyright ownership. 6 | # The ASF licenses this file to You under the Apache License, Version 2.0 7 | # (the "License"); you may not use this file except in compliance with 8 | # the License. You may obtain a copy of the License at 9 | # 10 | # http://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, software 13 | # distributed under the License is distributed on an "AS IS" BASIS, 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | # See the License for the specific language governing permissions and 16 | # limitations under the License. 17 | # 18 | 19 | # script to quickly run 100 instances of the native compiled example 20 | # using http port numbers from 8000 - 8100 21 | # you can then try each instance by its number such as: 22 | # http://localhost:8012/camel/hello 23 | # 24 | # to kill all instances at once, you can use pkill command: 25 | # pkill camel-quarkus 26 | # 27 | for i in $(seq 8000 8100); do 28 | QUARKUS_HTTP_PORT=$i ./target/camel-quarkus-examples-http-log-*-runner > http-log-$i.log & 29 | done -------------------------------------------------------------------------------- /http-log/src/main/java/org/acme/http/CamelRoute.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package org.acme.http; 18 | 19 | import jakarta.enterprise.context.ApplicationScoped; 20 | import org.apache.camel.builder.endpoint.EndpointRouteBuilder; 21 | 22 | @ApplicationScoped 23 | public class CamelRoute extends EndpointRouteBuilder { 24 | 25 | @Override 26 | public void configure() throws Exception { 27 | from(platformHttp("/camel/hello")) 28 | .setBody().simple("Camel runs on ${hostname}") 29 | .to(log("hi").showExchangePattern(false).showBodyType(false)); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /http-log/src/main/java/org/acme/http/ExampleResource.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package org.acme.http; 18 | 19 | import jakarta.ws.rs.GET; 20 | import jakarta.ws.rs.Path; 21 | import jakarta.ws.rs.Produces; 22 | import jakarta.ws.rs.core.MediaType; 23 | 24 | /** 25 | * A JAX-RS resource 26 | */ 27 | @Path("/hello") 28 | public class ExampleResource { 29 | 30 | /** 31 | * A JAX-RS endpoint always returning {@code "hello"} 32 | * 33 | * @return {@code "hello"} 34 | */ 35 | @GET 36 | @Produces(MediaType.TEXT_PLAIN) 37 | public String hello() { 38 | return "hello"; 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /http-log/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | ## --------------------------------------------------------------------------- 2 | ## Licensed to the Apache Software Foundation (ASF) under one or more 3 | ## contributor license agreements. See the NOTICE file distributed with 4 | ## this work for additional information regarding copyright ownership. 5 | ## The ASF licenses this file to You under the Apache License, Version 2.0 6 | ## (the "License"); you may not use this file except in compliance with 7 | ## the License. You may obtain a copy of the License at 8 | ## 9 | ## http://www.apache.org/licenses/LICENSE-2.0 10 | ## 11 | ## Unless required by applicable law or agreed to in writing, software 12 | ## distributed under the License is distributed on an "AS IS" BASIS, 13 | ## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | ## See the License for the specific language governing permissions and 15 | ## limitations under the License. 16 | ## --------------------------------------------------------------------------- 17 | # 18 | # Quarkus 19 | # 20 | quarkus.banner.enabled = false 21 | quarkus.log.file.enable = true 22 | 23 | # 24 | # Quarkus - Camel 25 | # 26 | 27 | # to turn on or off health check 28 | quarkus.camel.health.enabled = true 29 | 30 | # bean introspection to log reflection based configuration 31 | camel.main.beanIntrospectionExtendedStatistics = true 32 | camel.main.beanIntrospectionLoggingLevel = INFO 33 | 34 | # 35 | # Camel 36 | # 37 | camel.context.name = quarkus-camel-example-http-log 38 | 39 | -------------------------------------------------------------------------------- /http-log/src/test/java/org/acme/http/HttpLogIT.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package org.acme.http; 18 | 19 | import io.quarkus.test.junit.QuarkusIntegrationTest; 20 | 21 | @QuarkusIntegrationTest 22 | class HttpLogIT extends HttpLogTest { 23 | } 24 | -------------------------------------------------------------------------------- /http-log/src/test/java/org/acme/http/HttpLogTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package org.acme.http; 18 | 19 | import java.nio.charset.StandardCharsets; 20 | import java.nio.file.Files; 21 | import java.nio.file.Paths; 22 | import java.util.concurrent.TimeUnit; 23 | 24 | import io.quarkus.test.junit.QuarkusTest; 25 | import io.restassured.RestAssured; 26 | import org.junit.jupiter.api.Test; 27 | 28 | import static org.awaitility.Awaitility.await; 29 | 30 | @QuarkusTest 31 | public class HttpLogTest { 32 | 33 | @Test 34 | public void testHttpLog() { 35 | RestAssured.get("/camel/hello") 36 | .then() 37 | .statusCode(200); 38 | 39 | await().atMost(10L, TimeUnit.SECONDS).pollDelay(1, TimeUnit.SECONDS).until(() -> { 40 | String log = new String(Files.readAllBytes(Paths.get("target/quarkus.log")), StandardCharsets.UTF_8); 41 | return log.contains("Camel runs on"); 42 | }); 43 | } 44 | 45 | } 46 | -------------------------------------------------------------------------------- /jdbc-datasource/src/main/java/org/acme/jdbc/JdbcService.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package org.acme.jdbc; 18 | 19 | import java.sql.ResultSet; 20 | import java.sql.SQLException; 21 | 22 | import io.agroal.api.AgroalDataSource; 23 | import io.quarkus.agroal.DataSource; 24 | import io.quarkus.runtime.annotations.RegisterForReflection; 25 | import jakarta.enterprise.context.ApplicationScoped; 26 | import jakarta.inject.Inject; 27 | import jakarta.inject.Named; 28 | 29 | @Named("reviewService") 30 | @ApplicationScoped 31 | @RegisterForReflection 32 | public class JdbcService { 33 | 34 | @Inject 35 | @DataSource("target_db") 36 | AgroalDataSource targetDb; 37 | 38 | String getHotelReviews() throws SQLException { 39 | 40 | StringBuilder sb = new StringBuilder(); 41 | 42 | ResultSet rs = targetDb.getConnection().createStatement().executeQuery("SELECT (hotel_name, review) FROM Target"); 43 | 44 | while (rs.next()) { 45 | sb.append(rs.getString(1)); 46 | } 47 | 48 | return sb.toString(); 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /jdbc-datasource/src/main/java/org/acme/jdbc/JdbcTestHarness.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package org.acme.jdbc; 18 | 19 | import org.apache.camel.builder.RouteBuilder; 20 | 21 | public class JdbcTestHarness extends RouteBuilder { 22 | @Override 23 | public void configure() throws Exception { 24 | from("platform-http:/getHotelReviews") 25 | .bean("reviewService", "getHotelReviews"); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /jdbc-datasource/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | ## --------------------------------------------------------------------------- 2 | ## Licensed to the Apache Software Foundation (ASF) under one or more 3 | ## contributor license agreements. See the NOTICE file distributed with 4 | ## this work for additional information regarding copyright ownership. 5 | ## The ASF licenses this file to You under the Apache License, Version 2.0 6 | ## (the "License"); you may not use this file except in compliance with 7 | ## the License. You may obtain a copy of the License at 8 | ## 9 | ## http://www.apache.org/licenses/LICENSE-2.0 10 | ## 11 | ## Unless required by applicable law or agreed to in writing, software 12 | ## distributed under the License is distributed on an "AS IS" BASIS, 13 | ## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | ## See the License for the specific language governing permissions and 15 | ## limitations under the License. 16 | ## --------------------------------------------------------------------------- 17 | # 18 | # Quarkus 19 | # 20 | quarkus.banner.enabled = false 21 | quarkus.log.file.enable = true 22 | 23 | # Set how many time the route should be applied 24 | etl.timer.repeatcount = 0 25 | etl.timer.period = 10000 26 | etl.timer.delay = 1000 27 | %test.etl.timer.repeatCount = 1 28 | 29 | # Source Database Configuration 30 | quarkus.datasource.source_db.db-kind = postgresql 31 | quarkus.datasource.source_db.jdbc.url = jdbc:postgresql://localhost:5432/source_db 32 | quarkus.datasource.source_db.username = ETL_source_user 33 | quarkus.datasource.source_db.password = 1234567@8_source 34 | 35 | # Target Database Configuration 36 | quarkus.datasource.target_db.db-kind = postgresql 37 | quarkus.datasource.target_db.jdbc.url = jdbc:postgresql://localhost:5433/target_db 38 | quarkus.datasource.target_db.username = ETL_target_user 39 | quarkus.datasource.target_db.password = 1234567@8_target 40 | -------------------------------------------------------------------------------- /jdbc-datasource/src/test/java/org/acme/jdbc/JdbcIT.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package org.acme.jdbc; 18 | 19 | import io.quarkus.test.junit.QuarkusIntegrationTest; 20 | 21 | @QuarkusIntegrationTest 22 | public class JdbcIT extends JdbcTest { 23 | } 24 | -------------------------------------------------------------------------------- /jdbc-datasource/src/test/java/org/acme/jdbc/JdbcTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package org.acme.jdbc; 18 | 19 | import java.util.concurrent.TimeUnit; 20 | 21 | import io.quarkus.test.common.QuarkusTestResource; 22 | import io.quarkus.test.junit.QuarkusTest; 23 | import io.restassured.RestAssured; 24 | import org.junit.jupiter.api.Test; 25 | 26 | import static org.awaitility.Awaitility.await; 27 | 28 | @QuarkusTest 29 | @QuarkusTestResource(PostgresSourceDatabaseTestResource.class) 30 | @QuarkusTestResource(PostgresTargetDatabaseTestResource.class) 31 | public class JdbcTest { 32 | 33 | @Test 34 | public void etlBridgeShouldTransferValuesBetweenDatebases() { 35 | await().atMost(30L, TimeUnit.SECONDS).pollDelay(500, TimeUnit.MILLISECONDS).until(() -> { 36 | String hotelReviews = RestAssured 37 | .get("/getHotelReviews") 38 | .then() 39 | .extract().asString(); 40 | 41 | return "(\"Grand Hotel\",1)(\"Middle Hotel\",0)(\"Small Hotel\",-1)".equals(hotelReviews); 42 | }); 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /jdbc-datasource/src/test/resources/init-source-db.sql: -------------------------------------------------------------------------------- 1 | -- 2 | -- Licensed to the Apache Software Foundation (ASF) under one or more 3 | -- contributor license agreements. See the NOTICE file distributed with 4 | -- this work for additional information regarding copyright ownership. 5 | -- The ASF licenses this file to You under the Apache License, Version 2.0 6 | -- (the "License"); you may not use this file except in compliance with 7 | -- the License. You may obtain a copy of the License at 8 | -- 9 | -- http://www.apache.org/licenses/LICENSE-2.0 10 | -- 11 | -- Unless required by applicable law or agreed to in writing, software 12 | -- distributed under the License is distributed on an "AS IS" BASIS, 13 | -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | -- See the License for the specific language governing permissions and 15 | -- limitations under the License. 16 | -- 17 | 18 | CREATE TABLE IF NOT EXISTS Source (id SERIAL PRIMARY KEY, hotel_name VARCHAR(255), price DECIMAL, review VARCHAR(255)); 19 | 20 | INSERT INTO Source (id, hotel_name, price, review) VALUES 21 | (1, 'Grand Hotel', 100, 'best'), 22 | (2, 'Middle Hotel', 20, 'good'), 23 | (3, 'Small Hotel', 17, 'worst'); -------------------------------------------------------------------------------- /jdbc-datasource/src/test/resources/init-target-db.sql: -------------------------------------------------------------------------------- 1 | -- 2 | -- Licensed to the Apache Software Foundation (ASF) under one or more 3 | -- contributor license agreements. See the NOTICE file distributed with 4 | -- this work for additional information regarding copyright ownership. 5 | -- The ASF licenses this file to You under the Apache License, Version 2.0 6 | -- (the "License"); you may not use this file except in compliance with 7 | -- the License. You may obtain a copy of the License at 8 | -- 9 | -- http://www.apache.org/licenses/LICENSE-2.0 10 | -- 11 | -- Unless required by applicable law or agreed to in writing, software 12 | -- distributed under the License is distributed on an "AS IS" BASIS, 13 | -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | -- See the License for the specific language governing permissions and 15 | -- limitations under the License. 16 | -- 17 | 18 | CREATE TABLE IF NOT EXISTS Target (id SERIAL PRIMARY KEY, hotel_name VARCHAR(255), price DECIMAL, review DECIMAL); -------------------------------------------------------------------------------- /jms-jpa/src/main/java/org/acme/AuditLog.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package org.acme; 18 | 19 | import io.quarkus.runtime.annotations.RegisterForReflection; 20 | import jakarta.enterprise.context.ApplicationScoped; 21 | import jakarta.inject.Named; 22 | import jakarta.persistence.Column; 23 | import jakarta.persistence.Entity; 24 | import jakarta.persistence.GeneratedValue; 25 | import jakarta.persistence.GenerationType; 26 | import jakarta.persistence.Id; 27 | import jakarta.persistence.NamedQueries; 28 | import jakarta.persistence.NamedQuery; 29 | import jakarta.persistence.Table; 30 | 31 | @Entity 32 | @Table(name = "audit_log") 33 | @NamedQueries({ 34 | @NamedQuery(name = "getAuditLog", query = "select al from AuditLog al") 35 | }) 36 | @Named("auditLog") 37 | @ApplicationScoped 38 | @RegisterForReflection 39 | public class AuditLog { 40 | @Id 41 | @GeneratedValue(strategy = GenerationType.IDENTITY) 42 | @Column(name = "id") 43 | private long id; 44 | private String message; 45 | 46 | public String getMessage() { 47 | return message; 48 | } 49 | 50 | public AuditLog createAuditLog(String message) { 51 | AuditLog auditLog = new AuditLog(); 52 | auditLog.message = message; 53 | return auditLog; 54 | } 55 | 56 | @Override 57 | public String toString() { 58 | return String.format("{message=%s}", message); 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /jms-jpa/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | ## --------------------------------------------------------------------------- 2 | ## Licensed to the Apache Software Foundation (ASF) under one or more 3 | ## contributor license agreements. See the NOTICE file distributed with 4 | ## this work for additional information regarding copyright ownership. 5 | ## The ASF licenses this file to You under the Apache License, Version 2.0 6 | ## (the "License"); you may not use this file except in compliance with 7 | ## the License. You may obtain a copy of the License at 8 | ## 9 | ## http://www.apache.org/licenses/LICENSE-2.0 10 | ## 11 | ## Unless required by applicable law or agreed to in writing, software 12 | ## distributed under the License is distributed on an "AS IS" BASIS, 13 | ## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | ## See the License for the specific language governing permissions and 15 | ## limitations under the License. 16 | ## --------------------------------------------------------------------------- 17 | # 18 | # Quarkus 19 | # 20 | quarkus.banner.enabled = false 21 | quarkus.log.file.enable = true 22 | 23 | # Default Datasource 24 | quarkus.datasource.db-kind=h2 25 | quarkus.datasource.jdbc.max-size=8 26 | quarkus.datasource.jdbc.transactions=xa 27 | 28 | # Production Datasource 29 | #%prod.quarkus.datasource.db-kind=mysql 30 | #%prod.quarkus.datasource.username=admin 31 | #%prod.quarkus.datasource.password=admin 32 | #%prod.quarkus.datasource.jdbc.url=jdbc:mysql://localhost:3306/testdb 33 | #%prod.quarkus.datasource.jdbc.transactions=xa 34 | 35 | # Hibernate ORM 36 | quarkus.hibernate-orm.database.generation=drop-and-create 37 | #%prod.quarkus.hibernate-orm.database.generation=none 38 | 39 | # Quarkus Narayana JTA 40 | quarkus.transaction-manager.object-store.directory=target/narayana 41 | quarkus.transaction-manager.enable-recovery=true 42 | 43 | # Camel 44 | camel.rest.context-path=/api 45 | 46 | # Quarkus Artemis 47 | quarkus.artemis.enabled=true 48 | #%prod.quarkus.artemis.url=tcp://localhost:61616 49 | #%prod.quarkus.artemis.username=admin 50 | #%prod.quarkus.artemis.password=admin 51 | 52 | # Quarkus MessagingHub Pooled JMS 53 | quarkus.pooled-jms.transaction=xa 54 | -------------------------------------------------------------------------------- /jms-jpa/src/test/java/org/acme/JtaIT.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package org.acme; 18 | 19 | import io.quarkus.test.junit.QuarkusIntegrationTest; 20 | 21 | @QuarkusIntegrationTest 22 | public class JtaIT extends JtaTest { 23 | } 24 | -------------------------------------------------------------------------------- /jpa-idempotent-repository/schema.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apache/camel-quarkus-examples/3ab40d177967cd808f87611e686054db2f918c48/jpa-idempotent-repository/schema.png -------------------------------------------------------------------------------- /jpa-idempotent-repository/schemas-source.odp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apache/camel-quarkus-examples/3ab40d177967cd808f87611e686054db2f918c48/jpa-idempotent-repository/schemas-source.odp -------------------------------------------------------------------------------- /jpa-idempotent-repository/src/main/java/org/acme/jpa/idempotent/repository/CostlyApiService.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package org.acme.jpa.idempotent.repository; 18 | 19 | import java.util.Set; 20 | import java.util.concurrent.ConcurrentHashMap; 21 | 22 | import jakarta.enterprise.context.ApplicationScoped; 23 | import jakarta.inject.Named; 24 | import org.apache.camel.Handler; 25 | import org.jboss.logging.Logger; 26 | 27 | @ApplicationScoped 28 | @Named("costlyApiService") 29 | public class CostlyApiService { 30 | 31 | private static final Logger LOG = Logger.getLogger(CostlyApiService.class); 32 | 33 | private static Set ALREADY_USED_CONTENT = ConcurrentHashMap.newKeySet(); 34 | 35 | /** 36 | * The content parameter is populated with the incoming HTTP body sent to this API. 37 | */ 38 | @Handler 39 | void invoke(String content) { 40 | if (ALREADY_USED_CONTENT.contains(content)) { 41 | LOG.info("Costly API has been called two times with the same content => TOO MUCH EXPENSIVE !"); 42 | } else { 43 | ALREADY_USED_CONTENT.add(content); 44 | LOG.info("Costly API has been called with new content => GOOD"); 45 | } 46 | } 47 | 48 | String getContentSet() { 49 | return String.join(",", ALREADY_USED_CONTENT); 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /jpa-idempotent-repository/src/main/resources/db/migration/V1.0.0__add_camel_message_processed.sql: -------------------------------------------------------------------------------- 1 | -- 2 | -- Licensed to the Apache Software Foundation (ASF) under one or more 3 | -- contributor license agreements. See the NOTICE file distributed with 4 | -- this work for additional information regarding copyright ownership. 5 | -- The ASF licenses this file to You under the Apache License, Version 2.0 6 | -- (the "License"); you may not use this file except in compliance with 7 | -- the License. You may obtain a copy of the License at 8 | -- 9 | -- http://www.apache.org/licenses/LICENSE-2.0 10 | -- 11 | -- Unless required by applicable law or agreed to in writing, software 12 | -- distributed under the License is distributed on an "AS IS" BASIS, 13 | -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | -- See the License for the specific language governing permissions and 15 | -- limitations under the License. 16 | -- 17 | 18 | CREATE TABLE CAMEL_MESSAGEPROCESSED ( 19 | id BIGINT NOT NULL, 20 | createdAt TIMESTAMP(6), 21 | messageId VARCHAR(255), 22 | processorName VARCHAR(255), 23 | PRIMARY KEY (id) 24 | ); 25 | 26 | CREATE SEQUENCE CAMEL_MESSAGEPROCESSED_SEQ START WITH 1 INCREMENT BY 50; 27 | 28 | ALTER TABLE CAMEL_MESSAGEPROCESSED ADD CONSTRAINT message_processed_key_constraint UNIQUE (processorName, messageId); 29 | -------------------------------------------------------------------------------- /jpa-idempotent-repository/src/test/java/org/acme/jpa/idempotent/repository/JpaIdempotentRepositoryIT.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package org.acme.jpa.idempotent.repository; 18 | 19 | import io.quarkus.test.junit.QuarkusIntegrationTest; 20 | 21 | @QuarkusIntegrationTest 22 | class JpaIdempotentRepositoryIT extends JpaIdempotentRepositoryTest { 23 | 24 | } 25 | -------------------------------------------------------------------------------- /jpa-idempotent-repository/src/test/java/org/acme/jpa/idempotent/repository/JpaIdempotentRepositoryTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package org.acme.jpa.idempotent.repository; 18 | 19 | import java.util.concurrent.TimeUnit; 20 | 21 | import io.quarkus.test.common.QuarkusTestResource; 22 | import io.quarkus.test.junit.QuarkusTest; 23 | import io.restassured.RestAssured; 24 | import org.junit.jupiter.api.Test; 25 | 26 | import static org.awaitility.Awaitility.await; 27 | 28 | @QuarkusTest 29 | @QuarkusTestResource(JpaIdempotentRepositoryTestResource.class) 30 | public class JpaIdempotentRepositoryTest { 31 | @Test 32 | public void contentSetShouldStartWithOneThreeFive() { 33 | await().atMost(30L, TimeUnit.SECONDS).pollDelay(500, TimeUnit.MILLISECONDS).until(() -> { 34 | String contentSet = RestAssured 35 | .when() 36 | .get("/content-set") 37 | .then() 38 | .extract().asString(); 39 | 40 | return contentSet != null && contentSet.startsWith("1,3,5"); 41 | }); 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /jpa-idempotent-repository/src/test/java/org/acme/jpa/idempotent/repository/JpaIdempotentRepositoryTestResource.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package org.acme.jpa.idempotent.repository; 18 | 19 | import java.util.Map; 20 | 21 | import io.quarkus.test.common.QuarkusTestResourceLifecycleManager; 22 | import org.apache.camel.util.CollectionHelper; 23 | 24 | /** 25 | * Force timer configuration for faster test assertions 26 | */ 27 | public class JpaIdempotentRepositoryTestResource implements QuarkusTestResourceLifecycleManager { 28 | @Override 29 | public Map start() { 30 | return CollectionHelper.mapOf( 31 | "timer.period", "100", 32 | "timer.delay", "0", 33 | "timer.repeatCount", "4"); 34 | } 35 | 36 | @Override 37 | public void stop() { 38 | // Noop 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /jta-jpa/src/main/java/org/acme/AuditLog.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package org.acme; 18 | 19 | import io.quarkus.runtime.annotations.RegisterForReflection; 20 | import jakarta.enterprise.context.ApplicationScoped; 21 | import jakarta.inject.Named; 22 | import jakarta.persistence.Column; 23 | import jakarta.persistence.Entity; 24 | import jakarta.persistence.GeneratedValue; 25 | import jakarta.persistence.GenerationType; 26 | import jakarta.persistence.Id; 27 | import jakarta.persistence.NamedQueries; 28 | import jakarta.persistence.NamedQuery; 29 | import jakarta.persistence.Table; 30 | 31 | @Entity 32 | @Table(name = "audit_log") 33 | @NamedQueries({ 34 | @NamedQuery(name = "getAuditLog", query = "select al from AuditLog al") 35 | }) 36 | @Named("auditLog") 37 | @ApplicationScoped 38 | @RegisterForReflection 39 | public class AuditLog { 40 | @Id 41 | @GeneratedValue(strategy = GenerationType.IDENTITY) 42 | @Column(name = "id") 43 | private long id; 44 | private String message; 45 | 46 | public String getMessage() { 47 | return message; 48 | } 49 | 50 | public AuditLog createAuditLog(String message) { 51 | AuditLog auditLog = new AuditLog(); 52 | auditLog.message = message; 53 | return auditLog; 54 | } 55 | 56 | @Override 57 | public String toString() { 58 | return String.format("{message=%s}", message); 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /jta-jpa/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | ## --------------------------------------------------------------------------- 2 | ## Licensed to the Apache Software Foundation (ASF) under one or more 3 | ## contributor license agreements. See the NOTICE file distributed with 4 | ## this work for additional information regarding copyright ownership. 5 | ## The ASF licenses this file to You under the Apache License, Version 2.0 6 | ## (the "License"); you may not use this file except in compliance with 7 | ## the License. You may obtain a copy of the License at 8 | ## 9 | ## http://www.apache.org/licenses/LICENSE-2.0 10 | ## 11 | ## Unless required by applicable law or agreed to in writing, software 12 | ## distributed under the License is distributed on an "AS IS" BASIS, 13 | ## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | ## See the License for the specific language governing permissions and 15 | ## limitations under the License. 16 | ## --------------------------------------------------------------------------- 17 | # 18 | # Quarkus 19 | # 20 | quarkus.banner.enabled = false 21 | quarkus.log.file.enable = true 22 | 23 | # Default Datasource 24 | quarkus.datasource.db-kind=h2 25 | quarkus.datasource.jdbc.max-size=8 26 | quarkus.datasource.jdbc.transactions=xa 27 | 28 | # Production Datasource 29 | #%prod.quarkus.datasource.db-kind=mysql 30 | #%prod.quarkus.datasource.username=admin 31 | #%prod.quarkus.datasource.password=admin 32 | #%prod.quarkus.datasource.jdbc.url=jdbc:mysql://localhost:3306/testdb 33 | #%prod.quarkus.datasource.jdbc.transactions=xa 34 | 35 | # Hibernate ORM 36 | quarkus.hibernate-orm.database.generation=drop-and-create 37 | #%prod.quarkus.hibernate-orm.database.generation=none 38 | 39 | # Quarkus Narayana JTA 40 | quarkus.transaction-manager.object-store.directory=target/narayana 41 | quarkus.transaction-manager.enable-recovery=true 42 | 43 | # Camel 44 | camel.rest.context-path=/api 45 | -------------------------------------------------------------------------------- /jta-jpa/src/test/java/org/acme/JtaIT.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package org.acme; 18 | 19 | import io.quarkus.test.junit.QuarkusIntegrationTest; 20 | 21 | @QuarkusIntegrationTest 22 | public class JtaIT extends JtaTest { 23 | } 24 | -------------------------------------------------------------------------------- /jta-jpa/src/test/java/org/acme/JtaTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package org.acme; 18 | 19 | import java.util.UUID; 20 | 21 | import io.quarkus.test.common.QuarkusTestResource; 22 | import io.quarkus.test.h2.H2DatabaseTestResource; 23 | import io.quarkus.test.junit.QuarkusTest; 24 | import org.junit.jupiter.api.Test; 25 | 26 | import static io.restassured.RestAssured.given; 27 | import static org.hamcrest.Matchers.is; 28 | 29 | @QuarkusTest 30 | @QuarkusTestResource(H2DatabaseTestResource.class) 31 | public class JtaTest { 32 | @Test 33 | public void testXA() { 34 | String body = UUID.randomUUID().toString(); 35 | 36 | given().when().post("/api/messages/" + body) 37 | .then() 38 | .statusCode(200); 39 | 40 | given() 41 | .when().get("/api/messages") 42 | .then() 43 | .statusCode(200) 44 | .body(is("[{message=" + body + "}]")); 45 | } 46 | 47 | @Test 48 | public void testRollback() { 49 | String result = given().when().get("/api/messages").asString(); 50 | 51 | given().when().post("/api/messages/fail") 52 | .then() 53 | .statusCode(500); 54 | 55 | given().when().get("/api/messages") 56 | .then() 57 | .statusCode(200) 58 | .body(is(result)); 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /kafka/kubefiles/secret-example.yml: -------------------------------------------------------------------------------- 1 | # 2 | # Licensed to the Apache Software Foundation (ASF) under one or more 3 | # contributor license agreements. See the NOTICE file distributed with 4 | # this work for additional information regarding copyright ownership. 5 | # The ASF licenses this file to You under the Apache License, Version 2.0 6 | # (the "License"); you may not use this file except in compliance with 7 | # the License. You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | # 17 | 18 | apiVersion: v1 19 | kind: Secret 20 | metadata: 21 | name: camel-kafka 22 | namespace: test 23 | type: Opaque 24 | stringData: 25 | brokers: "" 26 | id: "" 27 | secret: "" 28 | token: "" -------------------------------------------------------------------------------- /kafka/src/main/docker/Dockerfile.native: -------------------------------------------------------------------------------- 1 | ## --------------------------------------------------------------------------- 2 | ## Licensed to the Apache Software Foundation (ASF) under one or more 3 | ## contributor license agreements. See the NOTICE file distributed with 4 | ## this work for additional information regarding copyright ownership. 5 | ## The ASF licenses this file to You under the Apache License, Version 2.0 6 | ## (the "License"); you may not use this file except in compliance with 7 | ## the License. You may obtain a copy of the License at 8 | ## 9 | ## http://www.apache.org/licenses/LICENSE-2.0 10 | ## 11 | ## Unless required by applicable law or agreed to in writing, software 12 | ## distributed under the License is distributed on an "AS IS" BASIS, 13 | ## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | ## See the License for the specific language governing permissions and 15 | ## limitations under the License. 16 | ## --------------------------------------------------------------------------- 17 | #### 18 | # This Dockerfile is used in order to build a container that runs the Quarkus application in native (no JVM) mode. 19 | # 20 | # Before building the container image run: 21 | # 22 | # mvn package -Dnative 23 | # 24 | # Then, build the image with: 25 | # 26 | # docker build -f src/main/docker/Dockerfile.native -t quarkus/kafka . 27 | # 28 | # Then run the container using: 29 | # 30 | # docker run -i --rm -p 8080:8080 quarkus/kafka 31 | # 32 | # The ` registry.access.redhat.com/ubi9/ubi-minimal:9.5` base image is based on UBI 9. 33 | # To use UBI 8, switch to `quay.io/ubi8/ubi-minimal:8.10`. 34 | ### 35 | FROM registry.access.redhat.com/ubi9/ubi-minimal:9.5 36 | WORKDIR /work/ 37 | RUN chown 1001 /work \ 38 | && chmod "g+rwX" /work \ 39 | && chown 1001:root /work 40 | COPY --chown=1001:root --chmod=0755 target/*-runner /work/application 41 | 42 | EXPOSE 8080 43 | USER 1001 44 | 45 | ENTRYPOINT ["./application", "-Dquarkus.http.host=0.0.0.0"] 46 | -------------------------------------------------------------------------------- /kafka/src/main/docker/Dockerfile.native-micro: -------------------------------------------------------------------------------- 1 | ## --------------------------------------------------------------------------- 2 | ## Licensed to the Apache Software Foundation (ASF) under one or more 3 | ## contributor license agreements. See the NOTICE file distributed with 4 | ## this work for additional information regarding copyright ownership. 5 | ## The ASF licenses this file to You under the Apache License, Version 2.0 6 | ## (the "License"); you may not use this file except in compliance with 7 | ## the License. You may obtain a copy of the License at 8 | ## 9 | ## http://www.apache.org/licenses/LICENSE-2.0 10 | ## 11 | ## Unless required by applicable law or agreed to in writing, software 12 | ## distributed under the License is distributed on an "AS IS" BASIS, 13 | ## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | ## See the License for the specific language governing permissions and 15 | ## limitations under the License. 16 | ## --------------------------------------------------------------------------- 17 | #### 18 | # This Dockerfile is used in order to build a container that runs the Quarkus application in native (no JVM) mode. 19 | # It uses a micro base image, tuned for Quarkus native executables. 20 | # It reduces the size of the resulting container image. 21 | # Check https://quarkus.io/guides/quarkus-runtime-base-image for further information about this image. 22 | # 23 | # Before building the container image run: 24 | # 25 | # mvn package -Dnative 26 | # 27 | # Then, build the image with: 28 | # 29 | # docker build -f src/main/docker/Dockerfile.native-micro -t quarkus/kafka . 30 | # 31 | # Then run the container using: 32 | # 33 | # docker run -i --rm -p 8080:8080 quarkus/kafka 34 | # 35 | # The `quay.io/quarkus/ubi9-quarkus-micro-image:2.0` base image is based on UBI 9. 36 | # To use UBI 8, switch to `quay.io/quarkus/quarkus-micro-image:2.0`. 37 | ### 38 | FROM quay.io/quarkus/ubi9-quarkus-micro-image:2.0 39 | WORKDIR /work/ 40 | RUN chown 1001 /work \ 41 | && chmod "g+rwX" /work \ 42 | && chown 1001:root /work 43 | COPY --chown=1001:root --chmod=0755 target/*-runner /work/application 44 | 45 | EXPOSE 8080 46 | USER 1001 47 | 48 | ENTRYPOINT ["./application", "-Dquarkus.http.host=0.0.0.0"] 49 | -------------------------------------------------------------------------------- /kafka/src/main/java/org/acme/kafka/KafkaResource.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package org.acme.kafka; 18 | 19 | import jakarta.enterprise.context.ApplicationScoped; 20 | import jakarta.inject.Inject; 21 | import jakarta.ws.rs.GET; 22 | import jakarta.ws.rs.Path; 23 | import org.apache.camel.ConsumerTemplate; 24 | 25 | @ApplicationScoped 26 | @Path("example") 27 | public class KafkaResource { 28 | 29 | @Inject 30 | ConsumerTemplate consumerTemplate; 31 | 32 | @GET 33 | public String getMessages() { 34 | return consumerTemplate.receiveBody("seda:kafka-messages", 10000, String.class); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /kafka/src/main/java/org/acme/kafka/Routes.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package org.acme.kafka; 18 | 19 | import jakarta.enterprise.context.ApplicationScoped; 20 | import org.apache.camel.builder.RouteBuilder; 21 | 22 | @ApplicationScoped 23 | public class Routes extends RouteBuilder { 24 | 25 | @Override 26 | public void configure() throws Exception { 27 | // produces messages to kafka 28 | from("timer:foo?period={{timer.period}}&delay={{timer.delay}}") 29 | .routeId("FromTimer2Kafka") 30 | .setBody().simple("Message #${exchangeProperty.CamelTimerCounter}") 31 | .to("kafka:{{kafka.topic.name}}") 32 | .log("Message correctly sent to the topic! : \"${body}\" "); 33 | 34 | // kafka consumer 35 | from("kafka:{{kafka.topic.name}}") 36 | .routeId("FromKafka2Seda") 37 | .log("Received : \"${body}\"") 38 | .to("seda:kafka-messages"); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /kafka/src/test/java/org/acme/kafka/KafkaIT.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package org.acme.kafka; 18 | 19 | import io.quarkus.test.junit.QuarkusIntegrationTest; 20 | 21 | @QuarkusIntegrationTest 22 | public class KafkaIT extends KafkaTest { 23 | } 24 | -------------------------------------------------------------------------------- /kafka/src/test/java/org/acme/kafka/KafkaTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package org.acme.kafka; 18 | 19 | import java.util.concurrent.TimeUnit; 20 | 21 | import io.quarkus.test.junit.QuarkusTest; 22 | import io.restassured.RestAssured; 23 | import org.junit.jupiter.api.Test; 24 | 25 | import static org.awaitility.Awaitility.await; 26 | 27 | @QuarkusTest 28 | public class KafkaTest { 29 | 30 | @Test 31 | public void testKafka() { 32 | await().atMost(10, TimeUnit.SECONDS).until(() -> { 33 | String message = RestAssured.get("/example").asString(); 34 | return message != null && message.contains("Message #"); 35 | }); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /kamelet-chucknorris/src/main/java/org/acme/kamelet/MyRoute.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package org.acme.kamelet; 18 | 19 | import org.apache.camel.builder.RouteBuilder; 20 | 21 | public class MyRoute extends RouteBuilder { 22 | 23 | @Override 24 | public void configure() { 25 | from("kamelet:chuck-norris-source") 26 | .log("${body}"); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /kamelet-chucknorris/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | ## --------------------------------------------------------------------------- 2 | ## Licensed to the Apache Software Foundation (ASF) under one or more 3 | ## contributor license agreements. See the NOTICE file distributed with 4 | ## this work for additional information regarding copyright ownership. 5 | ## The ASF licenses this file to You under the Apache License, Version 2.0 6 | ## (the "License"); you may not use this file except in compliance with 7 | ## the License. You may obtain a copy of the License at 8 | ## 9 | ## http://www.apache.org/licenses/LICENSE-2.0 10 | ## 11 | ## Unless required by applicable law or agreed to in writing, software 12 | ## distributed under the License is distributed on an "AS IS" BASIS, 13 | ## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | ## See the License for the specific language governing permissions and 15 | ## limitations under the License. 16 | ## --------------------------------------------------------------------------- 17 | 18 | # 19 | # Quarkus 20 | # 21 | quarkus.banner.enabled = false 22 | quarkus.log.file.enable = true 23 | 24 | # Camel 25 | quarkus.camel.kamelet.identifiers = chuck-norris-source 26 | 27 | chuck.norris.api.url = https://api.chucknorris.io/jokes/random?category=dev 28 | -------------------------------------------------------------------------------- /kamelet-chucknorris/src/test/java/org/acme/kamelet/ChuckNorrisIT.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package org.acme.kamelet; 18 | 19 | import io.quarkus.test.junit.QuarkusIntegrationTest; 20 | 21 | @QuarkusIntegrationTest 22 | class ChuckNorrisIT extends ChuckNorrisTest { 23 | 24 | } 25 | -------------------------------------------------------------------------------- /kamelet-chucknorris/src/test/java/org/acme/kamelet/ChuckNorrisTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package org.acme.kamelet; 18 | 19 | import java.nio.file.Files; 20 | import java.nio.file.Paths; 21 | import java.util.List; 22 | import java.util.concurrent.TimeUnit; 23 | 24 | import io.quarkus.test.common.QuarkusTestResource; 25 | import io.quarkus.test.junit.QuarkusTest; 26 | import org.junit.jupiter.api.Test; 27 | 28 | import static org.awaitility.Awaitility.await; 29 | 30 | @QuarkusTestResource(ChuckNorrisTestResource.class) 31 | @QuarkusTest 32 | public class ChuckNorrisTest { 33 | @Test 34 | public void chuckNorrisKamelet() { 35 | await().atMost(10L, TimeUnit.SECONDS).pollDelay(1, TimeUnit.SECONDS).until(() -> { 36 | List log = Files.readAllLines(Paths.get("target/quarkus.log")); 37 | return log.stream().anyMatch(line -> line.matches(".*timer.*Chuck.*")); 38 | }); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /kamelet-chucknorris/src/test/resources/mappings/chuck-norris-joke.json: -------------------------------------------------------------------------------- 1 | { 2 | "id" : "abdc7f6a-5112-44ff-97ac-a0710e342d03", 3 | "name" : "", 4 | "request" : { 5 | "url" : "/", 6 | "method" : "GET" 7 | }, 8 | "response" : { 9 | "status" : 200, 10 | "body" : "{\"categories\":[\"dev\"],\"created_at\":\"2020-01-05 13:42:19.104863\",\"icon_url\":\"https://api.chucknorris.io/img/avatar/chuck-norris.png\",\"id\":\"ye0_hnd3rgq68e_pfvsqqg\",\"updated_at\":\"2020-01-05 13:42:19.104863\",\"url\":\"https://api.chucknorris.io/jokes/ye0_hnd3rgq68e_pfvsqqg\",\"value\":\"Chuck Norris can instantiate an abstract class.\"}", 11 | "headers" : { 12 | "CF-RAY" : "8c205cf67a8f6545-LHR", 13 | "Server" : "cloudflare", 14 | "cf-cache-status" : "DYNAMIC", 15 | "Reporting-Endpoints" : "heroku-nel=https://nel.heroku.com/reports?ts=1726148990&sid=812dcc77-0bd0-43b1-a5f1-b25750382959&s=DWG%2F2oGJJCxAbiAESBX%2BG7xgCh%2B01nvzoILE2LS0jo4%3D", 16 | "Date" : "Thu, 12 Sep 2024 13:49:50 GMT", 17 | "Via" : "1.1 vegur", 18 | "Nel" : "{\"report_to\":\"heroku-nel\",\"max_age\":3600,\"success_fraction\":0.005,\"failure_fraction\":0.05,\"response_headers\":[\"Via\"]}", 19 | "Report-To" : "{\"group\":\"heroku-nel\",\"max_age\":3600,\"endpoints\":[{\"url\":\"https://nel.heroku.com/reports?ts=1726148990&sid=812dcc77-0bd0-43b1-a5f1-b25750382959&s=DWG%2F2oGJJCxAbiAESBX%2BG7xgCh%2B01nvzoILE2LS0jo4%3D\"}]}", 20 | "Vary" : [ "Origin", "Access-Control-Request-Method", "Access-Control-Request-Headers" ], 21 | "alt-svc" : "h3=\":443\"; ma=86400", 22 | "Content-Type" : "application/json" 23 | } 24 | }, 25 | "uuid" : "abdc7f6a-5112-44ff-97ac-a0710e342d03", 26 | "persistent" : true, 27 | "insertionIndex" : 1 28 | } -------------------------------------------------------------------------------- /license-properties-headerdefinition.xml: -------------------------------------------------------------------------------- 1 | 2 | 20 | 21 | 22 | ## --------------------------------------------------------------------------- 23 | ## 24 | ## --------------------------------------------------------------------------- 25 | ^## -+$ 26 | ^## -+$ 27 | true 28 | true 29 | 30 | 31 | -------------------------------------------------------------------------------- /message-bridge/.gitignore: -------------------------------------------------------------------------------- 1 | # IBM MQ client files 2 | FFDC/ 3 | mqjms* 4 | -------------------------------------------------------------------------------- /mvnw-for-each.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # Iterates over all available examples and calls mvnd with the specified arguments for each of them 4 | 5 | set -x 6 | set -e 7 | 8 | pwd="$(pwd)" 9 | for moduleDir in $(ls -d */) 10 | do 11 | if [ -f "${pwd}/${moduleDir}/pom.xml" ]; then 12 | cd "${pwd}/${moduleDir}" 13 | ../mvnw "$@" 14 | cp ../eclipse-formatter-config.xml . 15 | fi 16 | done 17 | 18 | cd "${pwd}" 19 | ./mvnw org.l2x6.cq:cq-maven-plugin:0.33.0:update-examples-json 20 | 21 | -------------------------------------------------------------------------------- /observability/docker-compose.yml: -------------------------------------------------------------------------------- 1 | # 2 | # Licensed to the Apache Software Foundation (ASF) under one or more 3 | # contributor license agreements. See the NOTICE file distributed with 4 | # this work for additional information regarding copyright ownership. 5 | # The ASF licenses this file to You under the Apache License, Version 2.0 6 | # (the "License"); you may not use this file except in compliance with 7 | # the License. You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | # 17 | 18 | version: "2" 19 | services: 20 | 21 | # Jaeger 22 | jaeger-all-in-one: 23 | image: jaegertracing/all-in-one:1.57 24 | ports: 25 | - "16686:16686" 26 | - "4317:4317" 27 | environment: 28 | - COLLECTOR_OTLP_ENABLED=true -------------------------------------------------------------------------------- /observability/src/main/java/org/acme/observability/TimerRoute.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package org.acme.observability; 18 | 19 | import java.util.concurrent.atomic.AtomicInteger; 20 | 21 | import org.apache.camel.builder.RouteBuilder; 22 | 23 | public class TimerRoute extends RouteBuilder { 24 | 25 | AtomicInteger counter = new AtomicInteger(); 26 | 27 | @Override 28 | public void configure() throws Exception { 29 | from("timer:greeting?delay=10000&period=10000") 30 | .setBody(exchange -> "Custom body #" + counter.incrementAndGet()) 31 | .log("Generated from timer: ${body}") 32 | .bean("timerCounter", "count") 33 | .to("http://{{greeting-app.service.host}}:{{greeting-app.service.port}}/greeting"); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /observability/src/main/java/org/acme/observability/health/camel/CustomLivenessCheck.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package org.acme.observability.health.camel; 18 | 19 | import java.util.Map; 20 | import java.util.concurrent.atomic.AtomicInteger; 21 | 22 | import org.apache.camel.health.HealthCheckResultBuilder; 23 | import org.apache.camel.impl.health.AbstractHealthCheck; 24 | 25 | /** 26 | * A simple custom liveness check which utilizes the Camel Health API. 27 | * 28 | * The check status is recorded as DOWN on every 5th invocation. 29 | */ 30 | public class CustomLivenessCheck extends AbstractHealthCheck { 31 | 32 | AtomicInteger hitCount = new AtomicInteger(); 33 | 34 | public CustomLivenessCheck() { 35 | super("custom-liveness-check"); 36 | } 37 | 38 | @Override 39 | protected void doCall(HealthCheckResultBuilder builder, Map options) { 40 | int hits = hitCount.incrementAndGet(); 41 | 42 | // Flag the check as DOWN on every 5th invocation (but not on Kubernetes), else it is UP 43 | if (hits % 5 == 0 && System.getenv("KUBERNETES_PORT") == null) { 44 | builder.down(); 45 | } else { 46 | builder.up(); 47 | } 48 | } 49 | 50 | @Override 51 | public boolean isReadiness() { 52 | return false; 53 | } 54 | 55 | @Override 56 | public boolean isLiveness() { 57 | return true; 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /observability/src/main/java/org/acme/observability/health/camel/CustomReadinessCheck.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package org.acme.observability.health.camel; 18 | 19 | import java.util.Map; 20 | 21 | import org.apache.camel.health.HealthCheckResultBuilder; 22 | import org.apache.camel.impl.health.AbstractHealthCheck; 23 | 24 | /** 25 | * A simple custom liveness check which utilizes the Camel Health API. 26 | */ 27 | public class CustomReadinessCheck extends AbstractHealthCheck { 28 | 29 | public CustomReadinessCheck() { 30 | super("custom-readiness-check"); 31 | } 32 | 33 | @Override 34 | protected void doCall(HealthCheckResultBuilder builder, Map options) { 35 | builder.up(); 36 | } 37 | 38 | @Override 39 | public boolean isLiveness() { 40 | return false; 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /observability/src/main/java/org/acme/observability/health/microprofile/CamelUptimeHealthCheck.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package org.acme.observability.health.microprofile; 18 | 19 | import jakarta.enterprise.context.ApplicationScoped; 20 | import jakarta.inject.Inject; 21 | import org.apache.camel.CamelContext; 22 | import org.eclipse.microprofile.health.HealthCheck; 23 | import org.eclipse.microprofile.health.HealthCheckResponse; 24 | import org.eclipse.microprofile.health.HealthCheckResponseBuilder; 25 | import org.eclipse.microprofile.health.Readiness; 26 | 27 | /** 28 | * A simple CamelContext uptime readiness check which implements the MicroProfile Health API. 29 | */ 30 | @Readiness 31 | @ApplicationScoped 32 | public class CamelUptimeHealthCheck implements HealthCheck { 33 | 34 | @Inject 35 | CamelContext camelContext; 36 | 37 | @Override 38 | public HealthCheckResponse call() { 39 | HealthCheckResponseBuilder builder = HealthCheckResponse.named("Uptime readiness check"); 40 | 41 | if (camelContext.getUptime().toMillis() > 0) { 42 | builder.up(); 43 | } else { 44 | builder.down(); 45 | } 46 | 47 | return builder.build(); 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /observability/src/main/java/org/acme/observability/micrometer/TimerCounter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package org.acme.observability.micrometer; 18 | 19 | import io.micrometer.core.annotation.Counted; 20 | import jakarta.enterprise.context.ApplicationScoped; 21 | import jakarta.inject.Named; 22 | 23 | @ApplicationScoped 24 | @Named("timerCounter") 25 | public class TimerCounter { 26 | 27 | @Counted(value = "org.acme.observability.timer-counter", extraTags = { "purpose", "example" }) 28 | public void count() { 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /observability/src/test/java/org/acme/observability/ObservabilityIT.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package org.acme.observability; 18 | 19 | import io.quarkus.test.junit.QuarkusIntegrationTest; 20 | 21 | @QuarkusIntegrationTest 22 | public class ObservabilityIT extends ObservabilityTest { 23 | 24 | // Is run in prod mode 25 | @Override 26 | protected String getManagementPrefix() { 27 | return "http://localhost:9876"; 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /openapi-contract-first/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | ## --------------------------------------------------------------------------- 2 | ## Licensed to the Apache Software Foundation (ASF) under one or more 3 | ## contributor license agreements. See the NOTICE file distributed with 4 | ## this work for additional information regarding copyright ownership. 5 | ## The ASF licenses this file to You under the Apache License, Version 2.0 6 | ## (the "License"); you may not use this file except in compliance with 7 | ## the License. You may obtain a copy of the License at 8 | ## 9 | ## http://www.apache.org/licenses/LICENSE-2.0 10 | ## 11 | ## Unless required by applicable law or agreed to in writing, software 12 | ## distributed under the License is distributed on an "AS IS" BASIS, 13 | ## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | ## See the License for the specific language governing permissions and 15 | ## limitations under the License. 16 | ## --------------------------------------------------------------------------- 17 | quarkus.native.resources.includes=petstore.json 18 | quarkus.camel.openapi.codegen.model-package=sample.petstore.model 19 | quarkus.camel.openapi.codegen.not-null-jackson=true 20 | camel.rest.bindingMode=json 21 | camel.rest.bindingPackageScan=${quarkus.camel.openapi.codegen.model-package} 22 | 23 | pet.name=Tony the tiger 24 | -------------------------------------------------------------------------------- /openapi-contract-first/src/test/java/org/acme/examples/openapi/contract/first/ExamplesOpenapiContractFirstIT.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package org.acme.examples.openapi.contract.first; 18 | 19 | import io.quarkus.test.junit.QuarkusIntegrationTest; 20 | 21 | @QuarkusIntegrationTest 22 | class ExamplesOpenapiContractFirstIT extends ExamplesOpenapiContractFirstTest { 23 | 24 | } 25 | -------------------------------------------------------------------------------- /openapi-contract-first/src/test/java/org/acme/examples/openapi/contract/first/ExamplesOpenapiContractFirstTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package org.acme.examples.openapi.contract.first; 18 | 19 | import io.quarkus.test.junit.QuarkusTest; 20 | import io.restassured.RestAssured; 21 | import io.restassured.http.ContentType; 22 | import org.junit.jupiter.api.Test; 23 | 24 | import static org.hamcrest.Matchers.is; 25 | 26 | @QuarkusTest 27 | class ExamplesOpenapiContractFirstTest { 28 | 29 | @Test 30 | public void test() { 31 | RestAssured.given() 32 | .contentType(ContentType.JSON) 33 | .get("/api/v3/pet/123") 34 | .then() 35 | .statusCode(200) 36 | .body("id", is(123), "name", is("Tony the tiger"), "status", is("available")); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /platform-http-security-keycloak/docs/modules/ROOT/attachments/examples.json: -------------------------------------------------------------------------------- 1 | [] -------------------------------------------------------------------------------- /platform-http-security-keycloak/src/main/java/org/acme/http/security/Routes.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package org.acme.http.security; 18 | 19 | import org.apache.camel.builder.RouteBuilder; 20 | 21 | public class Routes extends RouteBuilder { 22 | 23 | @Override 24 | public void configure() { 25 | from("platform-http:/not-secured") 26 | .setBody(constant("Not secured endpoint!")); 27 | from("platform-http:/secured/authenticated") 28 | .setBody(simple("You are authenticated user so you can perform this action.")); 29 | from("platform-http:/secured/authorized") 30 | .setBody(simple("You are authorized to perform sensitive operation.")); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /platform-http-security-keycloak/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | ## --------------------------------------------------------------------------- 2 | ## Licensed to the Apache Software Foundation (ASF) under one or more 3 | ## contributor license agreements. See the NOTICE file distributed with 4 | ## this work for additional information regarding copyright ownership. 5 | ## The ASF licenses this file to You under the Apache License, Version 2.0 6 | ## (the "License"); you may not use this file except in compliance with 7 | ## the License. You may obtain a copy of the License at 8 | ## 9 | ## http://www.apache.org/licenses/LICENSE-2.0 10 | ## 11 | ## Unless required by applicable law or agreed to in writing, software 12 | ## distributed under the License is distributed on an "AS IS" BASIS, 13 | ## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | ## See the License for the specific language governing permissions and 15 | ## limitations under the License. 16 | ## --------------------------------------------------------------------------- 17 | # Quarkus 18 | quarkus.banner.enabled = false 19 | quarkus.log.file.enable = true 20 | 21 | # Security 22 | %prod.quarkus.oidc.auth-server-url=http://localhost:8082/realms/quarkus 23 | quarkus.oidc.client-id=quarkus-client 24 | quarkus.oidc.application-type=service 25 | cq.role.admin=admin-role 26 | quarkus.http.auth.permission.authenticated.paths=/secured/authenticated 27 | quarkus.http.auth.permission.authenticated.policy=authenticated 28 | quarkus.http.auth.policy.authorized.roles-allowed=${cq.role.admin} 29 | quarkus.http.auth.permission.authorized.paths=/secured/authorized 30 | quarkus.http.auth.permission.authorized.policy=authorized 31 | 32 | # Dev services 33 | quarkus.keycloak.devservices.port=8082 34 | quarkus.keycloak.devservices.users.boss=boss-pass 35 | quarkus.keycloak.devservices.roles.boss=${cq.role.admin} 36 | quarkus.keycloak.devservices.users.employee=employee-pass 37 | quarkus.keycloak.devservices.roles.employee=regular-role 38 | 39 | # Camel 40 | camel.context.name = quarkus-camel-example-platform-http-security 41 | 42 | # Kubernetes 43 | quarkus.kubernetes.env.secrets=quarkus-keycloak 44 | 45 | # OpenShift 46 | quarkus.openshift.env.secrets=quarkus-keycloak 47 | -------------------------------------------------------------------------------- /platform-http-security-keycloak/src/test/java/org/acme/timer/log/BearerTokenAuthenticationTestIT.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package org.acme.timer.log; 18 | 19 | import io.quarkus.test.junit.QuarkusIntegrationTest; 20 | 21 | @QuarkusIntegrationTest 22 | class BearerTokenAuthenticationTestIT extends BearerTokenAuthenticationTest { 23 | 24 | } 25 | -------------------------------------------------------------------------------- /rest-json/src/main/java/org/acme/rest/json/Fruit.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package org.acme.rest.json; 18 | 19 | import java.util.Objects; 20 | 21 | import io.quarkus.runtime.annotations.RegisterForReflection; 22 | 23 | /** 24 | * A REST entity representing a fruit. 25 | */ 26 | @RegisterForReflection // Lets Quarkus register this class for reflection during the native build 27 | public class Fruit { 28 | private String name; 29 | private String description; 30 | 31 | public Fruit() { 32 | } 33 | 34 | public Fruit(String name, String description) { 35 | this.name = name; 36 | this.description = description; 37 | } 38 | 39 | public String getName() { 40 | return name; 41 | } 42 | 43 | public void setName(String name) { 44 | this.name = name; 45 | } 46 | 47 | public String getDescription() { 48 | return description; 49 | } 50 | 51 | public void setDescription(String description) { 52 | this.description = description; 53 | } 54 | 55 | @Override 56 | public boolean equals(Object obj) { 57 | if (!(obj instanceof Fruit)) { 58 | return false; 59 | } 60 | 61 | Fruit other = (Fruit) obj; 62 | 63 | return Objects.equals(other.name, this.name); 64 | } 65 | 66 | @Override 67 | public int hashCode() { 68 | return Objects.hash(this.name); 69 | } 70 | } 71 | -------------------------------------------------------------------------------- /rest-json/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | ## --------------------------------------------------------------------------- 2 | ## Licensed to the Apache Software Foundation (ASF) under one or more 3 | ## contributor license agreements. See the NOTICE file distributed with 4 | ## this work for additional information regarding copyright ownership. 5 | ## The ASF licenses this file to You under the Apache License, Version 2.0 6 | ## (the "License"); you may not use this file except in compliance with 7 | ## the License. You may obtain a copy of the License at 8 | ## 9 | ## http://www.apache.org/licenses/LICENSE-2.0 10 | ## 11 | ## Unless required by applicable law or agreed to in writing, software 12 | ## distributed under the License is distributed on an "AS IS" BASIS, 13 | ## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | ## See the License for the specific language governing permissions and 15 | ## limitations under the License. 16 | ## --------------------------------------------------------------------------- 17 | # 18 | # Quarkus 19 | # 20 | 21 | quarkus.banner.enabled = false 22 | 23 | # 24 | # Camel 25 | # 26 | camel.context.name = quarkus-camel-example-rest-json 27 | 28 | -------------------------------------------------------------------------------- /rest-json/src/test/java/org/acme/rest/json/RestJsonIT.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package org.acme.rest.json; 18 | 19 | import io.quarkus.test.junit.QuarkusIntegrationTest; 20 | 21 | /** 22 | * Native mode tests. In the native mode, the same tests will be executed as in the JVM mode because this class extends 23 | * {@link RestJsonTest}. 24 | */ 25 | @QuarkusIntegrationTest 26 | public class RestJsonIT extends RestJsonTest { 27 | } 28 | -------------------------------------------------------------------------------- /saga/doc-resources/compesate-diagram.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apache/camel-quarkus-examples/3ab40d177967cd808f87611e686054db2f918c48/saga/doc-resources/compesate-diagram.png -------------------------------------------------------------------------------- /saga/doc-resources/logic-diagram.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apache/camel-quarkus-examples/3ab40d177967cd808f87611e686054db2f918c48/saga/doc-resources/logic-diagram.png -------------------------------------------------------------------------------- /saga/doc-resources/tech-diagram.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apache/camel-quarkus-examples/3ab40d177967cd808f87611e686054db2f918c48/saga/doc-resources/tech-diagram.png -------------------------------------------------------------------------------- /saga/run.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # Licensed to the Apache Software Foundation (ASF) under one or more 4 | # contributor license agreements. See the NOTICE file distributed with 5 | # this work for additional information regarding copyright ownership. 6 | # The ASF licenses this file to You under the Apache License, Version 2.0 7 | # (the "License"); you may not use this file except in compliance with 8 | # the License. You may obtain a copy of the License at 9 | # 10 | # http://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, software 13 | # distributed under the License is distributed on an "AS IS" BASIS, 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | # See the License for the specific language governing permissions and 16 | # limitations under the License. 17 | # 18 | 19 | 20 | echo running payment service 21 | mvn -f saga-payment-service/pom.xml clean quarkus:dev -Dquarkus.http.port=8081 > payment.log 2>&1 & 22 | echo "$!" > payment.pid 23 | 24 | echo running flight service 25 | mvn -f saga-flight-service/pom.xml clean quarkus:dev -Dquarkus.http.port=8082 > flight.log 2>&1 & 26 | echo "$!" > flight.pid 27 | 28 | echo running train service 29 | mvn -f saga-train-service/pom.xml clean quarkus:dev -Dquarkus.http.port=8083 > train.log 2>&1 & 30 | echo "$!" > train.pid 31 | 32 | echo running saga application 33 | mvn -f saga-app/pom.xml clean quarkus:dev -Dquarkus.http.port=8084 > app.log 2>&1 & 34 | echo "$!" > app.pid 35 | -------------------------------------------------------------------------------- /saga/saga-app/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 20 | 21 | 22 | 4.0.0 23 | 24 | 25 | camel-quarkus-examples-saga 26 | org.apache.camel.quarkus.examples 27 | 3.24.0-SNAPSHOT 28 | 29 | 30 | camel-quarkus-example-saga-app 31 | Camel Quarkus :: Examples :: Saga :: App 32 | Main application starting SAGA 33 | 34 | 35 | -------------------------------------------------------------------------------- /saga/saga-app/src/main/resources/application.yml: -------------------------------------------------------------------------------- 1 | # 2 | # Licensed to the Apache Software Foundation (ASF) under one or more 3 | # contributor license agreements. See the NOTICE file distributed with 4 | # this work for additional information regarding copyright ownership. 5 | # The ASF licenses this file to You under the Apache License, Version 2.0 6 | # (the "License"); you may not use this file except in compliance with 7 | # the License. You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | # 17 | 18 | quarkus: 19 | artemis: 20 | url: tcp://localhost:61616 21 | username: admin 22 | password: admin 23 | camel: 24 | rest: 25 | context-path: /api 26 | component: 27 | jms: 28 | test-connection-on-startup: true 29 | concurrent-consumers: 5 30 | lra: 31 | enabled: true 32 | coordinator-url: http://localhost:8080 33 | local-participant-url: http://localhost:${quarkus.http.port}/api 34 | example: 35 | services: 36 | train: saga-train-service 37 | flight: saga-flight-service 38 | logging: 39 | level: 40 | root: INFO 41 | org.apache.camel: INFO 42 | org.apache.camel.processor.errorhandler.DefaultErrorHandler: OFF 43 | org.apache.camel.component.jms.EndpointMessageListener: OFF 44 | org.apache.camel.component.jms.reply.QueueReplyManager: OFF 45 | 46 | -------------------------------------------------------------------------------- /saga/saga-flight-service/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 20 | 21 | 22 | 4.0.0 23 | 24 | 25 | camel-quarkus-examples-saga 26 | org.apache.camel.quarkus.examples 27 | 3.24.0-SNAPSHOT 28 | 29 | 30 | camel-quarkus-example-saga-flight 31 | Camel Quarkus :: Examples :: Saga :: Flight Service 32 | Flight Service 33 | 34 | 35 | -------------------------------------------------------------------------------- /saga/saga-flight-service/src/main/java/org/apache/camel/example/saga/FlightRoute.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package org.apache.camel.example.saga; 18 | 19 | import org.apache.camel.builder.RouteBuilder; 20 | import org.apache.camel.model.SagaPropagation; 21 | 22 | public class FlightRoute extends RouteBuilder { 23 | 24 | @Override 25 | public void configure() throws Exception { 26 | from("jms:queue:{{example.services.flight}}") 27 | .saga() 28 | .propagation(SagaPropagation.MANDATORY) 29 | .option("id", header("id")) 30 | .compensation("direct:cancelPurchase") 31 | .log("Buying flight #${header.id}") 32 | .to("jms:queue:{{example.services.payment}}?exchangePattern=InOut" + 33 | "&replyTo={{example.services.payment}}.flight.reply") 34 | .log("Payment for flight #${header.id} done with transaction ${body}") 35 | .end(); 36 | 37 | from("direct:cancelPurchase") 38 | .log("Flight purchase #${header.id} has been cancelled due to payment failure"); 39 | } 40 | 41 | } 42 | -------------------------------------------------------------------------------- /saga/saga-flight-service/src/main/resources/application.yml: -------------------------------------------------------------------------------- 1 | # 2 | # Licensed to the Apache Software Foundation (ASF) under one or more 3 | # contributor license agreements. See the NOTICE file distributed with 4 | # this work for additional information regarding copyright ownership. 5 | # The ASF licenses this file to You under the Apache License, Version 2.0 6 | # (the "License"); you may not use this file except in compliance with 7 | # the License. You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | # 17 | 18 | quarkus: 19 | artemis: 20 | url: tcp://localhost:61616 21 | username: admin 22 | password: admin 23 | camel: 24 | rest: 25 | context-path: /api 26 | component: 27 | jms: 28 | test-connection-on-startup: true 29 | concurrent-consumers: 5 30 | lra: 31 | enabled: true 32 | coordinator-url: http://localhost:8080 33 | local-participant-url: http://localhost:${quarkus.http.port}/api 34 | example: 35 | services: 36 | flight: saga-flight-service 37 | payment: saga-payment-service 38 | logging: 39 | level: 40 | root: INFO 41 | org.apache.camel: INFO 42 | org.apache.camel.processor.errorhandler.DefaultErrorHandler: OFF 43 | org.apache.camel.component.jms.EndpointMessageListener: OFF 44 | org.apache.camel.component.jms.reply.QueueReplyManager: OFF 45 | 46 | -------------------------------------------------------------------------------- /saga/saga-payment-service/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 20 | 21 | 22 | 4.0.0 23 | 24 | 25 | camel-quarkus-examples-saga 26 | org.apache.camel.quarkus.examples 27 | 3.24.0-SNAPSHOT 28 | 29 | 30 | camel-quarkus-example-saga-payment 31 | Camel Quarkus :: Examples :: Saga :: Payment Service 32 | Payment Service 33 | 34 | 35 | -------------------------------------------------------------------------------- /saga/saga-payment-service/src/main/resources/application.yml: -------------------------------------------------------------------------------- 1 | # 2 | # Licensed to the Apache Software Foundation (ASF) under one or more 3 | # contributor license agreements. See the NOTICE file distributed with 4 | # this work for additional information regarding copyright ownership. 5 | # The ASF licenses this file to You under the Apache License, Version 2.0 6 | # (the "License"); you may not use this file except in compliance with 7 | # the License. You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | # 17 | 18 | quarkus: 19 | artemis: 20 | url: tcp://localhost:61616 21 | username: admin 22 | password: admin 23 | camel: 24 | rest: 25 | context-path: /api 26 | component: 27 | jms: 28 | test-connection-on-startup: true 29 | concurrent-consumers: 5 30 | lra: 31 | enabled: true 32 | coordinator-url: http://localhost:8080 33 | local-participant-url: http://localhost:${quarkus.http.port}/api 34 | example: 35 | services: 36 | payment: saga-payment-service 37 | logging: 38 | level: 39 | root: INFO 40 | org.apache.camel: INFO 41 | org.apache.camel.processor.errorhandler.DefaultErrorHandler: OFF 42 | org.apache.camel.component.jms.EndpointMessageListener: OFF 43 | org.apache.camel.component.jms.reply.QueueReplyManager: OFF 44 | 45 | -------------------------------------------------------------------------------- /saga/saga-train-service/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 20 | 21 | 22 | 4.0.0 23 | 24 | 25 | camel-quarkus-examples-saga 26 | org.apache.camel.quarkus.examples 27 | 3.24.0-SNAPSHOT 28 | 29 | 30 | camel-quarkus-example-saga-train 31 | Camel Quarkus :: Examples :: Saga :: Train Service 32 | Train Service 33 | 34 | 35 | -------------------------------------------------------------------------------- /saga/saga-train-service/src/main/java/org/apache/camel/example/saga/TrainRoute.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package org.apache.camel.example.saga; 18 | 19 | import org.apache.camel.builder.RouteBuilder; 20 | import org.apache.camel.model.SagaPropagation; 21 | 22 | public class TrainRoute extends RouteBuilder { 23 | 24 | @Override 25 | public void configure() throws Exception { 26 | from("jms:queue:{{example.services.train}}") 27 | .saga() 28 | .propagation(SagaPropagation.MANDATORY) 29 | .option("id", header("id")) 30 | .compensation("direct:cancelPurchase") 31 | .log("Buying train #${header.id}") 32 | .to("jms:queue:{{example.services.payment}}?exchangePattern=InOut" + 33 | "&replyTo={{example.services.payment}}.train.reply") 34 | .log("Payment for train #${header.id} done with transaction ${body}") 35 | .end(); 36 | 37 | from("direct:cancelPurchase") 38 | .log("Train purchase #${header.id} has been cancelled due to payment failure"); 39 | } 40 | 41 | } 42 | -------------------------------------------------------------------------------- /saga/saga-train-service/src/main/resources/application.yml: -------------------------------------------------------------------------------- 1 | # 2 | # Licensed to the Apache Software Foundation (ASF) under one or more 3 | # contributor license agreements. See the NOTICE file distributed with 4 | # this work for additional information regarding copyright ownership. 5 | # The ASF licenses this file to You under the Apache License, Version 2.0 6 | # (the "License"); you may not use this file except in compliance with 7 | # the License. You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | # 17 | 18 | quarkus: 19 | artemis: 20 | url: tcp://localhost:61616 21 | username: admin 22 | password: admin 23 | camel: 24 | rest: 25 | context-path: /api 26 | component: 27 | jms: 28 | test-connection-on-startup: true 29 | concurrent-consumers: 5 30 | lra: 31 | enabled: true 32 | coordinator-url: http://localhost:8080 33 | local-participant-url: http://localhost:${quarkus.http.port}/api 34 | example: 35 | services: 36 | train: saga-train-service 37 | payment: saga-payment-service 38 | logging: 39 | level: 40 | root: INFO 41 | org.apache.camel: INFO 42 | org.apache.camel.processor.errorhandler.DefaultErrorHandler: OFF 43 | org.apache.camel.component.jms.EndpointMessageListener: OFF 44 | org.apache.camel.component.jms.reply.QueueReplyManager: OFF 45 | 46 | -------------------------------------------------------------------------------- /saga/stop.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # Licensed to the Apache Software Foundation (ASF) under one or more 4 | # contributor license agreements. See the NOTICE file distributed with 5 | # this work for additional information regarding copyright ownership. 6 | # The ASF licenses this file to You under the Apache License, Version 2.0 7 | # (the "License"); you may not use this file except in compliance with 8 | # the License. You may obtain a copy of the License at 9 | # 10 | # http://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, software 13 | # distributed under the License is distributed on an "AS IS" BASIS, 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | # See the License for the specific language governing permissions and 16 | # limitations under the License. 17 | # 18 | 19 | 20 | echo stopping saga application 21 | kill $(cat app.pid) && rm app.pid 22 | 23 | echo stopping flight service 24 | kill $(cat flight.pid) && rm flight.pid 25 | 26 | echo stopping train service 27 | kill $(cat train.pid) && rm train.pid 28 | 29 | echo stopping payment service 30 | kill $(cat payment.pid) && rm payment.pid 31 | -------------------------------------------------------------------------------- /timer-log-main/src/main/java/org/acme/main/TimerRoute.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package org.acme.main; 18 | 19 | import jakarta.enterprise.context.ApplicationScoped; 20 | import jakarta.inject.Inject; 21 | import jakarta.inject.Named; 22 | import org.apache.camel.builder.RouteBuilder; 23 | 24 | /** 25 | * A simple {@link RouteBuilder}. 26 | */ 27 | @ApplicationScoped 28 | public class TimerRoute extends RouteBuilder { 29 | @Inject 30 | @Named("greeting") 31 | String greeting; 32 | 33 | @Override 34 | public void configure() throws Exception { 35 | from("timer:foo?period={{timer.period}}") 36 | .setBody().constant(greeting) 37 | .to("log:example"); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /timer-log-main/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | ## --------------------------------------------------------------------------- 2 | ## Licensed to the Apache Software Foundation (ASF) under one or more 3 | ## contributor license agreements. See the NOTICE file distributed with 4 | ## this work for additional information regarding copyright ownership. 5 | ## The ASF licenses this file to You under the Apache License, Version 2.0 6 | ## (the "License"); you may not use this file except in compliance with 7 | ## the License. You may obtain a copy of the License at 8 | ## 9 | ## http://www.apache.org/licenses/LICENSE-2.0 10 | ## 11 | ## Unless required by applicable law or agreed to in writing, software 12 | ## distributed under the License is distributed on an "AS IS" BASIS, 13 | ## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | ## See the License for the specific language governing permissions and 15 | ## limitations under the License. 16 | ## --------------------------------------------------------------------------- 17 | 18 | # 19 | # Quarkus 20 | # 21 | quarkus.banner.enabled = false 22 | quarkus.log.file.enable = true 23 | 24 | # 25 | # Camel - Main 26 | # 27 | camel.main.duration-hit-exit-code = 15 28 | 29 | # 30 | # Camel - Components 31 | # 32 | camel.component.log.exchange-formatter = #class:org.apache.camel.support.processor.DefaultExchangeFormatter 33 | camel.component.log.exchange-formatter.show-exchange-pattern = false 34 | camel.component.log.exchange-formatter.show-body-type = false 35 | 36 | # 37 | # Integration 38 | # 39 | timer.period = 5000 40 | -------------------------------------------------------------------------------- /timer-log-main/src/test/java/org/acme/main/TimerLogMainIT.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package org.acme.main; 18 | 19 | import io.quarkus.test.junit.main.QuarkusMainIntegrationTest; 20 | 21 | @QuarkusMainIntegrationTest 22 | class TimerLogMainIT extends TimerLogMainTest { 23 | 24 | } 25 | -------------------------------------------------------------------------------- /timer-log-main/src/test/java/org/acme/main/TimerLogMainTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package org.acme.main; 18 | 19 | import io.quarkus.test.junit.main.Launch; 20 | import io.quarkus.test.junit.main.LaunchResult; 21 | import io.quarkus.test.junit.main.QuarkusMainTest; 22 | import org.junit.jupiter.api.Assertions; 23 | import org.junit.jupiter.api.Test; 24 | 25 | @QuarkusMainTest 26 | public class TimerLogMainTest { 27 | @Test 28 | @Launch(value = { "Greetings", "2" }, exitCode = 15) 29 | public void testTimerLogMain(LaunchResult result) { 30 | Assertions.assertTrue(result.getOutput().contains("Body: Greetings")); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /timer-log/src/main/java/org/acme/timer/log/GreetingBean.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package org.acme.timer.log; 18 | 19 | import io.quarkus.runtime.annotations.RegisterForReflection; 20 | import jakarta.enterprise.context.ApplicationScoped; 21 | import jakarta.inject.Named; 22 | import org.eclipse.microprofile.config.inject.ConfigProperty; 23 | 24 | @ApplicationScoped 25 | @Named("greeting") 26 | @RegisterForReflection(fields = false) 27 | public class GreetingBean { 28 | 29 | @ConfigProperty(name = "greeting.message") 30 | String message; 31 | 32 | public String greet() { 33 | return message; 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /timer-log/src/main/java/org/acme/timer/log/TimerRoute.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package org.acme.timer.log; 18 | 19 | import jakarta.enterprise.context.ApplicationScoped; 20 | import org.apache.camel.builder.RouteBuilder; 21 | 22 | @ApplicationScoped 23 | public class TimerRoute extends RouteBuilder { 24 | 25 | @Override 26 | public void configure() throws Exception { 27 | from("timer:foo?period={{timer.period}}") 28 | .bean("greeting", "greet") 29 | .to("log:timer"); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /timer-log/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | ## --------------------------------------------------------------------------- 2 | ## Licensed to the Apache Software Foundation (ASF) under one or more 3 | ## contributor license agreements. See the NOTICE file distributed with 4 | ## this work for additional information regarding copyright ownership. 5 | ## The ASF licenses this file to You under the Apache License, Version 2.0 6 | ## (the "License"); you may not use this file except in compliance with 7 | ## the License. You may obtain a copy of the License at 8 | ## 9 | ## http://www.apache.org/licenses/LICENSE-2.0 10 | ## 11 | ## Unless required by applicable law or agreed to in writing, software 12 | ## distributed under the License is distributed on an "AS IS" BASIS, 13 | ## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | ## See the License for the specific language governing permissions and 15 | ## limitations under the License. 16 | ## --------------------------------------------------------------------------- 17 | # 18 | # Quarkus 19 | # 20 | quarkus.banner.enabled = false 21 | quarkus.log.file.enable = true 22 | 23 | # 24 | # Camel 25 | # 26 | camel.context.name = quarkus-camel-example-timer-log 27 | 28 | timer.period=1s 29 | greeting.message=Hello World! 30 | -------------------------------------------------------------------------------- /timer-log/src/main/resources/camel/my-routes.yaml: -------------------------------------------------------------------------------- 1 | # 2 | # Licensed to the Apache Software Foundation (ASF) under one or more 3 | # contributor license agreements. See the NOTICE file distributed with 4 | # this work for additional information regarding copyright ownership. 5 | # The ASF licenses this file to You under the Apache License, Version 2.0 6 | # (the "License"); you may not use this file except in compliance with 7 | # the License. You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | # 17 | 18 | - route: 19 | id: "yaml-route" 20 | from: 21 | uri: "timer:from-yaml?period={{timer.period}}" 22 | steps: 23 | - to: "bean:greeting?method=greet" 24 | - to: "log:timer-yaml" 25 | -------------------------------------------------------------------------------- /timer-log/src/test/java/org/acme/timer/log/TimerLogIT.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package org.acme.timer.log; 18 | 19 | import io.quarkus.test.junit.QuarkusIntegrationTest; 20 | 21 | @QuarkusIntegrationTest 22 | class TimerLogIT extends TimerLogTest { 23 | 24 | } 25 | -------------------------------------------------------------------------------- /timer-log/src/test/java/org/acme/timer/log/TimerLogTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package org.acme.timer.log; 18 | 19 | import java.nio.file.Files; 20 | import java.nio.file.Paths; 21 | import java.util.concurrent.TimeUnit; 22 | 23 | import io.quarkus.test.junit.QuarkusTest; 24 | import org.eclipse.microprofile.config.Config; 25 | import org.eclipse.microprofile.config.ConfigProvider; 26 | import org.junit.jupiter.api.Test; 27 | 28 | import static org.awaitility.Awaitility.await; 29 | 30 | @QuarkusTest 31 | public class TimerLogTest { 32 | 33 | @Test 34 | public void testTimerLog() { 35 | Config config = ConfigProvider.getConfig(); 36 | String greeting = config.getValue("greeting.message", String.class); 37 | 38 | await().atMost(10L, TimeUnit.SECONDS).pollDelay(1, TimeUnit.SECONDS).until(() -> { 39 | String log = Files.readString(Paths.get("target/quarkus.log")); 40 | return log.contains("Java DSL: " + greeting) && log.contains("YAML DSL: " + greeting); 41 | }); 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /vertx-websocket-chat/src/main/java/org/acme/websocket/ChatMessage.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package org.acme.websocket; 18 | 19 | import io.quarkus.runtime.annotations.RegisterForReflection; 20 | 21 | @RegisterForReflection(fields = false) 22 | public class ChatMessage { 23 | private String messageContent; 24 | private String recipientName; 25 | 26 | public String getMessageContent() { 27 | return messageContent; 28 | } 29 | 30 | public void setMessageContent(String messageContent) { 31 | this.messageContent = messageContent; 32 | } 33 | 34 | public String getRecipientName() { 35 | return recipientName; 36 | } 37 | 38 | public void setRecipientName(String recipientName) { 39 | this.recipientName = recipientName; 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /vertx-websocket-chat/src/main/java/org/acme/websocket/SessionManager.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package org.acme.websocket; 18 | 19 | import java.util.Map; 20 | import java.util.concurrent.ConcurrentHashMap; 21 | 22 | import io.quarkus.runtime.annotations.RegisterForReflection; 23 | import jakarta.inject.Singleton; 24 | 25 | @Singleton 26 | @RegisterForReflection 27 | public class SessionManager { 28 | private final Map SESSIONS = new ConcurrentHashMap<>(); 29 | 30 | public void startSession(String userName, String connectionKey) { 31 | SESSIONS.put(userName.toLowerCase(), connectionKey); 32 | } 33 | 34 | public void endSession(String userName) { 35 | SESSIONS.remove(userName.toLowerCase()); 36 | } 37 | 38 | public String getConnectionKey(String userName) { 39 | return SESSIONS.get(userName.toLowerCase()); 40 | } 41 | 42 | public boolean isSessionExists(String userName) { 43 | return SESSIONS.containsKey(userName.toLowerCase()); 44 | } 45 | 46 | public String[] getAllConnectedUsers() { 47 | String[] connectedUsers = new String[SESSIONS.size()]; 48 | int index = 0; 49 | for (String userName : SESSIONS.keySet()) { 50 | connectedUsers[index++] = userName; 51 | } 52 | return connectedUsers; 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /vertx-websocket-chat/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | ## --------------------------------------------------------------------------- 2 | ## Licensed to the Apache Software Foundation (ASF) under one or more 3 | ## contributor license agreements. See the NOTICE file distributed with 4 | ## this work for additional information regarding copyright ownership. 5 | ## The ASF licenses this file to You under the Apache License, Version 2.0 6 | ## (the "License"); you may not use this file except in compliance with 7 | ## the License. You may obtain a copy of the License at 8 | ## 9 | ## http://www.apache.org/licenses/LICENSE-2.0 10 | ## 11 | ## Unless required by applicable law or agreed to in writing, software 12 | ## distributed under the License is distributed on an "AS IS" BASIS, 13 | ## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | ## See the License for the specific language governing permissions and 15 | ## limitations under the License. 16 | ## --------------------------------------------------------------------------- 17 | # 18 | # Quarkus 19 | # 20 | quarkus.banner.enabled = false 21 | -------------------------------------------------------------------------------- /vertx-websocket-chat/src/test/java/org/acme/websocket/WebSocketRoutesIT.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package org.acme.websocket; 18 | 19 | import io.quarkus.test.junit.QuarkusIntegrationTest; 20 | 21 | @QuarkusIntegrationTest 22 | public class WebSocketRoutesIT extends WebSocketRoutesTest { 23 | } 24 | --------------------------------------------------------------------------------