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 35885847aba35d7fde55f872cc575e7b0a4f6b94 Author: Nicolas Filotto <[email protected]> AuthorDate: Thu Mar 17 11:52:31 2022 +0100 CAMEL-17792: Add doc about the message headers of camel-caffeine --- .../component/caffeine/cache/caffeine-cache.json | 9 +++++++ .../caffeine/load/caffeine-loadcache.json | 9 +++++++ .../src/main/docs/caffeine-cache-component.adoc | 3 +++ .../main/docs/caffeine-loadcache-component.adoc | 3 +++ .../component/caffeine/CaffeineConstants.java | 30 +++++++++++++++++----- .../caffeine/cache/CaffeineCacheEndpoint.java | 3 ++- .../caffeine/load/CaffeineLoadCacheEndpoint.java | 3 ++- 7 files changed, 51 insertions(+), 9 deletions(-) diff --git a/components/camel-caffeine/src/generated/resources/org/apache/camel/component/caffeine/cache/caffeine-cache.json b/components/camel-caffeine/src/generated/resources/org/apache/camel/component/caffeine/cache/caffeine-cache.json index 70c5a49..3087c15 100644 --- a/components/camel-caffeine/src/generated/resources/org/apache/camel/component/caffeine/cache/caffeine-cache.json +++ b/components/camel-caffeine/src/generated/resources/org/apache/camel/component/caffeine/cache/caffeine-cache.json @@ -40,6 +40,15 @@ "keyType": { "kind": "property", "displayName": "Key Type", "group": "advanced", "label": "advanced", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.caffeine.CaffeineConfiguration", "configurationField": "configuration", "description": "The cache key type, default java.lang.Object" }, "valueType": { "kind": "property", "displayName": "Value Type", "group": "advanced", "label": "advanced", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.caffeine.CaffeineConfiguration", "configurationField": "configuration", "description": "The cache value type, default java.lang.Object" } }, + "headers": { + "CamelCaffeineAction": { "kind": "header", "displayName": "", "group": "producer", "label": "", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The action to execute.\n\nPossible values:\n\n* CLEANUP\n* PUT\n* PUT_ALL\n* GET\n* GET_ALL\n* INVALIDATE\n* INVALIDATE_ALL\n* AS_MAP" }, + "CamelCaffeineActionHasResult": { "kind": "header", "displayName": "", "group": "producer", "label": "", "required": false, "javaType": "Boolean", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The flag indicating whether the action has a result or not." }, + "CamelCaffeineActionSucceeded": { "kind": "header", "displayName": "", "group": "producer", "label": "", "required": false, "javaType": "Boolean", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The flag indicating whether the action was successful or not." }, + "CamelCaffeineKey": { "kind": "header", "displayName": "", "group": "producer", "label": "", "required": false, "javaType": "", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The key for all actions on a single entry." }, + "CamelCaffeineKeys": { "kind": "header", "displayName": "", "group": "producer", "label": "", "required": false, "javaType": "Set", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The keys to get (GET_ALL), to invalidate (INVALIDATE_ALL) or existing (AS_MAP) according to the action." }, + "CamelCaffeineValue": { "kind": "header", "displayName": "", "group": "producer", "label": "", "required": false, "javaType": "", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The value of key for all put actions (PUT or PUT_ALL)." }, + "CamelCaffeineOldValue": { "kind": "header", "displayName": "", "group": "producer", "label": "", "required": false, "javaType": "", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The old value returned according to the action." } + }, "properties": { "cacheName": { "kind": "path", "displayName": "Cache Name", "group": "producer", "label": "", "required": true, "type": "string", "javaType": "java.lang.String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "the cache name" }, "action": { "kind": "parameter", "displayName": "Action", "group": "producer", "label": "producer", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.caffeine.CaffeineConfiguration", "configurationField": "configuration", "description": "To configure the default cache action. If an action is set in the message header, then the operation from the header takes [...] diff --git a/components/camel-caffeine/src/generated/resources/org/apache/camel/component/caffeine/load/caffeine-loadcache.json b/components/camel-caffeine/src/generated/resources/org/apache/camel/component/caffeine/load/caffeine-loadcache.json index bc224d5..ddb5485 100644 --- a/components/camel-caffeine/src/generated/resources/org/apache/camel/component/caffeine/load/caffeine-loadcache.json +++ b/components/camel-caffeine/src/generated/resources/org/apache/camel/component/caffeine/load/caffeine-loadcache.json @@ -40,6 +40,15 @@ "keyType": { "kind": "property", "displayName": "Key Type", "group": "advanced", "label": "advanced", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.caffeine.CaffeineConfiguration", "configurationField": "configuration", "description": "The cache key type, default java.lang.Object" }, "valueType": { "kind": "property", "displayName": "Value Type", "group": "advanced", "label": "advanced", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.caffeine.CaffeineConfiguration", "configurationField": "configuration", "description": "The cache value type, default java.lang.Object" } }, + "headers": { + "CamelCaffeineAction": { "kind": "header", "displayName": "", "group": "producer", "label": "", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The action to execute.\n\nPossible values:\n\n* CLEANUP\n* PUT\n* PUT_ALL\n* GET\n* GET_ALL\n* INVALIDATE\n* INVALIDATE_ALL\n* AS_MAP" }, + "CamelCaffeineActionHasResult": { "kind": "header", "displayName": "", "group": "producer", "label": "", "required": false, "javaType": "Boolean", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The flag indicating whether the action has a result or not." }, + "CamelCaffeineActionSucceeded": { "kind": "header", "displayName": "", "group": "producer", "label": "", "required": false, "javaType": "Boolean", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The flag indicating whether the action was successful or not." }, + "CamelCaffeineKey": { "kind": "header", "displayName": "", "group": "producer", "label": "", "required": false, "javaType": "", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The key for all actions on a single entry." }, + "CamelCaffeineKeys": { "kind": "header", "displayName": "", "group": "producer", "label": "", "required": false, "javaType": "Set", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The keys to get (GET_ALL), to invalidate (INVALIDATE_ALL) or existing (AS_MAP) according to the action." }, + "CamelCaffeineValue": { "kind": "header", "displayName": "", "group": "producer", "label": "", "required": false, "javaType": "", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The value of key for all put actions (PUT or PUT_ALL)." }, + "CamelCaffeineOldValue": { "kind": "header", "displayName": "", "group": "producer", "label": "", "required": false, "javaType": "", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The old value returned according to the action." } + }, "properties": { "cacheName": { "kind": "path", "displayName": "Cache Name", "group": "producer", "label": "", "required": true, "type": "string", "javaType": "java.lang.String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "the cache name" }, "action": { "kind": "parameter", "displayName": "Action", "group": "producer", "label": "producer", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.caffeine.CaffeineConfiguration", "configurationField": "configuration", "description": "To configure the default cache action. If an action is set in the message header, then the operation from the header takes [...] diff --git a/components/camel-caffeine/src/main/docs/caffeine-cache-component.adoc b/components/camel-caffeine/src/main/docs/caffeine-cache-component.adoc index 543824b..f1eaf30 100644 --- a/components/camel-caffeine/src/main/docs/caffeine-cache-component.adoc +++ b/components/camel-caffeine/src/main/docs/caffeine-cache-component.adoc @@ -49,6 +49,9 @@ include::partial$component-endpoint-options.adoc[] // endpoint options: END +// component headers: START +include::partial$component-endpoint-headers.adoc[] +// component headers: END == Examples diff --git a/components/camel-caffeine/src/main/docs/caffeine-loadcache-component.adoc b/components/camel-caffeine/src/main/docs/caffeine-loadcache-component.adoc index a8f942e..e9714a5 100644 --- a/components/camel-caffeine/src/main/docs/caffeine-loadcache-component.adoc +++ b/components/camel-caffeine/src/main/docs/caffeine-loadcache-component.adoc @@ -52,6 +52,9 @@ include::partial$component-endpoint-options.adoc[] // endpoint options: END +// component headers: START +include::partial$component-endpoint-headers.adoc[] +// component headers: END include::spring-boot:partial$starter.adoc[] diff --git a/components/camel-caffeine/src/main/java/org/apache/camel/component/caffeine/CaffeineConstants.java b/components/camel-caffeine/src/main/java/org/apache/camel/component/caffeine/CaffeineConstants.java index e7ad766..c32b347 100644 --- a/components/camel-caffeine/src/main/java/org/apache/camel/component/caffeine/CaffeineConstants.java +++ b/components/camel-caffeine/src/main/java/org/apache/camel/component/caffeine/CaffeineConstants.java @@ -16,14 +16,9 @@ */ package org.apache.camel.component.caffeine; +import org.apache.camel.spi.Metadata; + public interface CaffeineConstants { - String ACTION = "CamelCaffeineAction"; - String ACTION_HAS_RESULT = "CamelCaffeineActionHasResult"; - String ACTION_SUCCEEDED = "CamelCaffeineActionSucceeded"; - String KEY = "CamelCaffeineKey"; - String KEYS = "CamelCaffeineKeys"; - String VALUE = "CamelCaffeineValue"; - String OLD_VALUE = "CamelCaffeineOldValue"; String ACTION_CLEANUP = "CLEANUP"; String ACTION_PUT = "PUT"; @@ -33,4 +28,25 @@ public interface CaffeineConstants { String ACTION_INVALIDATE = "INVALIDATE"; String ACTION_INVALIDATE_ALL = "INVALIDATE_ALL"; String ACTION_AS_MAP = "AS_MAP"; + + @Metadata(description = "The action to execute.\n\nPossible values:\n\n* " + ACTION_CLEANUP + "\n* " + + ACTION_PUT + "\n* " + ACTION_PUT_ALL + "\n* " + ACTION_GET + "\n* " + ACTION_GET_ALL + "\n* " + + ACTION_INVALIDATE + "\n* " + ACTION_INVALIDATE_ALL + "\n* " + ACTION_AS_MAP, + javaType = "String") + String ACTION = "CamelCaffeineAction"; + @Metadata(description = "The flag indicating whether the action has a result or not.", javaType = "Boolean") + String ACTION_HAS_RESULT = "CamelCaffeineActionHasResult"; + @Metadata(description = "The flag indicating whether the action was successful or not.", javaType = "Boolean") + String ACTION_SUCCEEDED = "CamelCaffeineActionSucceeded"; + @Metadata(description = "The key for all actions on a single entry.") + String KEY = "CamelCaffeineKey"; + @Metadata(description = "The keys to get (" + ACTION_GET_ALL + "), to invalidate (" + ACTION_INVALIDATE_ALL + + ") or existing (" + ACTION_AS_MAP + ") according to the action.", + javaType = "Set") + String KEYS = "CamelCaffeineKeys"; + @Metadata(description = "The value of key for all put actions (" + ACTION_PUT + " or " + ACTION_PUT_ALL + ").") + String VALUE = "CamelCaffeineValue"; + @Metadata(description = "The old value returned according to the action.") + String OLD_VALUE = "CamelCaffeineOldValue"; + } diff --git a/components/camel-caffeine/src/main/java/org/apache/camel/component/caffeine/cache/CaffeineCacheEndpoint.java b/components/camel-caffeine/src/main/java/org/apache/camel/component/caffeine/cache/CaffeineCacheEndpoint.java index ea08224..31321fd 100644 --- a/components/camel-caffeine/src/main/java/org/apache/camel/component/caffeine/cache/CaffeineCacheEndpoint.java +++ b/components/camel-caffeine/src/main/java/org/apache/camel/component/caffeine/cache/CaffeineCacheEndpoint.java @@ -26,6 +26,7 @@ import org.apache.camel.Consumer; import org.apache.camel.Processor; import org.apache.camel.Producer; import org.apache.camel.component.caffeine.CaffeineConfiguration; +import org.apache.camel.component.caffeine.CaffeineConstants; import org.apache.camel.component.caffeine.EvictionType; import org.apache.camel.spi.Metadata; import org.apache.camel.spi.UriEndpoint; @@ -40,7 +41,7 @@ import org.apache.camel.util.ObjectHelper; */ @UriEndpoint(firstVersion = "2.20.0", scheme = "caffeine-cache", title = "Caffeine Cache", syntax = "caffeine-cache:cacheName", category = { Category.CACHE, Category.DATAGRID, Category.CLUSTERING }, - producerOnly = true) + producerOnly = true, headersClass = CaffeineConstants.class) public class CaffeineCacheEndpoint extends DefaultEndpoint { @UriPath(description = "the cache name") @Metadata(required = true) diff --git a/components/camel-caffeine/src/main/java/org/apache/camel/component/caffeine/load/CaffeineLoadCacheEndpoint.java b/components/camel-caffeine/src/main/java/org/apache/camel/component/caffeine/load/CaffeineLoadCacheEndpoint.java index 70402ce..627c1d2 100644 --- a/components/camel-caffeine/src/main/java/org/apache/camel/component/caffeine/load/CaffeineLoadCacheEndpoint.java +++ b/components/camel-caffeine/src/main/java/org/apache/camel/component/caffeine/load/CaffeineLoadCacheEndpoint.java @@ -24,6 +24,7 @@ import org.apache.camel.Consumer; import org.apache.camel.Processor; import org.apache.camel.Producer; import org.apache.camel.component.caffeine.CaffeineConfiguration; +import org.apache.camel.component.caffeine.CaffeineConstants; import org.apache.camel.component.caffeine.cache.CaffeineCacheEndpoint; import org.apache.camel.spi.Metadata; import org.apache.camel.spi.UriEndpoint; @@ -37,7 +38,7 @@ import org.apache.camel.support.DefaultEndpoint; */ @UriEndpoint(firstVersion = "2.20.0", scheme = "caffeine-loadcache", title = "Caffeine LoadCache", syntax = "caffeine-loadcache:cacheName", category = { Category.CACHE, Category.DATAGRID, Category.CLUSTERING }, - producerOnly = true) + producerOnly = true, headersClass = CaffeineConstants.class) public class CaffeineLoadCacheEndpoint extends DefaultEndpoint { @UriPath(description = "the cache name") @Metadata(required = true)
