Red Hat build of Apache Camel for Quarkus Reference Red Hat build of Apache Camel 4.8 Red Hat build of Apache Camel for Quarkus provided by Red Hat

Commands:
<dependency> <groupId>org.apache.camel.quarkus</groupId> <artifactId>camel-quarkus-amqp</artifactId> </dependency>
<dependency> <groupId>io.quarkiverse.messaginghub</groupId> <artifactId>quarkus-pooled-jms</artifactId> </dependency>
quarkus.qpid-jms.wrap=true
@RegisterForReflection(targets = { IllegalStateException.class, MyCustomException.class }, serialization = true)
<dependency> <groupId>org.apache.camel.quarkus</groupId> <artifactId>camel-quarkus-attachments</artifactId> </dependency>
<dependency> <groupId>org.apache.camel.quarkus</groupId> <artifactId>camel-quarkus-avro</artifactId> </dependency>
<plugin> <groupId>io.quarkus</groupId> <artifactId>quarkus-maven-plugin</artifactId> <executions> <execution> <id>generate-code-and-build</id> <goals> <goal>generate-code</goal> <goal>build</goal> </goals> </execution> </executions> </plugin>
<dependency> <groupId>org.apache.camel.quarkus</groupId> <artifactId>camel-quarkus-aws2-cw</artifactId> </dependency>
<dependency> <groupId>org.apache.camel.quarkus</groupId> <artifactId>camel-quarkus-aws2-ddb</artifactId> </dependency>
quarkus.dynamodb.sync-client.type=apache
import jakarta.enterprise.context.ApplicationScoped; import io.quarkus.arc.Unremovable; import software.amazon.awssdk.services.dynamodb.DynamoDbClient; @ApplicationScoped @Unremovable class UnremovableDynamoDbClient { @Inject DynamoDbClient dynamoDbClient; }
<dependency> <groupId>org.apache.camel.quarkus</groupId> <artifactId>camel-quarkus-aws2-kinesis</artifactId> </dependency>
<dependency> <groupId>org.apache.camel.quarkus</groupId> <artifactId>camel-quarkus-aws2-lambda</artifactId> </dependency>
<dependency> <groupId>org.apache.camel.quarkus</groupId> <artifactId>camel-quarkus-aws2-s3</artifactId> </dependency>
quarkus.s3.sync-client.type=apache
import jakarta.enterprise.context.ApplicationScoped; import io.quarkus.arc.Unremovable; import software.amazon.awssdk.services.s3.S3Client; @ApplicationScoped @Unremovable class UnremovableS3Client { @Inject S3Client s3Client; }
<dependency> <groupId>org.apache.camel.quarkus</groupId> <artifactId>camel-quarkus-aws2-sns</artifactId> </dependency>
quarkus.sns.sync-client.type=apache
import jakarta.enterprise.context.ApplicationScoped; import io.quarkus.arc.Unremovable; import software.amazon.awssdk.services.sns.SnsClient; @ApplicationScoped @Unremovable class UnremovableSnsClient { @Inject SnsClient snsClient; }
<dependency> <groupId>org.apache.camel.quarkus</groupId> <artifactId>camel-quarkus-aws2-sqs</artifactId> </dependency>
quarkus.sqs.sync-client.type=apache
import jakarta.enterprise.context.ApplicationScoped; import io.quarkus.arc.Unremovable; import software.amazon.awssdk.services.sqs.SqsClient; @ApplicationScoped @Unremovable class UnremovableSqsClient { @Inject SqsClient sqsClient; }
<dependency> <groupId>org.apache.camel.quarkus</groupId> <artifactId>camel-quarkus-azure-eventhubs</artifactId> </dependency>
<dependency> <groupId>io.quarkus</groupId> <artifactId>quarkus-micrometer</artifactId> </dependency>
<dependency> <groupId>org.apache.camel.quarkus</groupId> <artifactId>camel-quarkus-azure-key-vault</artifactId> </dependency>
<dependency> <groupId>org.apache.camel.quarkus</groupId> <artifactId>camel-quarkus-azure-servicebus</artifactId> </dependency>
<dependency> <groupId>org.apache.camel.quarkus</groupId> <artifactId>camel-quarkus-azure-storage-blob</artifactId> </dependency>
<dependency> <groupId>io.quarkus</groupId> <artifactId>quarkus-micrometer</artifactId> </dependency>
<dependency> <groupId>org.apache.camel.quarkus</groupId> <artifactId>camel-quarkus-azure-storage-queue</artifactId> </dependency>
<dependency> <groupId>io.quarkus</groupId> <artifactId>quarkus-micrometer</artifactId> </dependency>
<dependency> <groupId>org.apache.camel.quarkus</groupId> <artifactId>camel-quarkus-bean-validator</artifactId> </dependency>
@RegisterForReflection public interface OptionalChecks { }
<dependency> <groupId>org.apache.camel.quarkus</groupId> <artifactId>camel-quarkus-bean</artifactId> </dependency>
<dependency> <groupId>org.apache.camel.quarkus</groupId> <artifactId>camel-quarkus-beanio</artifactId> </dependency>
<dependency> <groupId>org.apache.camel.quarkus</groupId> <artifactId>camel-quarkus-bindy</artifactId> </dependency>
BindyDataFormat dataFormat = new BindyDataFormat(); dataFormat.setLocale("ar");
<dependency> <groupId>org.apache.camel.quarkus</groupId> <artifactId>camel-quarkus-browse</artifactId> </dependency>
<dependency> <groupId>org.apache.camel.quarkus</groupId> <artifactId>camel-quarkus-cassandraql</artifactId> </dependency>
<dependency> <groupId>org.apache.camel.quarkus</groupId> <artifactId>camel-quarkus-cli-connector</artifactId> </dependency>
<dependency> <groupId>org.apache.camel.quarkus</groupId> <artifactId>camel-quarkus-controlbus</artifactId> </dependency>
<dependency> <groupId>org.apache.camel.quarkus</groupId> <artifactId>camel-quarkus-management</artifactId> </dependency>
<dependency> <groupId>org.apache.camel.quarkus</groupId> <artifactId>camel-quarkus-bean</artifactId> </dependency>
template.sendBody( "controlbus:language:simple", "USD{camelContext.getRouteController().stopRoute('foo')}" );
quarkus.camel.native.reflection.include-patterns = org.apache.camel.spi.RouteController
<dependency> <groupId>org.apache.camel.quarkus</groupId> <artifactId>camel-quarkus-core</artifactId> </dependency>
--- simple("USD{body.address}") ---
--- simple("USD{body} is 'java.nio.ByteBuffer'") ---
from("direct:start").transform().simple("resource:classpath:mysimple.txt");
quarkus.native.resources.includes = mysimple.txt
--- camel.beans.customBeanWithSetterInjection = #class:org.example.PropertiesCustomBeanWithSetterInjection camel.beans.customBeanWithSetterInjection.counter = 123 ---
<dependency> <groupId>org.apache.camel.quarkus</groupId> <artifactId>camel-quarkus-cron</artifactId> </dependency>
<dependency> <groupId>org.apache.camel.quarkus</groupId> <artifactId>camel-quarkus-crypto</artifactId> </dependency>
<dependency> <groupId>org.bouncycastle</groupId> <artifactId>bc-fips</artifactId> </dependency> <dependency> <groupId>io.quarkus</groupId> <artifactId>quarkus-security</artifactId> </dependency>
quarkus.security.security-providers=BCFIPS
<dependency> <groupId>org.apache.camel.quarkus</groupId> <artifactId>camel-quarkus-cxf-soap</artifactId> </dependency>
import org.apache.camel.builder.RouteBuilder; import jakarta.enterprise.context.ApplicationScoped; import jakarta.enterprise.context.SessionScoped; import jakarta.enterprise.inject.Produces; import jakarta.inject.Named; @ApplicationScoped public class CxfSoapClientRoutes extends RouteBuilder { @Override public void configure() { /* You can either configure the client inline */ from("direct:cxfUriParamsClient") .to("cxf://http://localhost:8082/calculator-ws?wsdlURL=wsdl/CalculatorService.wsdl&dataFormat=POJO&serviceClass=org.foo.CalculatorService"); /* Or you can use a named bean produced below by beanClient() method */ from("direct:cxfBeanClient") .to("cxf:bean:beanClient?dataFormat=POJO"); } @Produces @SessionScoped @Named CxfEndpoint beanClient() { final CxfEndpoint result = new CxfEndpoint(); result.setServiceClass(CalculatorService.class); result.setAddress("http://localhost:8082/calculator-ws"); result.setWsdlURL("wsdl/CalculatorService.wsdl"); // a resource in the class path return result; } }
import jakarta.jws.WebMethod; import jakarta.jws.WebService; @WebService(targetNamespace = CalculatorService.TARGET_NS) 1 public interface CalculatorService { public static final String TARGET_NS = "http://acme.org/wscalculator/Calculator"; @WebMethod 2 public int add(int intA, int intB); @WebMethod 3 public int subtract(int intA, int intB); @WebMethod 4 public int divide(int intA, int intB); @WebMethod 5 public int multiply(int intA, int intB); }
docker run -p 8082:8080 quay.io/l2x6/calculator-ws:1.2
import org.apache.camel.builder.RouteBuilder; import jakarta.enterprise.context.ApplicationScoped; import jakarta.enterprise.inject.Produces; import jakarta.inject.Named; @ApplicationScoped public class CxfSoapRoutes extends RouteBuilder { @Override public void configure() { /* A CXF Service configured through a CDI bean */ from("cxf:bean:helloBeanEndpoint") .setBody().simple("Hello USD{body} from CXF service"); /* A CXF Service configured through Camel URI parameters */ from("cxf:///hello-inline?wsdlURL=wsdl/HelloService.wsdl&serviceClass=org.foo.HelloService") .setBody().simple("Hello USD{body} from CXF service"); } @Produces @ApplicationScoped @Named CxfEndpoint helloBeanEndpoint() { final CxfEndpoint result = new CxfEndpoint(); result.setServiceClass(HelloService.class); result.setAddress("/hello-bean"); result.setWsdlURL("wsdl/HelloService.wsdl"); return result; } }
quarkus.cxf.path = /soap-services
import org.apache.camel.builder.RouteBuilder; import org.apache.cxf.ext.logging.LoggingFeature; import jakarta.enterprise.context.ApplicationScoped; import jakarta.enterprise.context.SessionScoped; import jakarta.enterprise.inject.Produces; import jakarta.inject.Named; @ApplicationScoped public class MyBeans { @Produces @ApplicationScoped @Named("prettyLoggingFeature") public LoggingFeature prettyLoggingFeature() { final LoggingFeature result = new LoggingFeature(); result.setPrettyLogging(true); return result; } @Inject @Named("prettyLoggingFeature") LoggingFeature prettyLoggingFeature; @Produces @SessionScoped @Named CxfEndpoint cxfBeanClient() { final CxfEndpoint result = new CxfEndpoint(); result.setServiceClass(CalculatorService.class); result.setAddress("https://acme.org/calculator"); result.setWsdlURL("wsdl/CalculatorService.wsdl"); result.getFeatures().add(prettyLoggingFeature); return result; } @Produces @ApplicationScoped @Named CxfEndpoint helloBeanEndpoint() { final CxfEndpoint result = new CxfEndpoint(); result.setServiceClass(HelloService.class); result.setAddress("/hello-bean"); result.setWsdlURL("wsdl/HelloService.wsdl"); result.getFeatures().add(prettyLoggingFeature); return result; } }
quarkus.cxf.codegen.wsdl2java.additional-params = -validate
<dependency> <groupId>org.apache.camel.quarkus</groupId> <artifactId>camel-quarkus-dataformat</artifactId> </dependency>
<dependency> <groupId>org.apache.camel.quarkus</groupId> <artifactId>camel-quarkus-dataset</artifactId> </dependency>
<dependency> <groupId>org.apache.camel.quarkus</groupId> <artifactId>camel-quarkus-direct</artifactId> </dependency>
<dependency> <groupId>org.apache.camel.quarkus</groupId> <artifactId>camel-quarkus-elasticsearch</artifactId> </dependency>
<dependency> <groupId>org.apache.camel.quarkus</groupId> <artifactId>camel-quarkus-elasticsearch-rest-client</artifactId> </dependency>
<dependency> <groupId>org.apache.camel.quarkus</groupId> <artifactId>camel-quarkus-fhir</artifactId> </dependency>
<dependency> <groupId>org.apache.camel.quarkus</groupId> <artifactId>camel-quarkus-file</artifactId> </dependency>
<dependency> <groupId>org.apache.camel.quarkus</groupId> <artifactId>camel-quarkus-file-cluster-service</artifactId> </dependency>
from("master:ns:timer:test?period=100").log("Timer invoked on a single JVM at a time");
quarkus.camel.cluster.file.root = target/cluster-folder-where-lock-file-will-be-held
<dependency> <groupId>org.apache.camel.quarkus</groupId> <artifactId>camel-quarkus-flink</artifactId> </dependency>
<dependency> <groupId>org.apache.camel.quarkus</groupId> <artifactId>camel-quarkus-ftp</artifactId> </dependency>
<dependency> <groupId>org.apache.camel.quarkus</groupId> <artifactId>camel-quarkus-google-bigquery</artifactId> </dependency>
<dependency> <groupId>org.apache.camel.quarkus</groupId> <artifactId>camel-quarkus-google-pubsub</artifactId> </dependency>
<dependency> <groupId>org.apache.camel.quarkus</groupId> <artifactId>camel-quarkus-google-secret-manager</artifactId> </dependency>
<dependency> <groupId>org.apache.camel.quarkus</groupId> <artifactId>camel-quarkus-graphql</artifactId> </dependency>
<dependency> <groupId>org.apache.camel.quarkus</groupId> <artifactId>camel-quarkus-grpc</artifactId> </dependency>
<build> <plugins> <plugin> <groupId>io.quarkus</groupId> <artifactId>quarkus-maven-plugin</artifactId> <version>USD{quarkus.platform.version}</version> <extensions>true</extensions> <executions> <execution> <goals> <goal>build</goal> <goal>generate-code</goal> <goal>generate-code-tests</goal> </goals> </execution> </executions> </plugin> </plugins> </build>
quarkus.camel.grpc.codegen.scan-for-proto=org.my.groupId1:my-artifact-id-1,org.my.groupId2:my-artifact-id-2
quarkus.camel.grpc.codegen.scan-for-proto-includes."<groupId>\:<artifactId>"=foo/**,bar/**,baz/a-proto.proto quarkus.camel.grpc.codegen.scan-for-proto-excludes."<groupId>\:<artifactId>"=foo/private/**,baz/another-proto.proto
quarkus.native.resources.includes = certs/*.pem,certs.*.key
<dependency> <groupId>org.apache.camel.quarkus</groupId> <artifactId>camel-quarkus-gson</artifactId> </dependency>
<dependency> <groupId>org.apache.camel.quarkus</groupId> <artifactId>camel-quarkus-hl7</artifactId> </dependency>
<dependency> <groupId>org.apache.camel.quarkus</groupId> <artifactId>camel-quarkus-http</artifactId> </dependency>
<dependency> <groupId>org.apache.camel.quarkus</groupId> <artifactId>camel-quarkus-hashicorp-vault</artifactId> </dependency>
@RegisterForReflection public class Credentials { private String username; private String password; // Getters & setters }
from("direct:createSecret") .process(new Processor() { @Override public void process(Exchange exchange) { Credentials credentials = new Credentials(); credentials.setUsername("admin"); credentials.setPassword("2s3cr3t"); exchange.getMessage().setBody(credentials); } }) .to("hashicorp-vault:secret?operation=createSecret&token=my-token&secretPath=my-secret")
<dependency> <groupId>org.apache.camel.quarkus</groupId> <artifactId>camel-quarkus-infinispan</artifactId> </dependency>
quarkus.infinispan-client.devservices.create-default-client=false
dev / test mode Quarkus Infinispan Dev services configuration quarkus.infinispan-client.devservices.port=31222 %dev,test.camel.component.infinispan.username=admin %dev,test.camel.component.infinispan.password=password %dev,test.camel.component.infinispan.secure=true %dev,test.camel.component.infinispan.hosts=localhost:31222 Example prod mode configuration %prod.camel.component.infinispan.username=prod-user %prod.camel.component.infinispan.password=prod-password %prod.camel.component.infinispan.secure=true %prod.camel.component.infinispan.hosts=infinispan.prod:11222
public class Routes extends RouteBuilder { // Injects the default unnamed RemoteCacheManager @Inject RemoteCacheManager cacheManager; // If configured, injects an optional named RemoteCacheManager @Inject @InfinispanClientName("myNamedClient") RemoteCacheManager namedCacheManager; @Override public void configure() { // Route configuration here } }
<dependency> <groupId>org.apache.camel.quarkus</groupId> <artifactId>camel-quarkus-jackson-avro</artifactId> </dependency>
<dependency> <groupId>org.apache.camel.quarkus</groupId> <artifactId>camel-quarkus-jackson-protobuf</artifactId> </dependency>
<dependency> <groupId>org.apache.camel.quarkus</groupId> <artifactId>camel-quarkus-jackson</artifactId> </dependency>
import com.fasterxml.jackson.databind.ObjectMapper; import org.apache.camel.builder.RouteBuilder; import org.apache.camel.component.jackson.JacksonDataFormat; public class Routes extends RouteBuilder { public void configure() { ObjectMapper mapper = new ObjectMapper(); JacksonDataFormat dataFormat = new JacksonDataFormat(); dataFormat.setObjectMapper(mapper); // Use the dataFormat instance in a route definition from("direct:my-direct").marshal(dataFormat) } }
import org.apache.camel.builder.RouteBuilder; import org.apache.camel.component.jackson.JacksonDataFormat; public class Routes extends RouteBuilder { public void configure() { JacksonDataFormat dataFormat = new JacksonDataFormat(); // Make JacksonDataFormat discover the Quarkus Jackson `ObjectMapper` from the Camel registry dataFormat.setAutoDiscoverObjectMapper(true); // Use the dataFormat instance in a route definition from("direct:my-direct").marshal(dataFormat) } }
import org.apache.camel.builder.RouteBuilder; @ApplicationScoped public class Routes extends RouteBuilder { public void configure() { restConfiguration().dataFormatProperty("autoDiscoverObjectMapper", "true"); // REST definition follows } }
import com.fasterxml.jackson.databind.ObjectMapper; import io.quarkus.jackson.ObjectMapperCustomizer; @Singleton public class RegisterCustomModuleCustomizer implements ObjectMapperCustomizer { public void customize(ObjectMapper mapper) { mapper.registerModule(new CustomModule()); } }
import com.fasterxml.jackson.databind.ObjectMapper; import org.apache.camel.builder.RouteBuilder; import org.apache.camel.component.jackson.JacksonDataFormat; @ApplicationScoped public class Routes extends RouteBuilder { @Inject ObjectMapper mapper; public void configure() { JacksonDataFormat dataFormat = new JacksonDataFormat(); dataFormat.setObjectMapper(mapper); // Use the dataFormat instance in a route definition from("direct:my-direct").marshal(dataFormat) } }
<dependency> <groupId>org.apache.camel.quarkus</groupId> <artifactId>camel-quarkus-jacksonxml</artifactId> </dependency>
<dependency> <groupId>org.apache.camel.quarkus</groupId> <artifactId>camel-quarkus-jasypt</artifactId> </dependency>
jbang org.apache.camel:camel-jasypt:{camel-version} -c encrypt -p secret-password -i "Some secret content"
my.secret = ENC(BoDSRQfdBME4V/AcugPOkaR+IcyKufGz)
public class MySecureRoute extends RouteBuilder { @Override public void configure() { from("timer:tick?period=5s") .to("{{my.secret}}"); } }
@ApplicationScoped public class MySecureRoute extends RouteBuilder { @ConfigInject("my.secret") String mySecret; @Override public void configure() { from("timer:tick?period=5s") .to(mySecret); } }
package org.acme; import org.apache.camel.quarkus.component.jasypt.JasyptConfigurationCustomizer; import org.jasypt.encryption.pbe.config.EnvironmentStringPBEConfig; import org.jasypt.iv.RandomIvGenerator; import org.jasypt.salt.RandomSaltGenerator; public class JasyptConfigurationCustomizer implements JasyptConfigurationCustomizer { public void customize(EnvironmentStringPBEConfig config) { // Custom algorithms config.setAlgorithm("PBEWithHmacSHA256AndAES_256"); config.setSaltGenerator(new RandomSaltGenerator("PKCS11")); config.setIvGenerator(new RandomIvGenerator("PKCS11")); // Additional customizations } }
quarkus.camel.jasypt.configuration-customizer-class-name = org.acme.MyJasyptEncryptorCustomizer
import org.apache.camel.CamelContext; import org.apache.camel.component.jasypt.JasyptPropertiesParser; import org.apache.camel.component.properties.PropertiesComponent; public class MySecureRoute extends RouteBuilder { @Override public void configure() { JasyptPropertiesParser jasypt = new JasyptPropertiesParser(); jasypt.setPassword("secret"); PropertiesComponent component = (PropertiesComponent) getContext().getPropertiesComponent(); jasypt.setPropertiesComponent(component); component.setPropertiesParser(jasypt); from("timer:tick?period=5s") .to("{{my.secret}}"); } }
<dependency> <groupId>org.apache.camel.quarkus</groupId> <artifactId>camel-quarkus-java-joor-dsl</artifactId> </dependency>
<dependency> <groupId>org.apache.camel.quarkus</groupId> <artifactId>camel-quarkus-jaxb</artifactId> </dependency>
<dependency> <groupId>org.apache.camel.quarkus</groupId> <artifactId>camel-quarkus-jdbc</artifactId> </dependency>
quarkus.datasource.camel.db-kind=postgresql quarkus.datasource.camel.username=your-username quarkus.datasource.camel.password=your-password quarkus.datasource.camel.jdbc.url=jdbc:postgresql://localhost:5432/your-database quarkus.datasource.camel.jdbc.max-size=16
<dependency> <groupId>org.apache.camel.quarkus</groupId> <artifactId>camel-quarkus-jira</artifactId> </dependency>
<dependency> <groupId>org.apache.camel.quarkus</groupId> <artifactId>camel-quarkus-jms</artifactId> </dependency>
quarkus.pooled-jms.max-connections = 8
<dependency> <groupId>io.quarkiverse.messaginghub</groupId> <artifactId>quarkus-pooled-jms</artifactId> </dependency>
<dependency> <groupId>io.quarkus</groupId> <artifactId>quarkus-narayana-jta</artifactId> </dependency>
quarkus.pooled-jms.transaction=xa quarkus.transaction-manager.enable-recovery=true
@Produces public ConnectionFactory createXAConnectionFactory(PooledJmsWrapper wrapper) { MQXAConnectionFactory mq = new MQXAConnectionFactory(); try { mq.setHostName(ConfigProvider.getConfig().getValue("ibm.mq.host", String.class)); mq.setPort(ConfigProvider.getConfig().getValue("ibm.mq.port", Integer.class)); mq.setChannel(ConfigProvider.getConfig().getValue("ibm.mq.channel", String.class)); mq.setQueueManager(ConfigProvider.getConfig().getValue("ibm.mq.queueManagerName", String.class)); mq.setTransportType(WMQConstants.WMQ_CM_CLIENT); mq.setStringProperty(WMQConstants.USERID, ConfigProvider.getConfig().getValue("ibm.mq.user", String.class)); mq.setStringProperty(WMQConstants.PASSWORD, ConfigProvider.getConfig().getValue("ibm.mq.password", String.class)); } catch (Exception e) { throw new RuntimeException("Unable to create new IBM MQ connection factory", e); } return wrapper.wrapConnectionFactory(mq); }
@Inject TransactionManager transactionManager; @Override public void configure() throws Exception { from("jms:queue:DEV.QUEUE.XA?transactionManager=#jtaTransactionManager"); } @Named("jtaTransactionManager") public PlatformTransactionManager getTransactionManager() { return new JtaTransactionManager(transactionManager); }
WARN [com.arj.ats.jta] (executor-thread-1) ARJUNA016045: attempted rollback of < formatId=131077, gtrid_length=35, bqual_length=36, tx_uid=0:ffffc0a86510:aed3:650915d7:16, node_name=quarkus, branch_uid=0:ffffc0a86510:aed3:650915d7:1f, subordinatenodename=null, eis_name=0 > (com.ibm.mq.jmqi.JmqiXAResource@79786dde) failed with exception code XAException.XAER_NOTA: javax.transaction.xa.XAException: The method 'xa_rollback' has failed with errorCode '-4'.
it may be ignored and can be assumed that MQ has discarded the transaction's work. Refer to https://access.redhat.com/solutions/1250743[Red Hat Knowledgebase] for more information.
@RegisterForReflection(targets = { IllegalStateException.class, MyCustomException.class }, serialization = true)
<dependency> <groupId>org.apache.camel.quarkus</groupId> <artifactId>camel-quarkus-jpa</artifactId> </dependency>
@Inject EntityManagerFactory entityManagerFactory; @Inject TransactionStrategy transactionStrategy; from("direct:idempotent") .idempotentConsumer( header("messageId"), new JpaMessageIdRepository(entityManagerFactory, transactionStrategy, "idempotentProcessor"));
<dependency> <groupId>org.apache.camel.quarkus</groupId> <artifactId>camel-quarkus-jslt</artifactId> </dependency>
from("direct:start").to("jslt:transformation.json");
quarkus.native.resources.includes = *.json
@RegisterForReflection public class MathFunctionStub { public static double pow(double a, double b) { return java.lang.Math.pow(a, b); } }
@Named JsltComponent jsltWithFunction() throws ClassNotFoundException { JsltComponent component = new JsltComponent(); component.setFunctions(singleton(wrapStaticMethod("power", "org.apache.cq.example.MathFunctionStub", "pow"))); return component; }
<dependency> <groupId>org.apache.camel.quarkus</groupId> <artifactId>camel-quarkus-jsonpath</artifactId> </dependency>
<dependency> <groupId>org.apache.camel.quarkus</groupId> <artifactId>camel-quarkus-jta</artifactId> </dependency>
from("direct:transaction") .transacted() .to("sql:INSERT INTO A TABLE ...?dataSource=#ds1") .to("sql:INSERT INTO A TABLE ...?dataSource=#ds2") .log("all data are in the ds1 and ds2")
<dependency> <groupId>org.apache.camel.quarkus</groupId> <artifactId>camel-quarkus-jt400</artifactId> </dependency>
<dependency> <groupId>org.apache.camel.quarkus</groupId> <artifactId>camel-quarkus-jq</artifactId> </dependency>
@RegisterForReflection public class Book { }
public class MyJQRoutes extends RouteBuilder { @Override public void configure() { from("direct:jq") .transform().jq(".book", Book.class); } }
<dependency> <groupId>org.apache.camel.quarkus</groupId> <artifactId>camel-quarkus-kafka</artifactId> </dependency>
<dependency> <groupId>org.apache.camel.quarkus</groupId> <artifactId>camel-quarkus-kamelet</artifactId> </dependency>
<dependency> <groupId>org.apache.camel.kamelets</groupId> <artifactId>camel-kamelets</artifactId> </dependency>
<dependency> <groupId>org.apache.camel.kamelets</groupId> <artifactId>camel-kamelets-utils</artifactId> <exclusions> <exclusion> <groupId>org.apache.camel</groupId> <artifactId>*</artifactId> </exclusion> </exclusions> </dependency>
<dependency> <groupId>org.apache.camel.quarkus</groupId> <artifactId>camel-quarkus-kubernetes</artifactId> </dependency>
from("direct:pods") .to("kubernetes-pods:///?kubernetesClient=#kubernetesClient&operation=listPods")
quarkus.kubernetes-client.master-url=https://my.k8s.host quarkus.kubernetes-client.namespace=my-namespace
<dependency> <groupId>org.apache.camel.quarkus</groupId> <artifactId>camel-quarkus-kubernetes-cluster-service</artifactId> </dependency>
from("master:ns:timer:test?period=100").log("Timer invoked on a single pod at a time");
<dependency> <groupId>org.apache.camel.quarkus</groupId> <artifactId>camel-quarkus-kudu</artifactId> </dependency>
<dependency> <groupId>org.apache.camel.quarkus</groupId> <artifactId>camel-quarkus-language</artifactId> </dependency>
quarkus.native.resources.includes=script.txt
<dependency> <groupId>org.apache.camel.quarkus</groupId> <artifactId>camel-quarkus-ldap</artifactId> </dependency>
@RegisterForReflection public class CustomSSLSocketFactory extends SSLSocketFactory { // The class definition is the same as in the above link. }
<dependency> <groupId>org.apache.camel.quarkus</groupId> <artifactId>camel-quarkus-lra</artifactId> </dependency>
<dependency> <groupId>org.apache.camel.quarkus</groupId> <artifactId>camel-quarkus-log</artifactId> </dependency>
<dependency> <groupId>org.apache.camel.quarkus</groupId> <artifactId>camel-quarkus-mail</artifactId> </dependency>
<dependency> <groupId>org.apache.camel.quarkus</groupId> <artifactId>camel-quarkus-management</artifactId> </dependency>
quarkus.native.monitoring=jmxserver
<dependency> <groupId>org.apache.camel.quarkus</groupId> <artifactId>camel-quarkus-mapstruct</artifactId> </dependency>
<plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <configuration> <annotationProcessorPaths> <path> <groupId>org.mapstruct</groupId> <artifactId>mapstruct-processor</artifactId> <version>{mapstruct-version}</version> </path> </annotationProcessorPaths> </configuration> </plugin> </plugins>
dependencies { annotationProcessor 'org.mapstruct:mapstruct-processor:{mapstruct-version}' testAnnotationProcessor 'org.mapstruct:mapstruct-processor:{mapstruct-version}' }
camel.component.mapstruct.mapper-package-name = com.first.package,org.second.package
<dependency> <groupId>org.apache.camel.quarkus</groupId> <artifactId>camel-quarkus-master</artifactId> </dependency>
<dependency> <groupId>org.apache.camel.quarkus</groupId> <artifactId>camel-quarkus-micrometer</artifactId> </dependency>
<dependency> <groupId>io.quarkus</groupId> <artifactId>quarkus-micrometer-registry-prometheus</artifactId> </dependency>
<dependency> <groupId>org.apache.camel.quarkus</groupId> <artifactId>camel-quarkus-microprofile-fault-tolerance</artifactId> </dependency>
<dependency> <groupId>org.apache.camel.quarkus</groupId> <artifactId>camel-quarkus-microprofile-health</artifactId> </dependency>
<dependency> <groupId>org.apache.camel.quarkus</groupId> <artifactId>camel-quarkus-minio</artifactId> </dependency>
minio:foo?minioClient=#minioClient
<dependency> <groupId>org.apache.camel.quarkus</groupId> <artifactId>camel-quarkus-mllp</artifactId> </dependency>
<dependency> <groupId>org.apache.camel.quarkus</groupId> <artifactId>camel-quarkus-mock</artifactId> </dependency>
import jakarta.inject.Inject; import org.apache.camel.CamelContext; import org.apache.camel.ProducerTemplate; import org.apache.camel.component.mock.MockEndpoint; import org.junit.jupiter.api.Test; import io.quarkus.test.junit.QuarkusTest; @QuarkusTest public class MockJvmTest { @Inject CamelContext camelContext; @Inject ProducerTemplate producerTemplate; @Test public void test() throws InterruptedException { producerTemplate.sendBody("direct:start", "Hello World"); MockEndpoint mockEndpoint = camelContext.getEndpoint("mock:result", MockEndpoint.class); mockEndpoint.expectedBodiesReceived("Hello World"); mockEndpoint.assertIsSatisfied(); } }
import jakarta.enterprise.context.ApplicationScoped; import org.apache.camel.builder.RouteBuilder; @ApplicationScoped public class MockRoute extends RouteBuilder { @Override public void configure() throws Exception { from("direct:start").to("mock:result"); } }
<dependency> <groupId>org.apache.camel.quarkus</groupId> <artifactId>camel-quarkus-mongodb</artifactId> </dependency>
from("direct:start") .to("mongodb:camelMongoClient?database=myDb&collection=myCollection&operation=findAll")
//application.properties quarkus.mongodb.mongoClient1.connection-string = mongodb://root:example@localhost:27017/
//Routes.java @ApplicationScoped public class Routes extends RouteBuilder { @Inject @MongoClientName("mongoClient1") MongoClient mongoClient1; @Override public void configure() throws Exception { from("direct:defaultServer") .to("mongodb:camelMongoClient?database=myDb&collection=myCollection&operation=findAll") from("direct:otherServer") .to("mongodb:mongoClient1?database=myOtherDb&collection=myOtherCollection&operation=findAll"); } }
<dependency> <groupId>org.apache.camel.quarkus</groupId> <artifactId>camel-quarkus-mybatis</artifactId> </dependency>
quarkus.mybatis.xmlconfig.enable=true quarkus.mybatis.xmlconfig.path=SqlMapConfig.xml
<dependency> <groupId>org.apache.camel.quarkus</groupId> <artifactId>camel-quarkus-netty-http</artifactId> </dependency>
@RegisterForReflection(targets = { IllegalStateException.class, MyCustomException.class }, serialization = true)
<dependency> <groupId>org.apache.camel.quarkus</groupId> <artifactId>camel-quarkus-netty</artifactId> </dependency>
<dependency> <groupId>org.apache.camel.quarkus</groupId> <artifactId>camel-quarkus-openapi-java</artifactId> </dependency>
quarkus.camel.openapi.expose.enabled=true
<dependency> <groupId>org.apache.camel.quarkus</groupId> <artifactId>camel-quarkus-opentelemetry</artifactId> </dependency>
Identifier for the origin of spans created by the application quarkus.application.name=my-camel-application OTLP exporter endpoint quarkus.opentelemetry.tracer.exporter.otlp.endpoint=http://localhost:4317
Exclude all direct & netty-http endpoints from tracing quarkus.camel.opentelemetry.exclude-patterns=direct:*,netty-http:*
@ApplicationScoped @Named("myBean") public class MyBean { @WithSpan public String greet() { return "Hello World!"; } }
public class MyRoutes extends RouteBuilder { @Override public void configure() throws Exception { from("direct:executeBean") .to("bean:myBean?method=greet"); } }
<dependency> <groupId>org.apache.camel.quarkus</groupId> <artifactId>camel-quarkus-paho-mqtt5</artifactId> </dependency>
<dependency> <groupId>org.apache.camel.quarkus</groupId> <artifactId>camel-quarkus-paho</artifactId> </dependency>
<dependency> <groupId>org.apache.camel.quarkus</groupId> <artifactId>camel-quarkus-platform-http</artifactId> </dependency>
from("platform-http:/hello").setBody(simple("Hello USD{header.name}"));
from("platform-http:/hello?httpMethodRestrict=GET").setBody(simple("Hello USD{header.name}"));
<dependency> <groupId>org.apache.camel.quarkus</groupId> <artifactId>camel-quarkus-rest</artifactId> </dependency>
rest() .get("/my-get-endpoint") .to("direct:handleGetRequest"); .post("/my-post-endpoint") .to("direct:handlePostRequest");
from("platform-http:/upload/multipart?fileNameExtWhitelist=adoc,txt&httpMethodRestrict=POST") .to("log:multipart") .process(e -> { final AttachmentMessage am = e.getMessage(AttachmentMessage.class); if (am.hasAttachments()) { am.getAttachments().forEach((fileName, dataHandler) -> { try (InputStream in = dataHandler.getInputStream()) { // do something with the input stream } catch (IOException ioe) { throw new RuntimeException(ioe); } }); } });
from("platform-http:/secure") .process(e -> { Message message = e.getMessage(); QuarkusHttpUser user = message.getHeader(VertxPlatformHttpConstants.AUTHENTICATED_USER, QuarkusHttpUser.class); SecurityIdentity securityIdentity = user.getSecurityIdentity(); Principal principal = securityIdentity.getPrincipal(); // Do something useful with SecurityIdentity / Principal. E.g check user roles etc. });
from("platform-http:proxy") .toD("http://" + "USD{headers." + Exchange.HTTP_HOST + "}");
onException(InvalidOrderTotalException.class) .handled(true) .setHeader(Exchange.HTTP_RESPONSE_CODE).constant(500) .setHeader(Exchange.CONTENT_TYPE).constant("text/plain") .setBody().constant("The order total was not greater than 100"); from("platform-http:/orders") .choice().when().xpath("//order/total > 100") .to("direct:processOrder") .otherwise() .throwException(new InvalidOrderTotalException());
void initRouter(@Observes Router router) { // Custom 404 handler router.errorHandler(404, new Handler<RoutingContext>() { @Override public void handle(RoutingContext event) { event.response() .setStatusCode(404) .putHeader("Content-Type", "text/plain") .end("Sorry - resource not found"); } }); }
<dependency> <groupId>org.apache.camel.quarkus</groupId> <artifactId>camel-quarkus-quartz</artifactId> </dependency>
Quartz configuration quarkus.quartz.clustered=true quarkus.quartz.store-type=jdbc-cmt quarkus.scheduler.start-mode=forced Datasource configuration quarkus.datasource.db-kind=postgresql quarkus.datasource.username=quarkus_test quarkus.datasource.password=quarkus_test quarkus.datasource.jdbc.url=jdbc:postgresql://localhost/quarkus_test Optional automatic creation of Quartz tables quarkus.flyway.connect-retries=10 quarkus.flyway.table=flyway_quarkus_history quarkus.flyway.migrate-at-start=true quarkus.flyway.baseline-on-migrate=true quarkus.flyway.baseline-version=1.0 quarkus.flyway.baseline-description=Quartz
<dependency> <groupId>io.quarkus</groupId> <artifactId>quarkus-jdbc-postgresql</artifactId> </dependency> <dependency> <groupId>io.quarkus</groupId> <artifactId>quarkus-agroal</artifactId> </dependency>
<dependency> <groupId>io.quarkus</groupId> <artifactId>quarkus-flyway</artifactId> </dependency>
@Produces @Singleton @Named("quartz") public QuartzComponent quartzComponent(Scheduler scheduler) { QuartzComponent component = new QuartzComponent(); component.setScheduler(scheduler); return component; }
<dependency> <groupId>org.apache.camel.quarkus</groupId> <artifactId>camel-quarkus-qute</artifactId> </dependency>
<dependency> <groupId>org.apache.camel.quarkus</groupId> <artifactId>camel-quarkus-ref</artifactId> </dependency>
@ApplicationScoped public class MyEndpointProducers { @Inject CamelContext context; @Singleton @Produces @Named("endpoint1") public Endpoint directStart() { return context.getEndpoint("direct:start"); } @Singleton @Produces @Named("endpoint2") public Endpoint logEnd() { return context.getEndpoint("log:end"); } }
public class MyRefRoutes extends RouteBuilder { @Override public void configure() { // direct:start -> log:end from("ref:endpoint1") .to("ref:endpoint2"); } }
<dependency> <groupId>org.apache.camel.quarkus</groupId> <artifactId>camel-quarkus-rest-openapi</artifactId> </dependency>
<dependency> <groupId>org.apache.camel.quarkus</groupId> <artifactId>camel-quarkus-http</artifactId> </dependency>
quarkus.native.resources.includes=openapi.json
<plugin> <groupId>io.quarkus</groupId> <artifactId>quarkus-maven-plugin</artifactId> <executions> <execution> <goals> <goal>generate-code</goal> </goals> </execution> </executions> </plugin>
quarkus.camel.openapi.codegen.model-package=org.acme
<build> <resources> <resource> <directory>src/main/openapi</directory> </resource> <resource> <directory>src/main/resources</directory> </resource> </resources> </build>
quarkus.native.resources.includes=contract.json
<dependency> <groupId>org.apache.camel.quarkus</groupId> <artifactId>camel-quarkus-rest</artifactId> </dependency>
import org.apache.camel.builder.RouteBuilder; public class CamelRoute extends RouteBuilder { @Override public void configure() { rest("/api") // Dash '-' is not allowed by default .get("/dashed/param/{my-param}") .to("direct:greet") // The non-dashed path parameter works by default .get("/undashed/param/{myParam}") .to("direct:greet"); from("direct:greet") .setBody(constant("Hello World")); } }
import org.apache.camel.builder.RouteBuilder; public class CamelRoute extends RouteBuilder { @Override public void configure() { restConfiguration() .component("servlet"); } }
<dependency> <groupId>org.apache.camel.quarkus</groupId> <artifactId>camel-quarkus-salesforce</artifactId> </dependency>
<plugin> <groupId>org.apache.camel.maven</groupId> <artifactId>camel-salesforce-maven-plugin</artifactId> <version>{camel-version}</version> <executions> <execution> <goals> <goal>generate</goal> </goals> <configuration> <clientId>USD{env.SALESFORCE_CLIENTID}</clientId> <clientSecret>USD{env.SALESFORCE_CLIENTSECRET}</clientSecret> <userName>USD{env.SALESFORCE_USERNAME}</userName> <password>USD{env.SALESFORCE_PASSWORD}</password> <loginUrl>https://login.salesforce.com</loginUrl> <packageName>org.apache.camel.quarkus.component.salesforce.generated</packageName> <outputDirectory>src/main/java</outputDirectory> <includes> <include>Account</include> </includes> </configuration> </execution> </executions> </plugin>
from("salesforce:pubSubSubscribe:/event/TestEvent__e?pubSubDeserializeType=POJO&pubSubPojoClass=org.foo.TestEvent") .log("Received Salesforce POJO topic message: USD{body}");
package org.foo; import io.quarkus.runtime.annotations.RegisterForReflection; @RegisterForReflection public class TestEvent { // Getters / setters etc }
<dependency> <groupId>org.apache.camel.quarkus</groupId> <artifactId>camel-quarkus-saga</artifactId> </dependency>
<dependency> <groupId>org.apache.camel.quarkus</groupId> <artifactId>camel-quarkus-sap</artifactId> </dependency>
Caused by: java.lang.ExceptionInInitializerError: JCo initialization failed with java.lang.ExceptionInInitializerError: Illegal JCo archive "sap-1.0.0-SNAPSHOT-runner.jar". It is not allowed to rename or repackage the original archive "sapjco3.jar".
<dependency> <groupId>org.apache.camel.quarkus</groupId> <artifactId>camel-quarkus-saxon</artifactId> </dependency>
from("direct:start").transform().xquery("resource:classpath:myxquery.txt", String.class); from("direct:start").to("xquery:another-xquery.txt");
quarkus.native.resources.includes = *.txt
<dependency> <groupId>org.apache.camel.quarkus</groupId> <artifactId>camel-quarkus-aws-secrets-manager</artifactId> </dependency>
<dependency> <groupId>org.apache.camel.quarkus</groupId> <artifactId>camel-quarkus-scheduler</artifactId> </dependency>
<dependency> <groupId>org.apache.camel.quarkus</groupId> <artifactId>camel-quarkus-seda</artifactId> </dependency>
<dependency> <groupId>org.apache.camel.quarkus</groupId> <artifactId>camel-quarkus-servlet</artifactId> </dependency>
quarkus.camel.servlet.url-patterns = /*
from("servlet://greet") .setBody().constant("Hello World");
quarkus.camel.servlet.servlet-name = My Custom Name
quarkus.camel.servlet.servlet-class = org.acme.MyCustomServlet
quarkus.camel.servlet.my-servlet-a.servlet-name = my-custom-a quarkus.camel.servlet.my-servlet-a.url-patterns = /custom/a/* quarkus.camel.servlet.my-servlet-b.servlet-name = my-custom-b quarkus.camel.servlet.my-servlet-b.servlet-class = org.acme.CustomServletB quarkus.camel.servlet.my-servlet-b.url-patterns = /custom/b/*
from("servlet://greet?servletName=my-custom-a") .setBody().constant("Hello World"); from("servlet://goodbye?servletName=my-custom-b") .setBody().constant("Goodbye World");
import jakarta.servlet.annotation.WebServlet; import org.apache.camel.component.servlet.CamelHttpTransportServlet; @WebServlet( urlPatterns = {"/*"}, initParams = { @WebInitParam(name = "myParam", value = "myValue") } ) public class MyCustomServlet extends CamelHttpTransportServlet { }
<web-app> <servlet> <servlet-name>CamelServlet</servlet-name> <servlet-class>org.apache.camel.component.servlet.CamelHttpTransportServlet</servlet-class> </servlet> <servlet-mapping> <servlet-name>CamelServlet</servlet-name> <url-pattern>/services/*</url-pattern> </servlet-mapping> </web-app>
@RegisterForReflection(targets = { IllegalStateException.class, MyCustomException.class }, serialization = true)
<dependency> <groupId>org.apache.camel.quarkus</groupId> <artifactId>camel-quarkus-slack</artifactId> </dependency>
<dependency> <groupId>org.apache.camel.quarkus</groupId> <artifactId>camel-quarkus-smb</artifactId> </dependency>
<dependency> <groupId>org.apache.camel.quarkus</groupId> <artifactId>camel-quarkus-snmp</artifactId> </dependency>
<dependency> <groupId>org.apache.camel.quarkus</groupId> <artifactId>camel-quarkus-soap</artifactId> </dependency>
<dependency> <groupId>org.apache.camel.quarkus</groupId> <artifactId>camel-quarkus-splunk</artifactId> </dependency>
<dependency> <groupId>org.apache.camel.quarkus</groupId> <artifactId>camel-quarkus-splunk-hec</artifactId> </dependency>
<dependency> <groupId>org.apache.camel.quarkus</groupId> <artifactId>camel-quarkus-spring-rabbitmq</artifactId> </dependency>
quarkus.native.additional-build-args = -H:+InlineBeforeAnalysis
<dependency> <groupId>org.apache.camel.quarkus</groupId> <artifactId>camel-quarkus-sql</artifactId> </dependency>
quarkus.datasource.db-kind=postgresql quarkus.datasource.username=your-username quarkus.datasource.password=your-password quarkus.datasource.jdbc.url=jdbc:postgresql://localhost:5432/your-database quarkus.datasource.jdbc.max-size=16
quarkus.native.resources.includes = queries.sql, sql/*.sql
<dependency> <groupId>org.apache.camel.quarkus</groupId> <artifactId>camel-quarkus-telegram</artifactId> </dependency>
<dependency> <groupId>org.apache.camel.quarkus</groupId> <artifactId>camel-quarkus-rest</artifactId> </dependency>
<dependency> <groupId>org.apache.camel.quarkus</groupId> <artifactId>camel-quarkus-timer</artifactId> </dependency>
<dependency> <groupId>org.apache.camel.quarkus</groupId> <artifactId>camel-quarkus-validator</artifactId> </dependency>
<dependency> <groupId>org.apache.camel.quarkus</groupId> <artifactId>camel-quarkus-velocity</artifactId> </dependency>
@RegisterForReflection public interface CustomBody { }
from("direct:start").to("velocity://template/simple.vm");
quarkus.native.resources.includes = template/*.vm
<dependency> <groupId>org.apache.camel.quarkus</groupId> <artifactId>camel-quarkus-vertx-http</artifactId> </dependency>
@RegisterForReflection(targets = { IllegalStateException.class, MyCustomException.class }, serialization = true)
<dependency> <groupId>org.apache.camel.quarkus</groupId> <artifactId>camel-quarkus-vertx-websocket</artifactId> </dependency>
from("vertx-websocket:/my-websocket-path") .setBody().constant("Hello World");
from("vertx-websocket:/my-websocket-path") .log("Got body: USD{body}"); from("direct:sendToWebSocket") .log("vertx-websocket:/my-websocket-path");
from("direct:sendToWebSocket") .log("vertx-websocket:{{quarkus.http.host}}:{{quarkus.http.port}}/my-websocket-path");
<dependency> <groupId>org.apache.camel.quarkus</groupId> <artifactId>camel-quarkus-xj</artifactId> </dependency>
<dependency> <groupId>org.apache.camel.quarkus</groupId> <artifactId>camel-quarkus-xml-io-dsl</artifactId> </dependency>
<dependency> <groupId>org.apache.camel.quarkus</groupId> <artifactId>camel-quarkus-xml-jaxp</artifactId> </dependency>
<dependency> <groupId>org.apache.camel.quarkus</groupId> <artifactId>camel-quarkus-xpath</artifactId> </dependency>
from("direct:start").transform().xpath("resource:classpath:myxpath.txt");
quarkus.native.resources.includes = *.txt
<dependency> <groupId>org.apache.camel.quarkus</groupId> <artifactId>camel-quarkus-xslt-saxon</artifactId> </dependency>
<dependency> <groupId>org.apache.camel.quarkus</groupId> <artifactId>camel-quarkus-xslt</artifactId> </dependency>
quarkus.camel.xslt.sources = transform.xsl, classpath:path/to/my/file.xsl
from("file:src/test/resources?noop=true&sortBy=file:name&antInclude=*.xml") .routeId("aggregate").noAutoStartup() .aggregate(new XsltSaxonAggregationStrategy("xslt/aggregate.xsl")) .constant(true) .completionFromBatchConsumer() .log("after aggregate body: USD{body}") .to("mock:transformed");
quarkus.camel.xslt.features."http\://javax.xml.XMLConstants/feature/secure-processing"=false
@RegisterForReflection(targets = { my.Functions.class }) public class FunctionsConfiguration { }
<dependency> <groupId>org.apache.camel.quarkus</groupId> <artifactId>camel-quarkus-yaml-dsl</artifactId> </dependency>
- beans: - name: "greetingBean" type: "org.acme.GreetingBean" properties: greeting: "Hello World!" - route: id: "my-yaml-route" from: uri: "timer:from-yaml?period=1000" steps: - to: "bean:greetingBean"
@RegisterForReflection public class GreetingBean { }
- on-exception: handled: constant: "true" exception: - "org.acme.MyHandledException" steps: - transform: constant: "Sorry something went wrong"
@RegisterForReflection public class MyHandledException { }
- route: id: "my-yaml-route" from: uri: "direct:start" steps: - choice: when: - simple: "USD{body} == 'bad value'" steps: - throw-exception: exception-type: "org.acme.ForcedException" message: "Forced exception" otherwise: steps: - to: "log:end"
@RegisterForReflection public class ForcedException { }
- route: id: "my-yaml-route2" from: uri: "direct:tryCatch" steps: - do-try: steps: - to: "direct:readFile" do-catch: - exception: - "java.io.FileNotFoundException" steps: - transform: constant: "do-catch caught an exception"
@RegisterForReflection(targets = FileNotFoundException.class) public class MyClass { }
<dependency> <groupId>org.apache.camel.quarkus</groupId> <artifactId>camel-quarkus-yaml-io</artifactId> </dependency>
camel.main.dump-routes = yaml
<dependency> <groupId>org.apache.camel.quarkus</groupId> <artifactId>camel-quarkus-zip-deflater</artifactId> </dependency>
<dependency> <groupId>org.apache.camel.quarkus</groupId> <artifactId>camel-quarkus-zipfile</artifactId> </dependency>
<dependency> <groupId>io.quarkiverse.cxf</groupId> <artifactId>quarkus-cxf</artifactId> </dependency>
Parameters for foo.wsdl quarkus.cxf.codegen.wsdl2java.foo-params.includes = wsdl/foo.wsdl quarkus.cxf.codegen.wsdl2java.foo-params.wsdl-location = wsdl/foo.wsdl Parameters for bar.wsdl quarkus.cxf.codegen.wsdl2java.bar-params.includes = wsdl/bar.wsdl quarkus.cxf.codegen.wsdl2java.bar-params.wsdl-location = wsdl/bar.wsdl quarkus.cxf.codegen.wsdl2java.bar-params.xjc = ts
Parameters for the foo package quarkus.cxf.java2ws.foo-params.includes = org.foo.* quarkus.cxf.java2ws.foo-params.additional-params = -servicename,FruitService Parameters for the bar package quarkus.cxf.java2ws.bar-params.includes = org.bar.* quarkus.cxf.java2ws.bar-params.additional-params = -servicename,HelloService
quarkus.cxf.decoupled-endpoint-base = https://api.example.com:USD{quarkus.http.ssl-port}USD{quarkus.cxf.path} or for plain HTTP quarkus.cxf.decoupled-endpoint-base = http://api.example.com:USD{quarkus.http.port}USD{quarkus.cxf.path}
import java.util.Map; import jakarta.inject.Inject; import jakarta.ws.rs.POST; import jakarta.ws.rs.Path; import jakarta.ws.rs.Produces; import jakarta.ws.rs.core.Context; import jakarta.ws.rs.core.MediaType; import jakarta.ws.rs.core.UriInfo; import jakarta.xml.ws.BindingProvider; import io.quarkiverse.cxf.annotation.CXFClient; import org.eclipse.microprofile.config.inject.ConfigProperty; @Path("/my-rest") public class MyRestEasyResource { @Inject @CXFClient("hello") HelloService helloService; @ConfigProperty(name = "quarkus.cxf.path") String quarkusCxfPath; @POST @Path("/hello") @Produces(MediaType.TEXT_PLAIN) public String hello(String body, @Context UriInfo uriInfo) throws IOException { // You may consider doing this only once if you are sure that your service is accessed // through a single hostname String decoupledEndpointBase = uriInfo.getBaseUriBuilder().path(quarkusCxfPath); Map>String, Object< requestContext = ((BindingProvider) helloService).getRequestContext(); requestContext.put("org.apache.cxf.ws.addressing.decoupled.endpoint.base", decoupledEndpointBase); return wsrmHelloService.hello(body); } }
Parameters for foo.wsdl quarkus.cxf.codegen.wsdl2java.foo-params.includes = wsdl/foo.wsdl quarkus.cxf.codegen.wsdl2java.foo-params.wsdl-location = wsdl/foo.wsdl Parameters for bar.wsdl quarkus.cxf.codegen.wsdl2java.bar-params.includes = wsdl/bar.wsdl quarkus.cxf.codegen.wsdl2java.bar-params.wsdl-location = wsdl/bar.wsdl quarkus.cxf.codegen.wsdl2java.bar-params.xjc = ts
Parameters for the foo package quarkus.cxf.java2ws.foo-params.includes = org.foo.* quarkus.cxf.java2ws.foo-params.additional-params = -servicename,FruitService Parameters for the bar package quarkus.cxf.java2ws.bar-params.includes = org.bar.* quarkus.cxf.java2ws.bar-params.additional-params = -servicename,HelloService
quarkus.cxf.endpoint."/hello".features = org.apache.cxf.ext.logging.LoggingFeature quarkus.cxf.endpoint."/fruit".features = #myCustomLoggingFeature
import org.apache.cxf.ext.logging.LoggingFeature; import javax.enterprise.context.ApplicationScoped; import javax.enterprise.inject.Produces; class Producers { @Produces @ApplicationScoped LoggingFeature myCustomLoggingFeature() { LoggingFeature loggingFeature = new LoggingFeature(); loggingFeature.setPrettyLogging(true); return loggingFeature; } }
quarkus.cxf.endpoint."/my-endpoint".features = org.apache.cxf.ext.logging.LoggingFeature
<dependency> <groupId>io.quarkiverse.cxf</groupId> <artifactId>quarkus-cxf-rt-features-metrics</artifactId> </dependency>
<dependency> <groupId>io.quarkiverse.cxf</groupId> <artifactId>quarkus-cxf-rt-features-metrics</artifactId> </dependency>
<dependency> <groupId>io.quarkus</groupId> <artifactId>quarkus-micrometer-registry-prometheus</artifactId> </dependency>
quarkus.micrometer.export.json.enabled = true quarkus.micrometer.export.json.path = metrics/json quarkus.micrometer.export.prometheus.path = metrics/prometheus
mvn quarkus:dev
curl -d '<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><soap:Body><ns2:helloResponse xmlns:ns2="http://it.server.metrics.cxf.quarkiverse.io/"><return>Hello Joe!</return></ns2:helloResponse></soap:Body></soap:Envelope>' -H 'Content-Type: text/xml' -X POST http://localhost:8080/metrics/client/hello
curl http://localhost:8080/q/metrics/json metrics: { "cxf.server.requests": { "count;exception=None;faultCode=None;method=POST;operation=hello;outcome=SUCCESS;status=200;uri=/soap/hello": 2, "elapsedTime;exception=None;faultCode=None;method=POST;operation=hello;outcome=SUCCESS;status=200;uri=/soap/hello": 64.0 }, }
<dependency> <groupId>io.quarkiverse.cxf</groupId> <artifactId>quarkus-cxf-integration-tracing-opentelemetry</artifactId> </dependency>
<dependency> <groupId>io.quarkiverse.cxf</groupId> <artifactId>quarkus-cxf-rt-ws-security</artifactId> </dependency>
<?xml version="1.0" encoding="UTF-8" ?> <wsp:Policy wsu:Id="SecurityServiceEncryptThenSignPolicy" xmlns:wsp="http://www.w3.org/ns/ws-policy" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:sp="http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702"> <wsp:ExactlyOne> <wsp:All> 1 <sp:AsymmetricBinding xmlns:sp="http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702"> <wsp:Policy> 2 <sp:InitiatorToken> <wsp:Policy> <sp:X509Token sp:IncludeToken="http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702/IncludeToken/AlwaysToRecipient"> <wsp:Policy> <sp:WssX509V3Token11/> </wsp:Policy> </sp:X509Token> </wsp:Policy> </sp:InitiatorToken> <sp:RecipientToken> <wsp:Policy> <sp:X509Token sp:IncludeToken="http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702/IncludeToken/Never"> <wsp:Policy> <sp:WssX509V3Token11/> </wsp:Policy> </sp:X509Token> </wsp:Policy> </sp:RecipientToken> <sp:AlgorithmSuite> <wsp:Policy> <sp:Basic256/> </wsp:Policy> </sp:AlgorithmSuite> <sp:Layout> <wsp:Policy> <sp:Strict/> </wsp:Policy> </sp:Layout> <sp:IncludeTimestamp/> <sp:ProtectTokens/> <sp:OnlySignEntireHeadersAndBody/> <sp:EncryptBeforeSigning/> </wsp:Policy> </sp:AsymmetricBinding> 3 <sp:SignedParts xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy"> <sp:Body/> </sp:SignedParts> 4 <sp:EncryptedParts xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy"> <sp:Body/> </sp:EncryptedParts> <sp:Wss10 xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy"> <wsp:Policy> <sp:MustSupportRefIssuerSerial/> </wsp:Policy> </sp:Wss10> </wsp:All> </wsp:ExactlyOne> </wsp:Policy>
@WebService(serviceName = "EncryptSignPolicyHelloService") @Policy(placement = Policy.Placement.BINDING, uri = "encrypt-sign-policy.xml") public interface EncryptSignPolicyHelloService extends AbstractHelloService { }
A service with encrypt-sign-policy.xml set quarkus.cxf.endpoint."/helloEncryptSign".implementor = io.quarkiverse.cxf.it.security.policy.EncryptSignPolicyHelloServiceImpl Signature settings quarkus.cxf.endpoint."/helloEncryptSign".security.signature.username = bob quarkus.cxf.endpoint."/helloEncryptSign".security.signature.password = bob-keystore-password quarkus.cxf.endpoint."/helloEncryptSign".security.signature.properties."org.apache.ws.security.crypto.provider" = org.apache.ws.security.components.crypto.Merlin quarkus.cxf.endpoint."/helloEncryptSign".security.signature.properties."org.apache.ws.security.crypto.merlin.keystore.type" = pkcs12 quarkus.cxf.endpoint."/helloEncryptSign".security.signature.properties."org.apache.ws.security.crypto.merlin.keystore.password" = bob-keystore-password quarkus.cxf.endpoint."/helloEncryptSign".security.signature.properties."org.apache.ws.security.crypto.merlin.keystore.alias" = bob quarkus.cxf.endpoint."/helloEncryptSign".security.signature.properties."org.apache.ws.security.crypto.merlin.file" = bob-keystore.pkcs12 Encryption settings quarkus.cxf.endpoint."/helloEncryptSign".security.encryption.username = alice quarkus.cxf.endpoint."/helloEncryptSign".security.encryption.properties."org.apache.ws.security.crypto.provider" = org.apache.ws.security.components.crypto.Merlin quarkus.cxf.endpoint."/helloEncryptSign".security.encryption.properties."org.apache.ws.security.crypto.merlin.keystore.type" = pkcs12 quarkus.cxf.endpoint."/helloEncryptSign".security.encryption.properties."org.apache.ws.security.crypto.merlin.keystore.password" = bob-keystore-password quarkus.cxf.endpoint."/helloEncryptSign".security.encryption.properties."org.apache.ws.security.crypto.merlin.keystore.alias" = bob quarkus.cxf.endpoint."/helloEncryptSign".security.encryption.properties."org.apache.ws.security.crypto.merlin.file" = bob-keystore.pkcs12
A client with encrypt-sign-policy.xml set quarkus.cxf.client.helloEncryptSign.client-endpoint-url = https://localhost:USD{quarkus.http.test-ssl-port}/services/helloEncryptSign quarkus.cxf.client.helloEncryptSign.service-interface = io.quarkiverse.cxf.it.security.policy.EncryptSignPolicyHelloService quarkus.cxf.client.helloEncryptSign.features = #messageCollector The client-endpoint-url above is HTTPS, so we have to setup the server's SSL certificates quarkus.cxf.client.helloEncryptSign.trust-store = client-truststore.pkcs12 quarkus.cxf.client.helloEncryptSign.trust-store-password = client-truststore-password Signature settings quarkus.cxf.client.helloEncryptSign.security.signature.username = alice quarkus.cxf.client.helloEncryptSign.security.signature.password = alice-keystore-password quarkus.cxf.client.helloEncryptSign.security.signature.properties."org.apache.ws.security.crypto.provider" = org.apache.ws.security.components.crypto.Merlin quarkus.cxf.client.helloEncryptSign.security.signature.properties."org.apache.ws.security.crypto.merlin.keystore.type" = pkcs12 quarkus.cxf.client.helloEncryptSign.security.signature.properties."org.apache.ws.security.crypto.merlin.keystore.password" = alice-keystore-password quarkus.cxf.client.helloEncryptSign.security.signature.properties."org.apache.ws.security.crypto.merlin.keystore.alias" = alice quarkus.cxf.client.helloEncryptSign.security.signature.properties."org.apache.ws.security.crypto.merlin.file" = alice-keystore.pkcs12 Encryption settings quarkus.cxf.client.helloEncryptSign.security.encryption.username = bob quarkus.cxf.client.helloEncryptSign.security.encryption.properties."org.apache.ws.security.crypto.provider" = org.apache.ws.security.components.crypto.Merlin quarkus.cxf.client.helloEncryptSign.security.encryption.properties."org.apache.ws.security.crypto.merlin.keystore.type" = pkcs12 quarkus.cxf.client.helloEncryptSign.security.encryption.properties."org.apache.ws.security.crypto.merlin.keystore.password" = alice-keystore-password quarkus.cxf.client.helloEncryptSign.security.encryption.properties."org.apache.ws.security.crypto.merlin.keystore.alias" = alice quarkus.cxf.client.helloEncryptSign.security.encryption.properties."org.apache.ws.security.crypto.merlin.file" = alice-keystore.pkcs12
Clone the repository git clone https://github.com/quarkiverse/quarkus-cxf.git -o upstream cd quarkus-cxf Build the whole source tree mvn clean install -DskipTests -Dquarkus.build.skip Run the test cd integration-tests/ws-security-policy mvn clean test -Dtest=EncryptSignPolicyTest
[prefix].signature.properties."org.apache.ws.security.crypto.provider" = org.apache.ws.security.components.crypto.Merlin [prefix].signature.properties."org.apache.ws.security.crypto.merlin.keystore.password" = password [prefix].signature.properties."org.apache.ws.security.crypto.merlin.file" = certs/alice.jks
[prefix].encryption.properties."org.apache.ws.security.crypto.provider" = org.apache.ws.security.components.crypto.Merlin [prefix].encryption.properties."org.apache.ws.security.crypto.merlin.keystore.password" = password [prefix].encryption.properties."org.apache.ws.security.crypto.merlin.file" = certs/alice.jks
<wsp:Policy wsu:Id="SecurityServiceEncryptThenSignPolicy" xmlns:wsp="http://www.w3.org/ns/ws-policy" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:sp="http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702"> <wsp:ExactlyOne> <wsp:All> <sp:AsymmetricBinding xmlns:sp="http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702"> <wsp:Policy> <sp:AlgorithmSuite> <wsp:Policy> <sp:CustomAlgorithmSuite/> </wsp:Policy> </sp:AlgorithmSuite> </wsp:Policy> </sp:AsymmetricBinding> </wsp:All> </wsp:ExactlyOne> </wsp:Policy>
[prefix].encryption.properties."org.apache.ws.security.crypto.provider" = org.apache.ws.security.components.crypto.Merlin [prefix].encryption.properties."org.apache.ws.security.crypto.merlin.keystore.password" = password [prefix].encryption.properties."org.apache.ws.security.crypto.merlin.file" = certs/alice.jks
[prefix].token.properties."org.apache.ws.security.crypto.provider" = org.apache.ws.security.components.crypto.Merlin [prefix].token.properties."org.apache.ws.security.crypto.merlin.keystore.password" = password [prefix].token.properties."org.apache.ws.security.crypto.merlin.file" = certs/alice.jks
[prefix].signature.properties."org.apache.ws.security.crypto.provider" = org.apache.ws.security.components.crypto.Merlin [prefix].signature.properties."org.apache.ws.security.crypto.merlin.keystore.password" = password [prefix].signature.properties."org.apache.ws.security.crypto.merlin.file" = certs/alice.jks
[prefix].encryption.properties."org.apache.ws.security.crypto.provider" = org.apache.ws.security.components.crypto.Merlin [prefix].encryption.properties."org.apache.ws.security.crypto.merlin.keystore.password" = password [prefix].encryption.properties."org.apache.ws.security.crypto.merlin.file" = certs/alice.jks
<wsp:Policy wsu:Id="SecurityServiceEncryptThenSignPolicy" xmlns:wsp="http://www.w3.org/ns/ws-policy" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:sp="http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702"> <wsp:ExactlyOne> <wsp:All> <sp:AsymmetricBinding xmlns:sp="http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702"> <wsp:Policy> <sp:AlgorithmSuite> <wsp:Policy> <sp:CustomAlgorithmSuite/> </wsp:Policy> </sp:AlgorithmSuite> </wsp:Policy> </sp:AsymmetricBinding> </wsp:All> </wsp:ExactlyOne> </wsp:Policy>
<dependency> <groupId>io.quarkiverse.cxf</groupId> <artifactId>quarkus-cxf-rt-ws-rm</artifactId> </dependency>
cd test-util-parent/test-ws-rm-server-jvm mvn clean install
cd ../../integration-tests/ws-rm-client mvn clean test
<dependency> <groupId>io.quarkiverse.cxf</groupId> <artifactId>quarkus-cxf-services-sts</artifactId> </dependency>
<sp:IssuedToken sp:IncludeToken="http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702/IncludeToken/AlwaysToRecipient"> <sp:RequestSecurityTokenTemplate> <t:TokenType>http://docs.oasis-open.org/wss/oasis-wss-saml-token-profile-1.1#SAMLV2.0</t:TokenType> <t:KeyType>http://docs.oasis-open.org/ws-sx/ws-trust/200512/PublicKey</t:KeyType> </sp:RequestSecurityTokenTemplate> <wsp:Policy> <sp:RequireInternalReference /> </wsp:Policy> <sp:Issuer> <wsaws:Address>http://localhost:8081/services/sts</wsaws:Address> <wsaws:Metadata xmlns:wsdli="http://www.w3.org/2006/01/wsdl-instance" wsdli:wsdlLocation="http://localhost:8081/services/sts?wsdl"> <wsaw:ServiceName xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl" xmlns:stsns="http://docs.oasis-open.org/ws-sx/ws-trust/200512/" EndpointName="UT_Port">stsns:SecurityTokenService</wsaw:ServiceName> </wsaws:Metadata> </sp:Issuer> </sp:IssuedToken>
@WebServiceProvider(serviceName = "SecurityTokenService", portName = "UT_Port", targetNamespace = "http://docs.oasis-open.org/ws-sx/ws-trust/200512/", wsdlLocation = "ws-trust-1.4-service.wsdl") public class Sts extends SecurityTokenServiceProvider { public Sts() throws Exception { super(); StaticSTSProperties props = new StaticSTSProperties(); props.setSignatureCryptoProperties("stsKeystore.properties"); props.setSignatureUsername("sts"); props.setCallbackHandlerClass(StsCallbackHandler.class.getName()); props.setIssuer("SampleSTSIssuer"); List<ServiceMBean> services = new LinkedList<ServiceMBean>(); StaticService service = new StaticService(); final Config config = ConfigProvider.getConfig(); final int port = LaunchMode.current().equals(LaunchMode.TEST) ? config.getValue("quarkus.http.test-port", Integer.class) : config.getValue("quarkus.http.port", Integer.class); service.setEndpoints(Arrays.asList( "http://localhost:" + port + "/services/hello-ws-trust", "http://localhost:" + port + "/services/hello-ws-trust-actas", "http://localhost:" + port + "/services/hello-ws-trust-onbehalfof")); services.add(service); TokenIssueOperation issueOperation = new TokenIssueOperation(); issueOperation.setServices(services); issueOperation.getTokenProviders().add(new SAMLTokenProvider()); // required for OnBehalfOf issueOperation.getTokenValidators().add(new UsernameTokenValidator()); // added for OnBehalfOf and ActAs issueOperation.getDelegationHandlers().add(new UsernameTokenDelegationHandler()); issueOperation.setStsProperties(props); TokenValidateOperation validateOperation = new TokenValidateOperation(); validateOperation.getTokenValidators().add(new SAMLTokenValidator()); validateOperation.setStsProperties(props); this.setIssueOperation(issueOperation); this.setValidateOperation(validateOperation); } }
quarkus.cxf.endpoint."/sts".implementor = io.quarkiverse.cxf.it.ws.trust.sts.Sts quarkus.cxf.endpoint."/sts".logging.enabled = pretty quarkus.cxf.endpoint."/sts".security.signature.username = sts quarkus.cxf.endpoint."/sts".security.signature.password = password quarkus.cxf.endpoint."/sts".security.validate.token = false quarkus.cxf.endpoint."/sts".security.signature.properties."org.apache.ws.security.crypto.provider" = org.apache.ws.security.components.crypto.Merlin quarkus.cxf.endpoint."/sts".security.signature.properties."org.apache.ws.security.crypto.merlin.keystore.type" = pkcs12 quarkus.cxf.endpoint."/sts".security.signature.properties."org.apache.ws.security.crypto.merlin.keystore.password" = password quarkus.cxf.endpoint."/sts".security.signature.properties."org.apache.ws.security.crypto.merlin.keystore.file" = sts.pkcs12
@WebService(portName = "TrustHelloServicePort", serviceName = "TrustHelloService", targetNamespace = "https://quarkiverse.github.io/quarkiverse-docs/quarkus-cxf/test/ws-trust", endpointInterface = "io.quarkiverse.cxf.it.ws.trust.server.TrustHelloService") public class TrustHelloServiceImpl implements TrustHelloService { @WebMethod @Override public String hello(String person) { return "Hello " + person + "!"; } }
@WebService(targetNamespace = "https://quarkiverse.github.io/quarkiverse-docs/quarkus-cxf/test/ws-trust") @Policy(placement = Policy.Placement.BINDING, uri = "classpath:/asymmetric-saml2-policy.xml") public interface TrustHelloService { @WebMethod @Policies({ @Policy(placement = Policy.Placement.BINDING_OPERATION_INPUT, uri = "classpath:/io-policy.xml"), @Policy(placement = Policy.Placement.BINDING_OPERATION_OUTPUT, uri = "classpath:/io-policy.xml") }) String hello(String person); }
quarkus.cxf.endpoint."/hello-ws-trust".implementor = io.quarkiverse.cxf.it.ws.trust.server.TrustHelloServiceImpl quarkus.cxf.endpoint."/hello-ws-trust".logging.enabled = pretty quarkus.cxf.endpoint."/hello-ws-trust".security.signature.username = service quarkus.cxf.endpoint."/hello-ws-trust".security.signature.password = password quarkus.cxf.endpoint."/hello-ws-trust".security.signature.properties."org.apache.ws.security.crypto.provider" = org.apache.ws.security.components.crypto.Merlin quarkus.cxf.endpoint."/hello-ws-trust".security.signature.properties."org.apache.ws.security.crypto.merlin.keystore.type" = pkcs12 quarkus.cxf.endpoint."/hello-ws-trust".security.signature.properties."org.apache.ws.security.crypto.merlin.keystore.password" = password quarkus.cxf.endpoint."/hello-ws-trust".security.signature.properties."org.apache.ws.security.crypto.merlin.keystore.alias" = service quarkus.cxf.endpoint."/hello-ws-trust".security.signature.properties."org.apache.ws.security.crypto.merlin.file" = service.pkcs12 quarkus.cxf.endpoint."/hello-ws-trust".security.encryption.properties."org.apache.ws.security.crypto.provider" = org.apache.ws.security.components.crypto.Merlin quarkus.cxf.endpoint."/hello-ws-trust".security.encryption.properties."org.apache.ws.security.crypto.merlin.keystore.type" = pkcs12 quarkus.cxf.endpoint."/hello-ws-trust".security.encryption.properties."org.apache.ws.security.crypto.merlin.keystore.password" = password quarkus.cxf.endpoint."/hello-ws-trust".security.encryption.properties."org.apache.ws.security.crypto.merlin.keystore.alias" = service quarkus.cxf.endpoint."/hello-ws-trust".security.encryption.properties."org.apache.ws.security.crypto.merlin.file" = service.pkcs12
quarkus.cxf.client.hello-ws-trust.security.sts.client.wsdl = http://localhost:USD{quarkus.http.test-port}/services/sts?wsdl quarkus.cxf.client.hello-ws-trust.security.sts.client.service-name = {http://docs.oasis-open.org/ws-sx/ws-trust/200512/}SecurityTokenService quarkus.cxf.client.hello-ws-trust.security.sts.client.endpoint-name = {http://docs.oasis-open.org/ws-sx/ws-trust/200512/}UT_Port quarkus.cxf.client.hello-ws-trust.security.sts.client.username = client quarkus.cxf.client.hello-ws-trust.security.sts.client.password = password quarkus.cxf.client.hello-ws-trust.security.sts.client.encryption.username = sts quarkus.cxf.client.hello-ws-trust.security.sts.client.encryption.properties."org.apache.ws.security.crypto.provider" = org.apache.ws.security.components.crypto.Merlin quarkus.cxf.client.hello-ws-trust.security.sts.client.encryption.properties."org.apache.ws.security.crypto.merlin.keystore.type" = pkcs12 quarkus.cxf.client.hello-ws-trust.security.sts.client.encryption.properties."org.apache.ws.security.crypto.merlin.keystore.password" = password quarkus.cxf.client.hello-ws-trust.security.sts.client.encryption.properties."org.apache.ws.security.crypto.merlin.keystore.alias" = client quarkus.cxf.client.hello-ws-trust.security.sts.client.encryption.properties."org.apache.ws.security.crypto.merlin.keystore.file" = client.pkcs12 quarkus.cxf.client.hello-ws-trust.security.sts.client.token.username = client quarkus.cxf.client.hello-ws-trust.security.sts.client.token.properties."org.apache.ws.security.crypto.provider" = org.apache.ws.security.components.crypto.Merlin quarkus.cxf.client.hello-ws-trust.security.sts.client.token.properties."org.apache.ws.security.crypto.merlin.keystore.type" = pkcs12 quarkus.cxf.client.hello-ws-trust.security.sts.client.token.properties."org.apache.ws.security.crypto.merlin.keystore.password" = password quarkus.cxf.client.hello-ws-trust.security.sts.client.token.properties."org.apache.ws.security.crypto.merlin.keystore.alias" = client quarkus.cxf.client.hello-ws-trust.security.sts.client.token.properties."org.apache.ws.security.crypto.merlin.keystore.file" = client.pkcs12 quarkus.cxf.client.hello-ws-trust.security.sts.client.token.usecert = true
quarkus.cxf.client.hello-ws-trust-bean.security.sts.client = #stsClientBean
import jakarta.enterprise.context.ApplicationScoped; import jakarta.enterprise.inject.Produces; import jakarta.inject.Named; import org.apache.cxf.ws.security.SecurityConstants; import io.quarkiverse.cxf.ws.security.sts.client.STSClientBean; public class BeanProducers { /** * Create and configure an STSClient for use by the TrustHelloService client. */ @Produces @ApplicationScoped @Named("stsClientBean") STSClientBean createSTSClient() { /* * We cannot use org.apache.cxf.ws.security.trust.STSClient as a return type of this bean producer method * because it does not have a no-args constructor. STSClientBean is a subclass of STSClient having one. */ STSClientBean stsClient = STSClientBean.create(); stsClient.setWsdlLocation("http://localhost:8081/services/sts?wsdl"); stsClient.setServiceQName(new QName("http://docs.oasis-open.org/ws-sx/ws-trust/200512/", "SecurityTokenService")); stsClient.setEndpointQName(new QName("http://docs.oasis-open.org/ws-sx/ws-trust/200512/", "UT_Port")); Map<String, Object> props = stsClient.getProperties(); props.put(SecurityConstants.USERNAME, "client"); props.put(SecurityConstants.PASSWORD, "password"); props.put(SecurityConstants.ENCRYPT_PROPERTIES, Thread.currentThread().getContextClassLoader().getResource("clientKeystore.properties")); props.put(SecurityConstants.ENCRYPT_USERNAME, "sts"); props.put(SecurityConstants.STS_TOKEN_USERNAME, "client"); props.put(SecurityConstants.STS_TOKEN_PROPERTIES, Thread.currentThread().getContextClassLoader().getResource("clientKeystore.properties")); props.put(SecurityConstants.STS_TOKEN_USE_CERT_FOR_KEYINFO, "true"); return stsClient; } }
<dependency> <groupId>io.quarkiverse.cxf</groupId> <artifactId>quarkus-cxf-rt-transports-http-hc5</artifactId> </dependency>
<?xml version="1.0"?> <bindings xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns="https://jakarta.ee/xml/ns/jaxws" wsdlLocation="CalculatorService.wsdl"> <bindings node="wsdl:definitions"> <enableAsyncMapping>true</enableAsyncMapping> </bindings> </bindings>
quarkus.cxf.codegen.wsdl2java.includes = wsdl/*.wsdl quarkus.cxf.codegen.wsdl2java.additional-params = -b,src/main/resources/wsdl/async-binding.xml
package io.quarkiverse.cxf.hc5.it; import java.util.concurrent.Future; import jakarta.inject.Inject; import jakarta.ws.rs.GET; import jakarta.ws.rs.Path; import jakarta.ws.rs.Produces; import jakarta.ws.rs.QueryParam; import jakarta.ws.rs.core.MediaType; import org.apache.cxf.endpoint.Client; import org.apache.cxf.frontend.ClientProxy; import org.jboss.eap.quickstarts.wscalculator.calculator.AddResponse; import org.jboss.eap.quickstarts.wscalculator.calculator.CalculatorService; import io.quarkiverse.cxf.annotation.CXFClient; import io.smallrye.mutiny.Uni; @Path("/hc5") public class Hc5Resource { @Inject @CXFClient("myCalculator") // name used in application.properties CalculatorService myCalculator; @SuppressWarnings("unchecked") @Path("/add-async") @GET @Produces(MediaType.TEXT_PLAIN) public Uni<Integer> addAsync(@QueryParam("a") int a, @QueryParam("b") int b) { return Uni.createFrom() .future( (Future<AddResponse>) myCalculator .addAsync(a, b, res -> { })) .map(addResponse -> addResponse.getReturn()); } }
<dependency> <groupId>io.quarkiverse.cxf</groupId> <artifactId>quarkus-cxf-xjc-plugins</artifactId> </dependency>
<project ...> <properties> <quarkus.platform.artifact-id>quarkus-bom</quarkus.platform.artifact-id> <quarkus.platform.group-id>io.quarkus.platform</quarkus.platform.group-id> <quarkus.platform.version><!-- Check the latest https://repo1.maven.org/maven2/io/quarkus/platform/quarkus-cxf-bom/ --></quarkus.platform.version> </properties> <dependencyManagement> <dependencies> <dependency> <groupId>USD{quarkus.platform.group-id}</groupId> <artifactId>USD{quarkus.platform.artifact-id}</artifactId> <version>USD{quarkus.platform.version}</version> <type>pom</type> <scope>import</scope> </dependency> <dependency> <groupId>USD{quarkus.platform.group-id}</groupId> <artifactId>quarkus-cxf-bom</artifactId> <version>USD{quarkus.platform.version}</version> <type>pom</type> <scope>import</scope> </dependency> </dependencies> </dependencyManagement>
package io.quarkiverse.cxf.it.server; import jakarta.jws.WebMethod; import jakarta.jws.WebService; /** * The simplest Hello service. */ @WebService(name = "HelloService", serviceName = "HelloService") public interface HelloService { @WebMethod String hello(String text); }
package io.quarkiverse.cxf.it.server; import jakarta.jws.WebMethod; import jakarta.jws.WebService; /** * The simplest Hello service implementation. */ @WebService(serviceName = "HelloService") public class HelloServiceImpl implements HelloService { @WebMethod @Override public String hello(String text) { return "Hello " + text + "!"; } }
The context path under which all services will be available quarkus.cxf.path = /soap Publish "HelloService" under the context path /USD{quarkus.cxf.path}/hello quarkus.cxf.endpoint."/hello".implementor = io.quarkiverse.cxf.it.server.HelloServiceImpl quarkus.cxf.endpoint."/hello".features = org.apache.cxf.ext.logging.LoggingFeature
mvn quarkus:dev
curl http://localhost:8080/soap/hello?wsdl <?xml version='1.0' encoding='UTF-8'?> <wsdl:definitions xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:tns="http://server.it.cxf.quarkiverse.io/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:ns1="http://schemas.xmlsoap.org/soap/http" name="HelloService" targetNamespace="http://server.it.cxf.quarkiverse.io/"> <wsdl:types> <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:tns="http://server.it.cxf.quarkiverse.io/" attributeFormDefault="unqualified" elementFormDefault="unqualified" targetNamespace="http://server.it.cxf.quarkiverse.io/"> <xsd:element name="hello" type="tns:hello"/> <xsd:complexType name="hello"> <xsd:sequence> <xsd:element minOccurs="0" name="arg0" type="xsd:string"/> </xsd:sequence> </xsd:complexType> <xsd:element name="helloResponse" type="tns:helloResponse"/> <xsd:complexType name="helloResponse"> <xsd:sequence> <xsd:element minOccurs="0" name="return" type="xsd:string"/> </xsd:sequence> </xsd:complexType> </xsd:schema> </wsdl:types> <wsdl:message name="helloResponse"> <wsdl:part element="tns:helloResponse" name="parameters"> </wsdl:part> </wsdl:message> <wsdl:message name="hello"> <wsdl:part element="tns:hello" name="parameters"> </wsdl:part> </wsdl:message> <wsdl:portType name="HelloService"> <wsdl:operation name="hello"> <wsdl:input message="tns:hello" name="hello"> </wsdl:input> <wsdl:output message="tns:helloResponse" name="helloResponse"> </wsdl:output> </wsdl:operation> </wsdl:portType> <wsdl:binding name="HelloServiceSoapBinding" type="tns:HelloService"> <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/> <wsdl:operation name="hello"> <soap:operation soapAction="" style="document"/> <wsdl:input name="hello"> <soap:body use="literal"/> </wsdl:input> <wsdl:output name="helloResponse"> <soap:body use="literal"/> </wsdl:output> </wsdl:operation> </wsdl:binding> <wsdl:service name="HelloService"> <wsdl:port binding="tns:HelloServiceSoapBinding" name="HelloServicePort"> <soap:address location="http://localhost:8080/soap/hello"/> </wsdl:port> </wsdl:service> </wsdl:definitions>
curl -v -X POST -H "Content-Type: text/xml;charset=UTF-8" -d '<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> <soap:Body><ns2:hello xmlns:ns2="http://server.it.cxf.quarkiverse.io/"><arg0>World</arg0></ns2:hello></soap:Body> </soap:Envelope>' http://localhost:8080/soap/hello <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> <soap:Body> <ns1:helloResponse xmlns:ns1="http://server.it.cxf.quarkiverse.io/"> <return>Hello World!</return> </ns1:helloResponse> </soap:Body> </soap:Envelope>
<dependency> <groupId>io.quarkiverse.cxf</groupId> <artifactId>quarkus-cxf-rt-features-logging</artifactId> </dependency>
quarkus.cxf.endpoint."/hello".features=org.apache.cxf.ext.logging.LoggingFeature
2023-01-11 22:12:21,315 INFO [org.apa.cxf.ser.Hel.REQ_IN] (vert.x-worker-thread-0) REQ_IN Address: http://localhost:8080/soap/hello HttpMethod: POST Content-Type: text/xml;charset=UTF-8 ExchangeId: af10747a-8477-4c17-bf5f-2a4a3a95d61c ServiceName: HelloService PortName: HelloServicePort PortTypeName: HelloService Headers: {Accept=*/*, User-Agent=curl/7.79.1, content-type=text/xml;charset=UTF-8, Host=localhost:8080, Content-Length=203, x-quarkus-hot-deployment-done=true} Payload: <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> <soap:Body><ns2:hello xmlns:ns2="http://server.it.cxf.quarkiverse.io/"><arg0>World</arg0></ns2:hello></soap:Body> </soap:Envelope> 2023-01-11 22:12:21,327 INFO [org.apa.cxf.ser.Hel.RESP_OUT] (vert.x-worker-thread-0) RESP_OUT Address: http://localhost:8080/soap/hello Content-Type: text/xml ResponseCode: 200 ExchangeId: af10747a-8477-4c17-bf5f-2a4a3a95d61c ServiceName: HelloService PortName: HelloServicePort PortTypeName: HelloService Headers: {} Payload: <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><soap:Body><ns1:helloResponse xmlns:ns1="http://server.it.cxf.quarkiverse.io/"><return>Hello World!</return></ns1:helloResponse></soap:Body></soap:Envelope>
docker run -p 8082:8080 quay.io/l2x6/calculator-ws:1.0
curl -s http://localhost:8082/calculator-ws/CalculatorService?wsdl <?xml version="1.0" ?> <wsdl:definitions xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:tns="http://www.jboss.org/eap/quickstarts/wscalculator/Calculator" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:ns1="http://schemas.xmlsoap.org/soap/http" name="CalculatorService" targetNamespace="http://www.jboss.org/eap/quickstarts/wscalculator/Calculator"> <wsdl:binding name="CalculatorServiceSoapBinding" type="tns:CalculatorService"> <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"></soap:binding> <wsdl:operation name="add"> <soap:operation soapAction="" style="document"></soap:operation> <wsdl:input name="add"> <soap:body use="literal"></soap:body> </wsdl:input> <wsdl:output name="addResponse"> <soap:body use="literal"></soap:body> </wsdl:output> </wsdl:operation> <wsdl:operation name="subtract"> <soap:operation soapAction="" style="document"></soap:operation> <wsdl:input name="subtract"> <soap:body use="literal"></soap:body> </wsdl:input> <wsdl:output name="subtractResponse"> <soap:body use="literal"></soap:body> </wsdl:output> </wsdl:operation> </wsdl:binding> </wsdl:definitions>
curl -s -X POST -H "Content-Type: text/xml;charset=UTF-8" -d '<Envelope xmlns="http://schemas.xmlsoap.org/soap/envelope/"> <Body> <add xmlns="http://www.jboss.org/eap/quickstarts/wscalculator/Calculator"> <arg0 xmlns="">7</arg0> 1 <arg1 xmlns="">4</arg1> </add> </Body> </Envelope>' http://localhost:8082/calculator-ws/CalculatorService <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> <soap:Body> <ns2:addResponse xmlns:ns2="http://www.jboss.org/eap/quickstarts/wscalculator/Calculator"> <return>11</return> 2 </ns2:addResponse> </soap:Body> </soap:Envelope>
package io.quarkiverse.cxf.client.it; import jakarta.ws.rs.GET; import jakarta.ws.rs.Path; import jakarta.ws.rs.Produces; import jakarta.ws.rs.QueryParam; import jakarta.ws.rs.core.MediaType; import org.jboss.eap.quickstarts.wscalculator.calculator.CalculatorService; import io.quarkiverse.cxf.annotation.CXFClient; @Path("/cxf/calculator-client") public class CxfClientRestResource { @CXFClient("myCalculator") 1 CalculatorService myCalculator; @GET @Path("/add") @Produces(MediaType.TEXT_PLAIN) public int add(@QueryParam("a") int a, @QueryParam("b") int b) { return myCalculator.add(a, b); 2 } }
cxf.it.calculator.baseUri=http://localhost:8082 quarkus.cxf.client.myCalculator.wsdl = USD{cxf.it.calculator.baseUri}/calculator-ws/CalculatorService?wsdl quarkus.cxf.client.myCalculator.client-endpoint-url = USD{cxf.it.calculator.baseUri}/calculator-ws/CalculatorService quarkus.cxf.client.myCalculator.service-interface = org.jboss.eap.quickstarts.wscalculator.calculator.CalculatorService
mvn quarkus:dev INFO [io.quarkus] (Quarkus Main Thread) ... Listening on: http://localhost:8080
curl -s 'http://localhost:8080/cxf/calculator-client/add?a=5&b=6' 11
bean reference by type quarkus.cxf.endpoint."/hello".features = org.apache.cxf.ext.logging.LoggingFeature
bean reference by bean name quarkus.cxf.endpoint."/fruit".features = #myCustomLoggingFeature
import org.apache.cxf.ext.logging.LoggingFeature; import javax.enterprise.context.ApplicationScoped; import javax.enterprise.inject.Produces; class Producers { @Produces @ApplicationScoped @Named("myCustomLoggingFeature") LoggingFeature myCustomLoggingFeature() { LoggingFeature loggingFeature = new LoggingFeature(); loggingFeature.setPrettyLogging(true); return loggingFeature; } }
mvn package
ls -lh target/quarkus-app drwxr-xr-x. 2 ppalaga ppalaga 4.0K Jan 12 22:29 app drwxr-xr-x. 4 ppalaga ppalaga 4.0K Jan 12 22:29 lib drwxr-xr-x. 2 ppalaga ppalaga 4.0K Jan 12 22:29 quarkus -rw-r-r--. 1 ppalaga ppalaga 6.1K Jan 12 22:29 quarkus-app-dependencies.txt -rw-r-r--. 1 ppalaga ppalaga 678 Jan 12 22:29 quarkus-run.jar
java -jar target/quarkus-app/quarkus-run.jar
<profile> <id>native</id> <activation> <property> <name>native</name> </property> </activation> <properties> <skipITs>false</skipITs> <quarkus.package.type>native</quarkus.package.type> </properties> </profile>
Make sure USDGRAALVM_HOME is set properly echo USDGRAALVM_HOME /home/{user}/.sdkman/candidates/java/{major}.{minor}.r{java-version}-grl Produce the native executable mvn package -Pnative
Produce the native executable mvn package -Pnative -Dquarkus.native.container-build=true
ls -l target -rwxr-xr-x. 1 ppalaga ppalaga 71M Jan 11 22:42 quarkus-cxf-integration-test-server-1.8.0-SNAPSHOT-runner
target/*-runner INFO [io.quarkus] (main) quarkus-cxf-integration-test-server 1.8.0-SNAPSHOT native (powered by Quarkus 2.15.2.Final) started in 0.042s. Listening on: http://0.0.0.0:8080
Global settings quarkus.cxf.logging.enabled-for = both quarkus.cxf.logging.pretty = true
For a service: quarkus.cxf.endpoint."/hello".logging.enabled = true quarkus.cxf.endpoint."/hello".logging.pretty = true For a client: quarkus.cxf.client.hello.logging.enabled = true quarkus.cxf.client.hello.logging.pretty = true
For a service: quarkus.cxf.endpoint."/hello".features = org.apache.cxf.ext.logging.LoggingFeature For a client: quarkus.cxf.client."myClient".features = org.apache.cxf.ext.logging.LoggingFeature
@org.apache.cxf.feature.Features (features = {"org.apache.cxf.ext.logging.LoggingFeature"}) @WebService(endpointInterface = "org.acme.SayHi", targetNamespace = "uri:org.acme") public class SayHiImplementation implements SayHi { public long sayHi(long arg) { return arg; } // }
import org.apache.cxf.ext.logging.LoggingFeature; import jakarta.enterprise.context.ApplicationScoped; import jakarta.enterprise.inject.Produces; class Producers { @Produces @ApplicationScoped @Named("limitedLoggingFeature") // "limitedLoggingFeature" is redundant if the name of the method is the same LoggingFeature limitedLoggingFeature() { LoggingFeature loggingFeature = new LoggingFeature(); loggingFeature.setPrettyLogging(true); loggingFeature.setLimit(1024); return loggingFeature; } }
For a service: quarkus.cxf.endpoint."/hello".features = #limitedLoggingFeature For a client: quarkus.cxf.client.hello.features = #limitedLoggingFeature
package io.quarkiverse.cxf.it.server; import java.util.Objects; import jakarta.xml.bind.annotation.XmlElement; import jakarta.xml.bind.annotation.XmlRootElement; import jakarta.xml.bind.annotation.XmlType; @XmlType(name = "Fruit") @XmlRootElement public class Fruit { private String name; private String description; public Fruit() { } public Fruit(String name, String description) { this.name = name; this.description = description; } public String getName() { return name; } @XmlElement public void setName(String name) { this.name = name; } public String getDescription() { return description; } @XmlElement public void setDescription(String description) { this.description = description; } @Override public boolean equals(Object obj) { if (!(obj instanceof Fruit)) { return false; } Fruit other = (Fruit) obj; return Objects.equals(other.getName(), this.getName()); } @Override public int hashCode() { return Objects.hash(this.getName()); } }
package io.quarkiverse.cxf.it.server; import java.util.Set; import jakarta.jws.WebMethod; import jakarta.jws.WebService; @WebService public interface FruitService { @WebMethod Set<Fruit> list(); @WebMethod Set<Fruit> add(Fruit fruit); @WebMethod Set<Fruit> delete(Fruit fruit); }
package io.quarkiverse.cxf.it.server; import java.util.Collections; import java.util.LinkedHashSet; import java.util.Set; import jakarta.jws.WebService; @WebService(serviceName = "FruitService") public class FruitServiceImpl implements FruitService { private Set<Fruit> fruits = Collections.synchronizedSet(new LinkedHashSet<>()); public FruitServiceImpl() { fruits.add(new Fruit("Apple", "Winter fruit")); fruits.add(new Fruit("Pineapple", "Tropical fruit")); } @Override public Set<Fruit> list() { return fruits; } @Override public Set<Fruit> add(Fruit fruit) { fruits.add(fruit); return fruits; } @Override public Set<Fruit> delete(Fruit fruit) { fruits.remove(fruit); return fruits; } }
quarkus.cxf.endpoint."/fruits".implementor = io.quarkiverse.cxf.it.server.FruitServiceImpl quarkus.cxf.endpoint."/fruits".features = org.apache.cxf.ext.logging.LoggingFeature
mvn quarkus:dev INFO [io.quarkus] (Quarkus Main Thread) ... Listening on: http://localhost:8080
curl -v -X POST -H "Content-Type: text/xml;charset=UTF-8" -d '<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://server.it.cxf.quarkiverse.io/"> <soapenv:Body> <ns1:list/> </soapenv:Body> </soapenv:Envelope>' http://localhost:8080/soap/fruits <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> <soap:Body> <ns1:listResponse xmlns:ns1="http://server.it.cxf.quarkiverse.io/"> <return xmlns:ns2="http://server.it.cxf.quarkiverse.io/"> <description>Winter fruit</description> <name>Apple</name> </return> <return xmlns:ns2="http://server.it.cxf.quarkiverse.io/"> <description>Tropical fruit</description> <name>Pineapple</name> </return> </ns1:listResponse> </soap:Body> </soap:Envelope>
curl -v -X POST -H "Content-Type: text/xml;charset=UTF-8" -d '<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> <soap:Body> <ns2:add xmlns:ns2="http://server.it.cxf.quarkiverse.io/"> <arg0> <description>Mediterranean fruit</description> <name>Orange</name> </arg0> </ns2:add> </soap:Body></soap:Envelope>' http://localhost:8080/soap/fruits <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> <soap:Body> <ns1:addResponse xmlns:ns1="http://server.it.cxf.quarkiverse.io/"> <return xmlns:ns2="http://server.it.cxf.quarkiverse.io/"> <description>Winter fruit</description> <name>Apple</name> </return> <return xmlns:ns2="http://server.it.cxf.quarkiverse.io/"> <description>Tropical fruit</description> <name>Pineapple</name> </return> <return xmlns:ns2="http://server.it.cxf.quarkiverse.io/"> <description>Mediterranean fruit</description> <name>Orange</name> </return> </ns1:addResponse> </soap:Body> </soap:Envelope>
<plugin> <groupId>io.quarkus</groupId> <artifactId>quarkus-maven-plugin</artifactId> <executions> <execution> <goals> <goal>build</goal> <goal>generate-code</goal> </goals> </execution> </executions> </plugin>
quarkus.cxf.codegen.wsdl2java.includes = wsdl/*.wsdl
Parameters for foo.wsdl quarkus.cxf.codegen.wsdl2java.foo-params.includes = wsdl/foo.wsdl quarkus.cxf.codegen.wsdl2java.foo-params.wsdl-location = wsdl/foo.wsdl Parameters for bar.wsdl quarkus.cxf.codegen.wsdl2java.bar-params.includes = wsdl/bar.wsdl quarkus.cxf.codegen.wsdl2java.bar-params.wsdl-location = wsdl/bar.wsdl quarkus.cxf.codegen.wsdl2java.bar-params.xjc = ts
[quarkus-dalkia-ticket-loader-1.0.0-SNAPSHOT-runner:26] compile: 161 459,15 ms, 8,54 GB [quarkus-dalkia-ticket-loader-1.0.0-SNAPSHOT-runner:26] image: 158 272,73 ms, 8,43 GB [quarkus-dalkia-ticket-loader-1.0.0-SNAPSHOT-runner:26] write: 205,82 ms, 8,43 GB Fatal error:com.oracle.svm.core.util.VMErrorUSDHostedError: java.lang.RuntimeException: oops : expected ASCII string! com.oracle.svm.reflect.OperationOrderStatusType_CREE_f151156b0d42ecdbdfb919501d8a86dda8733012_1456.hashCode at com.oracle.svm.core.util.VMError.shouldNotReachHere(VMError.java:72)
@XmlType(name = "OperationOrderStatusType") @XmlEnum public enum OperationOrderStatusType { @XmlEnumValue("Cr\u00e9\u00e9") CREE("Cr\u00e9\u00e9"), @XmlEnumValue("A communiquer") A_COMMUNIQUER("A communiquer"), @XmlEnumValue("En attente de r\u00e9ponse") EN_ATTENTE_DE_REPONSE("En attente de r\u00e9ponse"), @XmlEnumValue("Attribu\u00e9") ATTRIBUE("Attribu\u00e9"), @XmlEnumValue("Clotur\u00e9") CLOTURE("Clotur\u00e9"), @XmlEnumValue("Annul\u00e9") ANNULE("Annul\u00e9"); private final String value; OperationOrderStatusType(String v) { value = v; } public String value() { return value; } public static OperationOrderStatusType fromValue(String v) { for (OperationOrderStatusType c: OperationOrderStatusType.values()) { if (c.value.equals(v)) { return c; } } throw new IllegalArgumentException(v); } }
@XmlType(name = "OperationOrderStatusType") @XmlEnum public enum OperationOrderStatusType { @XmlEnumValue("Cree") CREE("Cree"), @XmlEnumValue("A communiquer") A_COMMUNIQUER("A communiquer"), @XmlEnumValue("En attente de reponse") EN_ATTENTE_DE_REPONSE("En attente de reponse"), @XmlEnumValue("Attribue") ATTRIBUE("Attribue"), @XmlEnumValue("Cloture") CLOTURE("Cloture"), @XmlEnumValue("Annule") ANNULE("Annule"); private final String value; OperationOrderStatusType(String v) { value = v; } public String value() { return value; } public static OperationOrderStatusType fromValue(String v) { for (OperationOrderStatusType c: OperationOrderStatusType.values()) { if (c.value.equals(v)) { return c; } } throw new IllegalArgumentException(v); } }
quarkus.cxf.java2ws.includes = io.quarkiverse.cxf.it.server.HelloServiceImpl,io.quarkiverse.cxf.it.server.FaultyHelloServiceImpl quarkus.cxf.java2ws.wsdl-name-template = %TARGET_DIR%/Java2wsTest/%SIMPLE_CLASS_NAME%-from-java2ws.wsdl
@org.apache.cxf.feature.Features (features = {"org.apache.cxf.ext.logging.LoggingFeature"}) @org.apache.cxf.interceptor.InInterceptors (interceptors = {"org.acme.Test1Interceptor" }) @org.apache.cxf.interceptor.InFaultInterceptors (interceptors = {"org.acme.Test2Interceptor" }) @org.apache.cxf.interceptor.OutInterceptors (interceptors = {"org.acme.Test1Interceptor" }) @org.apache.cxf.interceptor.InFaultInterceptors (interceptors = {"org.acme.Test2Interceptor","org.acme.Test3Intercetpor" }) @WebService(endpointInterface = "org.acme.SayHi", targetNamespace = "uri:org.acme") public class SayHiImplementation implements SayHi { public long sayHi(long arg) { return arg; } // }
quarkus.cxf.endpoint."/greeting-service".features=org.apache.cxf.ext.logging.LoggingFeature quarkus.cxf.endpoint."/greeting-service".in-interceptors=org.acme.Test1Interceptor quarkus.cxf.endpoint."/greeting-service".out-interceptors=org.acme.Test1Interceptor quarkus.cxf.endpoint."/greeting-service".in-fault-interceptors=org.acme.Test2Interceptor,org.acme.Test3Intercetpor quarkus.cxf.endpoint."/greeting-service".out-fault-interceptors=org.acme.Test1Intercetpor
A web service endpoint with multiple Handler classes quarkus.cxf.endpoint."/greeting-service".handlers=org.acme.MySOAPHandler,org.acme.AnotherSOAPHandler A web service client with a single Handler quarkus.cxf.client."greeting-client".handlers=org.acme.MySOAPHandler
import jakarta.xml.ws.handler.soap.SOAPHandler; import jakarta.xml.ws.handler.soap.SOAPMessageContext; public class MySOAPHandler implements SOAPHandler<SOAPMessageContext> { public boolean handleMessage(SOAPMessageContext messageContext) { SOAPMessage msg = messageContext.getMessage(); return true; } // other methods }
The context path under which all services will be available quarkus.cxf.path = /soap Publish "HelloService" under the context path /USD{quarkus.cxf.path}/hello quarkus.cxf.endpoint."/hello".implementor = io.quarkiverse.cxf.it.server.HelloServiceImpl quarkus.cxf.endpoint."/hello".features = org.apache.cxf.ext.logging.LoggingFeature
package io.quarkiverse.cxf.it.annotation.cxfendpoint; import jakarta.jws.WebService; import io.quarkiverse.cxf.annotation.CXFEndpoint; import io.quarkiverse.cxf.it.HelloService; @CXFEndpoint("/path-annotation") 1 @WebService(serviceName = "HelloService", targetNamespace = HelloService.NS) public class PathAnnotationHelloServiceImpl implements HelloService { @Override public String hello(String person) { return "Hello " + person + " from PathAnnotationHelloServiceImpl!"; } }
package io.quarkiverse.cxf.it.annotation.cxfendpoint; import org.assertj.core.api.Assertions; import org.junit.jupiter.api.Test; import org.mockito.Mockito; import io.quarkiverse.cxf.annotation.CXFClient; import io.quarkiverse.cxf.annotation.CXFEndpoint; import io.quarkiverse.cxf.it.HelloService; import io.quarkus.test.junit.QuarkusTest; @QuarkusTest public class MockedEndpointTest { @CXFEndpoint("/helloMock") 1 HelloService helloMockService() { final HelloService result = Mockito.mock(HelloService.class); Mockito.when(result.hello("Mock")).thenReturn("Hello Mock!"); return result; } @CXFClient("helloMock") 2 HelloService helloMockClient; @Test void helloMock() { Assertions.assertThat(helloMockClient.hello("Mock")).isEqualTo("Hello Mock!"); 3 } }
import jakarta.xml.transform.stream.StreamSource; import jakarta.xml.ws.BindingType; import jakarta.xml.ws.Provider; import jakarta.xml.ws.Service; import jakarta.xml.ws.ServiceMode; import jakarta.xml.ws.WebServiceProvider; import java.io.StringReader; @WebServiceProvider @ServiceMode(value = Service.Mode.PAYLOAD) public class StreamSourcePayloadProvider implements Provider<StreamSource> { public StreamSourcePayloadProvider() { } public StreamSource invoke(StreamSource request) { String payload = StaxUtils.toString(request); // Do some interesting things StreamSource response = new StreamSource(new StringReader(payload)); return response; } }
A web service endpoint with the Provider implementation class quarkus.cxf.endpoint."/stream-source".implementor=org.acme.StreamSourcePayloadProvider
package org.acme.cxf; import @Slf4j @WebService(endpointInterface = "org.acme.cxf.WeatherWebService") public class WeatherWebServiceImpl implements WeatherWebService { @Inject BackEndWeatherService backEndWeatherService; private Map<String, DailyTemperature> dailyTempByZipCode = Collections.synchronizedMap(new LinkedHashMap<>()); public WeatherWebServiceImpl() { this.dailyTempByZipCode.addAll( this.backEndWeatherService.getDailyForecast(Instant.now())); } @Override public DailyTemperature estimationTemperatures(String zipCode) { log.info("Daily estimation temperatures forecast called with '{}' zip code paramter", zipCode); return this.dailyTempByZipCode.get(zipCode); } }
quarkus.cxf.path=/soap quarkus.cxf.endpoint."/weather".implementor=org.acme.cxf.WeatherWebServiceImpl
package org.acme.reasteasy; import @Slf4j @Path("/healthcheck") public class HealthCheckResource { @Inject BackEndWeatherService backEndWeatherService; @GET public Response doHealthCheck() { if(this.backEndWeatherService.isAvailable()) { return Response.ok().build(); } else { return Response.status(Response.Status.SERVICE_UNAVAILABLE); } } }
quarkus.resteasy.path=/rest
quarkus.http.proxy.proxy-address-forwarding = true quarkus.http.proxy.enable-forwarded-host = true quarkus.http.proxy.enable-forwarded-prefix = true
X-Forwarded-Proto: https X-Forwarded-Host: api.example.com X-Forwarded-Port: 443 X-Forwarded-Prefix: /my-prefix
<soap:address location="https://api.example.com:443/my-prefix/services/my-service"/>
cxf.it.calculator.baseUri = http://localhost:8082 quarkus.cxf.client.myCalculator.wsdl = USD{cxf.it.calculator.baseUri}/calculator-ws/CalculatorService?wsdl quarkus.cxf.client.myCalculator.client-endpoint-url = USD{cxf.it.calculator.baseUri}/calculator-ws/CalculatorService quarkus.cxf.client.myCalculator.service-interface = org.jboss.eap.quickstarts.wscalculator.calculator.CalculatorService another client quarkus.cxf.client.anotherCalculator.wsdl = https://acme.com/ws/WeatherService?wsdl quarkus.cxf.client.anotherCalculator.client-endpoint-url = https://acme.com/ws/WeatherService quarkus.cxf.client.anotherCalculator.service-interface = org.jboss.eap.quickstarts.wscalculator.calculator.CalculatorService
import io.quarkus.runtime.StartupEvent; import jakarta.enterprise.event.Observes; import org.apache.cxf.Bus; import org.apache.cxf.BusFactory; import org.apache.cxf.transport.http.HTTPConduit; import org.apache.cxf.transport.http.HTTPConduitConfigurer; void onStart(@Observes StartupEvent ev) { HTTPConduitConfigurer httpConduitConfigurer = new HTTPConduitConfigurer() { public void configure(String name, String address, HTTPConduit conduit) { conduit.getClient().setAllowChunking(false); conduit.getClient().setAutoRedirect(true); } }; final Bus bus = BusFactory.getDefaultBus(); bus.setExtension(httpConduitConfigurer, HTTPConduitConfigurer.class); }
package io.quarkiverse.cxf.client.it; import java.util.Map; import jakarta.enterprise.context.RequestScoped; import jakarta.ws.rs.GET; import jakarta.ws.rs.Path; import jakarta.ws.rs.Produces; import jakarta.ws.rs.QueryParam; import jakarta.ws.rs.core.MediaType; import jakarta.xml.ws.BindingProvider; import org.jboss.eap.quickstarts.wscalculator.calculator.CalculatorService; import io.quarkiverse.cxf.annotation.CXFClient; /* * The @RequestScoped annotation causes that the REST resource is instantiated * anew for every call of the add() method. Therefore also a new client instance * is injected into the calculator field for every request served by add(). */ @RequestScoped @Path("/cxf/dynamic-client") public class DynamicClientConfigRestResource { @CXFClient("requestScopedVertxHttpClient") CalculatorService calculator; @GET @Path("/add") @Produces(MediaType.TEXT_PLAIN) public int add(@QueryParam("a") int a, @QueryParam("b") int b, @QueryParam("baseUri") String baseUri) { Map<String, Object> ctx = ((BindingProvider) calculator).getRequestContext(); /* We are setting the remote URL safely, because the client is associated exclusively with the current request */ ctx.put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, baseUri + "/calculator-ws/CalculatorService"); return calculator.add(a, b); } }
quarkus.http.host-enabled = false
import java.net.URL; import javax.xml.namespace.QName; import jakarta.xml.ws.Service; import java.io.Closeable; final URL serviceUrl = new URL("http://localhost/myService?wsdl"); final QName qName = new QName("http://acme.org/myNamespace", "MyService"); final Service service = jakarta.xml.ws.Service.create(serviceUrl, qName); final MyService proxy = service.getPort(MyService.class); try { proxy.doSomething(); } finally { ((Closeable) proxy).close(); }
Client side SSL quarkus.cxf.client.hello.client-endpoint-url = https://localhost:USD{quarkus.http.test-ssl-port}/services/hello quarkus.cxf.client.hello.service-interface = io.quarkiverse.cxf.it.security.policy.HelloService 1 quarkus.cxf.client.hello.trust-store-type = pkcs12 2 quarkus.cxf.client.hello.trust-store = client-truststore.pkcs12 quarkus.cxf.client.hello.trust-store-password = client-truststore-password
Server side SSL quarkus.tls.key-store.p12.path = localhost-keystore.pkcs12 quarkus.tls.key-store.p12.password = localhost-keystore-password quarkus.tls.key-store.p12.alias = localhost quarkus.tls.key-store.p12.alias-password = localhost-keystore-password
Server keystore for Simple TLS quarkus.tls.localhost-pkcs12.key-store.p12.path = localhost-keystore.pkcs12 quarkus.tls.localhost-pkcs12.key-store.p12.password = localhost-keystore-password quarkus.tls.localhost-pkcs12.key-store.p12.alias = localhost quarkus.tls.localhost-pkcs12.key-store.p12.alias-password = localhost-keystore-password Server truststore for Mutual TLS quarkus.tls.localhost-pkcs12.trust-store.p12.path = localhost-truststore.pkcs12 quarkus.tls.localhost-pkcs12.trust-store.p12.password = localhost-truststore-password Select localhost-pkcs12 as the TLS configuration for the HTTP server quarkus.http.tls-configuration-name = localhost-pkcs12 Do not allow any clients which do not prove their indentity through an SSL certificate quarkus.http.ssl.client-auth = required CXF service quarkus.cxf.endpoint."/mTls".implementor = io.quarkiverse.cxf.it.auth.mtls.MTlsHelloServiceImpl CXF client with a properly set certificate for mTLS quarkus.cxf.client.mTls.client-endpoint-url = https://localhost:USD{quarkus.http.test-ssl-port}/services/mTls quarkus.cxf.client.mTls.service-interface = io.quarkiverse.cxf.it.security.policy.HelloService quarkus.cxf.client.mTls.key-store = target/classes/client-keystore.pkcs12 quarkus.cxf.client.mTls.key-store-type = pkcs12 quarkus.cxf.client.mTls.key-store-password = client-keystore-password quarkus.cxf.client.mTls.key-password = client-keystore-password quarkus.cxf.client.mTls.trust-store = target/classes/client-truststore.pkcs12 quarkus.cxf.client.mTls.trust-store-type = pkcs12 quarkus.cxf.client.mTls.trust-store-password = client-truststore-password Include the keystores in the native executable quarkus.native.resources.includes = *.pkcs12,*.jks
<?xml version="1.0" encoding="UTF-8"?> <wsp:Policy wsp:Id="HttpsSecurityServicePolicy" xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:sp="http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> <wsp:ExactlyOne> <wsp:All> <sp:TransportBinding> <wsp:Policy> <sp:TransportToken> <wsp:Policy> <sp:HttpsToken RequireClientCertificate="false" /> </wsp:Policy> </sp:TransportToken> <sp:IncludeTimestamp /> <sp:AlgorithmSuite> <wsp:Policy> <sp:Basic128 /> </wsp:Policy> </sp:AlgorithmSuite> </wsp:Policy> </sp:TransportBinding> </wsp:All> </wsp:ExactlyOne> </wsp:Policy>
package io.quarkiverse.cxf.it.security.policy; import jakarta.jws.WebMethod; import jakarta.jws.WebService; import org.apache.cxf.annotations.Policy; /** * A service implementation with a transport policy set */ @WebService(serviceName = "HttpsPolicyHelloService") @Policy(placement = Policy.Placement.BINDING, uri = "https-policy.xml") public interface HttpsPolicyHelloService extends AbstractHelloService { @WebMethod @Override public String hello(String text); }
ERROR [org.apa.cxf.ws.pol.PolicyVerificationInInterceptor] Inbound policy verification failed: These policy alternatives can not be satisfied: {http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702}TransportBinding: TLS is not enabled
quarkus.cxf.client.basicAuth.wsdl = http://localhost:USD{quarkus.http.test-port}/soap/basicAuth?wsdl quarkus.cxf.client.basicAuth.client-endpoint-url = http://localhost:USD{quarkus.http.test-port}/soap/basicAuth quarkus.cxf.client.basicAuth.username = bob quarkus.cxf.client.basicAuth.password = bob234
quarkus.cxf.client.basicAuthSecureWsdl.wsdl = http://localhost:USD{quarkus.http.test-port}/soap/basicAuth?wsdl quarkus.cxf.client.basicAuthSecureWsdl.client-endpoint-url = http://localhost:USD{quarkus.http.test-port}/soap/basicAuthSecureWsdl quarkus.cxf.client.basicAuthSecureWsdl.username = bob quarkus.cxf.client.basicAuthSecureWsdl.password = USD{client-server.bob.password} quarkus.cxf.client.basicAuthSecureWsdl.secure-wsdl-access = true
quarkus.http.auth.basic = true quarkus.security.users.embedded.enabled = true quarkus.security.users.embedded.plain-text = true quarkus.security.users.embedded.users.alice = alice123 quarkus.security.users.embedded.roles.alice = admin quarkus.security.users.embedded.users.bob = bob234 quarkus.security.users.embedded.roles.bob = app-user
package io.quarkiverse.cxf.it.auth.basic; import jakarta.annotation.security.RolesAllowed; import jakarta.jws.WebService; import io.quarkiverse.cxf.it.HelloService; @WebService(serviceName = "HelloService", targetNamespace = HelloService.NS) @RolesAllowed("app-user") public class BasicAuthHelloServiceImpl implements HelloService { @Override public String hello(String person) { return "Hello " + person + "!"; } }
<?xml version="1.0" encoding="UTF-8"?> <wsp:Policy wsp:Id="UsernameTokenSecurityServicePolicy" xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:sp="http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702" xmlns:sp13="http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200802" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> <wsp:ExactlyOne> <wsp:All> <sp:SupportingTokens> <wsp:Policy> <sp:UsernameToken sp:IncludeToken="http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702/IncludeToken/AlwaysToRecipient"> <wsp:Policy> <sp:WssUsernameToken11 /> <sp13:Created /> <sp13:Nonce /> </wsp:Policy> </sp:UsernameToken> </wsp:Policy> </sp:SupportingTokens> </wsp:All> </wsp:ExactlyOne> </wsp:Policy>
@WebService(serviceName = "UsernameTokenPolicyHelloService") @Policy(placement = Policy.Placement.BINDING, uri = "username-token-policy.xml") public interface UsernameTokenPolicyHelloService extends AbstractHelloService { }
A service with a UsernameToken policy assertion quarkus.cxf.endpoint."/helloUsernameToken".implementor = io.quarkiverse.cxf.it.security.policy.UsernameTokenPolicyHelloServiceImpl quarkus.cxf.endpoint."/helloUsernameToken".security.callback-handler = #usernameTokenPasswordCallback These properties are used in UsernameTokenPasswordCallback and in the configuration of the helloUsernameToken below wss.user = cxf-user wss.password = secret A client with a UsernameToken policy assertion quarkus.cxf.client.helloUsernameToken.client-endpoint-url = https://localhost:USD{quarkus.http.test-ssl-port}/services/helloUsernameToken quarkus.cxf.client.helloUsernameToken.service-interface = io.quarkiverse.cxf.it.security.policy.UsernameTokenPolicyHelloService quarkus.cxf.client.helloUsernameToken.security.username = USD{wss.user} quarkus.cxf.client.helloUsernameToken.security.password = USD{wss.password}
package io.quarkiverse.cxf.it.security.policy; import java.io.IOException; import javax.security.auth.callback.Callback; import javax.security.auth.callback.CallbackHandler; import javax.security.auth.callback.UnsupportedCallbackException; import jakarta.enterprise.context.ApplicationScoped; import jakarta.inject.Named; import org.apache.wss4j.common.ext.WSPasswordCallback; import org.eclipse.microprofile.config.inject.ConfigProperty; @ApplicationScoped @Named("usernameTokenPasswordCallback") /* We refer to this bean by this name from application.properties */ public class UsernameTokenPasswordCallback implements CallbackHandler { /* These two configuration properties are set in application.properties */ @ConfigProperty(name = "wss.password") String password; @ConfigProperty(name = "wss.user") String user; @Override public void handle(Callback[] callbacks) throws IOException, UnsupportedCallbackException { if (callbacks.length < 1) { throw new IllegalStateException("Expected a " + WSPasswordCallback.class.getName() + " at possition 0 of callbacks. Got array of length " + callbacks.length); } if (!(callbacks[0] instanceof WSPasswordCallback)) { throw new IllegalStateException( "Expected a " + WSPasswordCallback.class.getName() + " at possition 0 of callbacks. Got an instance of " + callbacks[0].getClass().getName() + " at possition 0"); } final WSPasswordCallback pc = (WSPasswordCallback) callbacks[0]; if (user.equals(pc.getIdentifier())) { pc.setPassword(password); } else { throw new IllegalStateException("Unexpected user " + user); } } }
package io.quarkiverse.cxf.it.security.policy; import org.assertj.core.api.Assertions; import org.junit.jupiter.api.Test; import io.quarkiverse.cxf.annotation.CXFClient; import io.quarkus.test.junit.QuarkusTest; @QuarkusTest public class UsernameTokenTest { @CXFClient("helloUsernameToken") UsernameTokenPolicyHelloService helloUsernameToken; @Test void helloUsernameToken() { Assertions.assertThat(helloUsernameToken.hello("CXF")).isEqualTo("Hello CXF from UsernameToken!"); } }
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> <soap:Header> <wsse:Security xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" soap:mustUnderstand="1"> <wsse:UsernameToken xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" wsu:Id="UsernameToken-bac4f255-147e-42a4-aeec-e0a3f5cd3587"> <wsse:Username>cxf-user</wsse:Username> <wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">secret</wsse:Password> <wsse:Nonce EncodingType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary">3uX15dZT08jRWFWxyWmfhg==</wsse:Nonce> <wsu:Created>2024-10-02T17:32:10.497Z</wsu:Created> </wsse:UsernameToken> </wsse:Security> </soap:Header> <soap:Body> <ns2:hello xmlns:ns2="http://policy.security.it.cxf.quarkiverse.io/"> <arg0>CXF</arg0> </ns2:hello> </soap:Body> </soap:Envelope>
export USDCAMEL_VAULT_AWS_ACCESS_KEY=accessKey export USDCAMEL_VAULT_AWS_SECRET_KEY=secretKey export USDCAMEL_VAULT_AWS_REGION=region
camel.vault.aws.accessKey = accessKey camel.vault.aws.secretKey = secretKey camel.vault.aws.region = region
export USDCAMEL_VAULT_AWS_USE_DEFAULT_CREDENTIALS_PROVIDER=true export USDCAMEL_VAULT_AWS_REGION=region
camel.vault.aws.defaultCredentialsProvider = true camel.vault.aws.region = region
export USDCAMEL_VAULT_AWS_USE_PROFILE_CREDENTIALS_PROVIDER=true export USDCAMEL_VAULT_AWS_PROFILE_NAME=test-account export USDCAMEL_VAULT_AWS_REGION=region
camel.vault.aws.profileCredentialsProvider = true camel.vault.aws.profileName = test-account camel.vault.aws.region = region
<camelContext> <route> <from uri="direct:start"/> <to uri="{{aws:route}}"/> </route> </camelContext>
<camelContext> <route> <from uri="direct:start"/> <to uri="{{aws:route:default}}"/> </route> </camelContext>
username: admin
password: password123
engine: postgres
host: 127.0.0.1
port: 3128
dbname: db
<camelContext> <route> <from uri="direct:start"/> <log message="Username is {{aws:database/username}}"/> </route> </camelContext>
<camelContext> <route> <from uri="direct:start"/> <log message="Username is {{aws:database/username:admin}}"/> </route> </camelContext>
export USDCAMEL_VAULT_GCP_SERVICE_ACCOUNT_KEY=file:////path/to/service.accountkey export USDCAMEL_VAULT_GCP_PROJECT_ID=projectId
camel.vault.gcp.serviceAccountKey = accessKey camel.vault.gcp.projectId = secretKey
export USDCAMEL_VAULT_GCP_USE_DEFAULT_INSTANCE=true export USDCAMEL_VAULT_GCP_PROJECT_ID=projectId
camel.vault.gcp.useDefaultInstance = true camel.vault.aws.projectId = region
<camelContext> <route> <from uri="direct:start"/> <to uri="{{gcp:route}}"/> </route> </camelContext>
<camelContext> <route> <from uri="direct:start"/> <to uri="{{gcp:route:default}}"/> </route> </camelContext>
username: admin
password: password123
engine: postgres
host: 127.0.0.1
port: 3128
dbname: db
<camelContext> <route> <from uri="direct:start"/> <log message="Username is {{gcp:database/username}}"/> </route> </camelContext>
<camelContext> <route> <from uri="direct:start"/> <log message="Username is {{gcp:database/username:admin}}"/> </route> </camelContext>
export USDCAMEL_VAULT_AZURE_TENANT_ID=tenantId export USDCAMEL_VAULT_AZURE_CLIENT_ID=clientId export USDCAMEL_VAULT_AZURE_CLIENT_SECRET=clientSecret export USDCAMEL_VAULT_AZURE_VAULT_NAME=vaultName
camel.vault.azure.tenantId = accessKey camel.vault.azure.clientId = clientId camel.vault.azure.clientSecret = clientSecret camel.vault.azure.vaultName = vaultName
export USDCAMEL_VAULT_AZURE_IDENTITY_ENABLED=true export USDCAMEL_VAULT_AZURE_VAULT_NAME=vaultName
camel.vault.azure.azureIdentityEnabled = true camel.vault.azure.vaultName = vaultName
<camelContext> <route> <from uri="direct:start"/> <to uri="{{azure:route}}"/> </route> </camelContext>
<camelContext> <route> <from uri="direct:start"/> <to uri="{{azure:route:default}}"/> </route> </camelContext>
username: admin
password: password123
engine: postgres
host: 127.0.0.1
port: 3128
dbname: db
<camelContext> <route> <from uri="direct:start"/> <log message="Username is {{azure:database/username}}"/> </route> </camelContext>
<camelContext> <route> <from uri="direct:start"/> <log message="Username is {{azure:database/username:admin}}"/> </route> </camelContext>
export USDCAMEL_VAULT_HASHICORP_TOKEN=token export USDCAMEL_VAULT_HASHICORP_HOST=host export USDCAMEL_VAULT_HASHICORP_PORT=port export USDCAMEL_VAULT_HASHICORP_SCHEME=http/https
camel.vault.hashicorp.token = token camel.vault.hashicorp.host = host camel.vault.hashicorp.port = port camel.vault.hashicorp.scheme = scheme
<camelContext> <route> <from uri="direct:start"/> <to uri="{{hashicorp:secret:route}}"/> </route> </camelContext>
<camelContext> <route> <from uri="direct:start"/> <to uri="{{hashicorp:secret:route:default}}"/> </route> </camelContext>
username: admin
password: password123
engine: postgres
host: 127.0.0.1
port: 3128
dbname: db
<camelContext> <route> <from uri="direct:start"/> <log message="Username is {{hashicorp:secret:database/username}}"/> </route> </camelContext>
<camelContext> <route> <from uri="direct:start"/> <log message="Username is {{hashicorp:secret:database/username:admin}}"/> </route> </camelContext>
<camelContext> <route> <from uri="direct:start"/> <to uri="{{hashicorp:secret:route@2}}"/> </route> </camelContext>
<camelContext> <route> <from uri="direct:start"/> <to uri="{{hashicorp:route:default@2}}"/> </route> </camelContext>
<camelContext> <route> <from uri="direct:start"/> <log message="Username is {{hashicorp:secret:database/username:admin@2}}"/> </route> </camelContext>
export USDCAMEL_VAULT_AWS_USE_DEFAULT_CREDENTIALS_PROVIDER=accessKey export USDCAMEL_VAULT_AWS_REGION=region
camel.vault.aws.useDefaultCredentialProvider = true camel.vault.aws.region = region
camel.vault.aws.refreshEnabled=true camel.vault.aws.refreshPeriod=60000 camel.vault.aws.secrets=Secret camel.main.context-reload-enabled = true
{ "source": ["aws.secretsmanager"], "detail-type": ["AWS API Call via CloudTrail"], "detail": { "eventSource": ["secretsmanager.amazonaws.com"] } }
Policy: {"Version":"2012-10-17","Id":"<queue_arn>/SQSDefaultPolicy","Statement":[{"Sid": "EventsToMyQueue", "Effect": "Allow", "Principal": {"Service": "events.amazonaws.com"}, "Action": "sqs:SendMessage", "Resource": "<queue_arn>", "Condition": {"ArnEquals": {"aws:SourceArn": "<eventbridge_rule_arn>"}}}]}
aws sqs set-queue-attributes --queue-url <queue_url> --attributes file://policy.json
camel.vault.aws.refreshEnabled=true camel.vault.aws.refreshPeriod=60000 camel.vault.aws.secrets=Secret camel.main.context-reload-enabled = true camel.vault.aws.useSqsNotification=true camel.vault.aws.sqsQueueUrl=<queue_url>
export USDCAMEL_VAULT_GCP_USE_DEFAULT_INSTANCE=true export USDCAMEL_VAULT_GCP_PROJECT_ID=projectId
camel.vault.gcp.useDefaultInstance = true camel.vault.aws.projectId = projectId
camel.vault.gcp.projectId= projectId camel.vault.gcp.refreshEnabled=true camel.vault.gcp.refreshPeriod=60000 camel.vault.gcp.secrets=hello* camel.vault.gcp.subscriptionName=subscriptionName camel.main.context-reload-enabled = true
export USDCAMEL_VAULT_AZURE_TENANT_ID=tenantId export USDCAMEL_VAULT_AZURE_CLIENT_ID=clientId export USDCAMEL_VAULT_AZURE_CLIENT_SECRET=clientSecret export USDCAMEL_VAULT_AZURE_VAULT_NAME=vaultName
camel.vault.azure.tenantId = accessKey camel.vault.azure.clientId = clientId camel.vault.azure.clientSecret = clientSecret camel.vault.azure.vaultName = vaultName
export USDCAMEL_VAULT_AZURE_IDENTITY_ENABLED=true export USDCAMEL_VAULT_AZURE_VAULT_NAME=vaultName
camel.vault.azure.azureIdentityEnabled = true camel.vault.azure.vaultName = vaultName
camel.vault.azure.refreshEnabled=true camel.vault.azure.refreshPeriod=60000 camel.vault.azure.secrets=Secret camel.vault.azure.eventhubConnectionString=eventhub_conn_string camel.vault.azure.blobAccountName=blob_account_name camel.vault.azure.blobContainerName=blob_container_name camel.vault.azure.blobAccessKey=blob_access_key camel.main.context-reload-enabled = true
<dependency> <groupId>org.apache.camel.quarkus</groupId> <artifactId>camel-quarkus-jta</artifactId> </dependency>
<dependency> <groupId>io.quarkiverse.messaginghub</groupId> <artifactId>quarkus-pooled-jms</artifactId> </dependency>