You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by nf...@apache.org on 2022/03/30 16:37:48 UTC
[camel] 13/16: CAMEL-17792: Add doc about the message headers of camel-jpa
This is an automated email from the ASF dual-hosted git repository.
nfilotto pushed a commit to branch CAMEL-17792/doc-message-headers
in repository https://gitbox.apache.org/repos/asf/camel.git
commit b65ae7906b6f01ccb0564dcbc50c92d64ad34b3b
Author: Nicolas Filotto <nf...@talend.com>
AuthorDate: Wed Mar 30 17:59:36 2022 +0200
CAMEL-17792: Add doc about the message headers of camel-jpa
---
.../resources/org/apache/camel/component/jpa/jpa.json | 4 ++++
components/camel-jpa/src/main/docs/jpa-component.adoc | 17 +++--------------
.../org/apache/camel/component/jpa/JpaConstants.java | 6 +++++-
.../org/apache/camel/component/jpa/JpaEndpoint.java | 2 +-
4 files changed, 13 insertions(+), 16 deletions(-)
diff --git a/components/camel-jpa/src/generated/resources/org/apache/camel/component/jpa/jpa.json b/components/camel-jpa/src/generated/resources/org/apache/camel/component/jpa/jpa.json
index ee416ea..7d3ed18 100644
--- a/components/camel-jpa/src/generated/resources/org/apache/camel/component/jpa/jpa.json
+++ b/components/camel-jpa/src/generated/resources/org/apache/camel/component/jpa/jpa.json
@@ -31,6 +31,10 @@
"lazyStartProducer": { "kind": "property", "displayName": "Lazy Start Producer", "group": "producer", "label": "producer", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "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 star [...]
"autowiredEnabled": { "kind": "property", "displayName": "Autowired Enabled", "group": "advanced", "label": "advanced", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": true, "description": "Whether autowiring is enabled. This is used for automatic autowiring options (the option must be marked as autowired) by looking up in the registry to find if there is a single instance of matching type, which t [...]
},
+ "headers": {
+ "CamelEntityManager": { "kind": "header", "displayName": "", "group": "common", "label": "", "required": false, "javaType": "javax.persistence.EntityManager", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The JPA `EntityManager` object." },
+ "CamelJpaParameters": { "kind": "header", "displayName": "", "group": "producer", "label": "producer", "required": false, "javaType": "Map<String, Object>", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "Alternative way for passing query parameters as an Exchange header." }
+ },
"properties": {
"entityType": { "kind": "path", "displayName": "Entity Type", "group": "common", "label": "", "required": true, "type": "string", "javaType": "java.lang.Class<java.lang.Object>", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "Entity class name" },
"joinTransaction": { "kind": "parameter", "displayName": "Join Transaction", "group": "common", "label": "", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": true, "description": "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 se [...]
diff --git a/components/camel-jpa/src/main/docs/jpa-component.adoc b/components/camel-jpa/src/main/docs/jpa-component.adoc
index 965164c..dc6cec9 100644
--- a/components/camel-jpa/src/main/docs/jpa-component.adoc
+++ b/components/camel-jpa/src/main/docs/jpa-component.adoc
@@ -108,20 +108,9 @@ include::partial$component-endpoint-options.adoc[]
// endpoint options: END
-
-== Message Headers
-
-Camel adds the following message headers to the exchange:
-
-[width="100%",cols="10%,10%,80%",options="header",]
-|=======================================================================
-|Header |Type |Description
-
-|`CamelEntityManager` |`EntityManager` |The JPA `EntityManager` object being used by `JpaConsumer` or `JpaProducer`.
-
-|`CamelJpaParameters` |`Map<String, Object>` |Alternative way for passing query parameters as an Exchange header.
-
-|=======================================================================
+// component headers: START
+include::partial$component-endpoint-headers.adoc[]
+// component headers: END
== Configuring EntityManagerFactory
diff --git a/components/camel-jpa/src/main/java/org/apache/camel/component/jpa/JpaConstants.java b/components/camel-jpa/src/main/java/org/apache/camel/component/jpa/JpaConstants.java
index a845fe0..4f19738 100644
--- a/components/camel-jpa/src/main/java/org/apache/camel/component/jpa/JpaConstants.java
+++ b/components/camel-jpa/src/main/java/org/apache/camel/component/jpa/JpaConstants.java
@@ -16,13 +16,17 @@
*/
package org.apache.camel.component.jpa;
+import org.apache.camel.spi.Metadata;
+
/**
* JPA constants
*/
public final class JpaConstants {
+ @Metadata(description = "The JPA `EntityManager` object.", javaType = "javax.persistence.EntityManager")
public static final String ENTITY_MANAGER = "CamelEntityManager";
-
+ @Metadata(label = "producer", description = "Alternative way for passing query parameters as an Exchange header.",
+ javaType = "Map<String, Object>")
public static final String JPA_PARAMETERS_HEADER = "CamelJpaParameters";
/**
diff --git a/components/camel-jpa/src/main/java/org/apache/camel/component/jpa/JpaEndpoint.java b/components/camel-jpa/src/main/java/org/apache/camel/component/jpa/JpaEndpoint.java
index 46c941b..8e6fd37 100644
--- a/components/camel-jpa/src/main/java/org/apache/camel/component/jpa/JpaEndpoint.java
+++ b/components/camel-jpa/src/main/java/org/apache/camel/component/jpa/JpaEndpoint.java
@@ -51,7 +51,7 @@ import org.springframework.transaction.support.TransactionTemplate;
* Store and retrieve Java objects from databases using Java Persistence API (JPA).
*/
@UriEndpoint(firstVersion = "1.0.0", scheme = "jpa", title = "JPA", syntax = "jpa:entityType",
- category = { Category.DATABASE, Category.SQL })
+ category = { Category.DATABASE, Category.SQL }, headersClass = JpaConstants.class)
public class JpaEndpoint extends ScheduledPollEndpoint {
private EntityManagerFactory entityManagerFactory;