camel-jpa-kafka-connector sink configuration
When using camel-jpa-kafka-connector as sink make sure to use the following Maven dependency to have support for the connector:
<dependency>
<groupId>org.apache.camel.kafkaconnector</groupId>
<artifactId>camel-jpa-kafka-connector</artifactId>
<version>x.x.x</version>
<!-- use the same version as your Camel Kafka connector version -->
</dependency>
The camel-jpa sink connector supports 25 options, which are listed below.
Name | Description | Default | Priority |
---|---|---|---|
camel.sink.path.entityType |
Entity class name |
null |
HIGH |
camel.sink.endpoint.joinTransaction |
The camel-jpa component will join transaction by default. You can use this option to turn this off, for example if you use LOCAL_RESOURCE and join transaction doesn’t work with your JPA provider. This option can also be set globally on the JpaComponent, instead of having to set it on all endpoints. |
true |
MEDIUM |
camel.sink.endpoint.maximumResults |
Set the maximum number of results to retrieve on the Query. |
-1 |
MEDIUM |
camel.sink.endpoint.namedQuery |
To use a named query. |
null |
MEDIUM |
camel.sink.endpoint.nativeQuery |
To use a custom native query. You may want to use the option resultClass also when using native queries. |
null |
MEDIUM |
camel.sink.endpoint.persistenceUnit |
The JPA persistence unit used by default. |
"camel" |
HIGH |
camel.sink.endpoint.query |
To use a custom query. |
null |
MEDIUM |
camel.sink.endpoint.resultClass |
Defines the type of the returned payload (we will call entityManager.createNativeQuery(nativeQuery, resultClass) instead of entityManager.createNativeQuery(nativeQuery)). Without this option, we will return an object array. Only has an affect when using in conjunction with native query when consuming data. |
null |
MEDIUM |
camel.sink.endpoint.findEntity |
If enabled then the producer will find a single entity by using the message body as key and entityType as the class type. This can be used instead of a query to find a single entity. |
false |
MEDIUM |
camel.sink.endpoint.flushOnSend |
Flushes the EntityManager after the entity bean has been persisted. |
true |
MEDIUM |
camel.sink.endpoint.lazyStartProducer |
Whether the producer should be started lazy (on the first message). By starting lazy you can use this to allow CamelContext and routes to startup in situations where a producer may otherwise fail during starting and cause the route to fail being started. By deferring this startup to be lazy then the startup failure can be handled during routing messages via Camel’s routing error handlers. Beware that when the first message is processed then creating and starting the producer may take a little time and prolong the total processing time of the processing. |
false |
MEDIUM |
camel.sink.endpoint.remove |
Indicates to use entityManager.remove(entity). |
false |
MEDIUM |
camel.sink.endpoint.useExecuteUpdate |
To configure whether to use executeUpdate() when producer executes a query. When you use INSERT, UPDATE or DELETE statement as a named query, you need to specify this option to 'true'. |
null |
MEDIUM |
camel.sink.endpoint.usePersist |
Indicates to use entityManager.persist(entity) instead of entityManager.merge(entity). Note: entityManager.persist(entity) doesn’t work for detached entities (where the EntityManager has to execute an UPDATE instead of an INSERT query)! |
false |
MEDIUM |
camel.sink.endpoint.usePassedInEntityManager |
If set to true, then Camel will use the EntityManager from the header JpaConstants.ENTITY_MANAGER instead of the configured entity manager on the component/endpoint. This allows end users to control which entity manager will be in use. |
false |
MEDIUM |
camel.sink.endpoint.basicPropertyBinding |
Whether the endpoint should use basic property binding (Camel 2.x) or the newer property binding with additional capabilities |
false |
MEDIUM |
camel.sink.endpoint.entityManagerProperties |
Additional properties for the entity manager to use. |
null |
MEDIUM |
camel.sink.endpoint.sharedEntityManager |
Whether to use Spring’s SharedEntityManager for the consumer/producer. Note in most cases joinTransaction should be set to false as this is not an EXTENDED EntityManager. |
false |
MEDIUM |
camel.sink.endpoint.synchronous |
Sets whether synchronous processing should be strictly used, or Camel is allowed to use asynchronous processing (if supported). |
false |
MEDIUM |
camel.component.jpa.entityManagerFactory |
To use the EntityManagerFactory. This is strongly recommended to configure. |
null |
MEDIUM |
camel.component.jpa.joinTransaction |
The camel-jpa component will join transaction by default. You can use this option to turn this off, for example if you use LOCAL_RESOURCE and join transaction doesn’t work with your JPA provider. This option can also be set globally on the JpaComponent, instead of having to set it on all endpoints. |
true |
MEDIUM |
camel.component.jpa.sharedEntityManager |
Whether to use Spring’s SharedEntityManager for the consumer/producer. Note in most cases joinTransaction should be set to false as this is not an EXTENDED EntityManager. |
false |
MEDIUM |
camel.component.jpa.transactionManager |
To use the PlatformTransactionManager for managing transactions. |
null |
MEDIUM |
camel.component.jpa.lazyStartProducer |
Whether the producer should be started lazy (on the first message). By starting lazy you can use this to allow CamelContext and routes to startup in situations where a producer may otherwise fail during starting and cause the route to fail being started. By deferring this startup to be lazy then the startup failure can be handled during routing messages via Camel’s routing error handlers. Beware that when the first message is processed then creating and starting the producer may take a little time and prolong the total processing time of the processing. |
false |
MEDIUM |
camel.component.jpa.basicPropertyBinding |
Whether the component should use basic property binding (Camel 2.x) or the newer property binding with additional capabilities |
false |
MEDIUM |