You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2021/06/25 14:57:22 UTC
[camel] branch main updated (9425dff -> c0eade1)
This is an automated email from the ASF dual-hosted git repository.
davsclaus pushed a change to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git.
from 9425dff camel-core - cached thread pool may have its use, so lets not deprecate it.
new d4a22ec CAMEL-16630: camel-core - EIP model that is configured with bean from registry, can now use #class: to specify creating a new bean from the given class instead of lookup.
new 9b4153e CAMEL-16630: camel-core - EIP model that is configured with bean from registry, can now use #class: to specify creating a new bean from the given class instead of lookup.
new c0eade1 Fixed update EIP docs maven plugin
The 3 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
Summary of changes:
.../apache/camel/catalog/docs/aggregate-eip.adoc | 2 +-
.../org/apache/camel/catalog/docs/bean-eip.adoc | 8 +-
.../apache/camel/catalog/docs/claimCheck-eip.adoc | 2 +-
.../org/apache/camel/catalog/docs/enrich-eip.adoc | 2 +-
.../apache/camel/catalog/docs/pollEnrich-eip.adoc | 2 +-
.../camel/catalog/docs/removeHeader-eip.adoc | 5 +-
.../org/apache/camel/catalog/models/aggregate.json | 2 +-
.../apache/camel/catalog/models/claimCheck.json | 2 +-
.../org/apache/camel/catalog/models/enrich.json | 2 +-
.../apache/camel/catalog/models/pollEnrich.json | 2 +-
.../docs/modules/eips/pages/aggregate-eip.adoc | 2 +-
.../src/main/docs/modules/eips/pages/bean-eip.adoc | 8 +-
.../docs/modules/eips/pages/claimCheck-eip.adoc | 2 +-
.../main/docs/modules/eips/pages/enrich-eip.adoc | 2 +-
.../docs/modules/eips/pages/pollEnrich-eip.adoc | 2 +-
.../docs/modules/eips/pages/removeHeader-eip.adoc | 5 +-
.../org/apache/camel/model/aggregate.json | 2 +-
.../org/apache/camel/model/claimCheck.json | 2 +-
.../resources/org/apache/camel/model/enrich.json | 2 +-
.../org/apache/camel/model/pollEnrich.json | 2 +-
.../apache/camel/model/AggregateDefinition.java | 39 +++++++++
.../apache/camel/model/ClaimCheckDefinition.java | 15 ++++
.../org/apache/camel/model/EnrichDefinition.java | 15 ++++
.../apache/camel/model/MulticastDefinition.java | 17 +++-
.../apache/camel/model/PollEnrichDefinition.java | 15 ++++
.../camel/model/RecipientListDefinition.java | 27 +++++--
.../org/apache/camel/model/SplitDefinition.java | 15 ++++
.../org/apache/camel/reifier/AbstractReifier.java | 92 +++++++++++++++++++++-
...rRefTest.java => EnricherRefBeanClassTest.java} | 7 +-
...erRefTest.java => EnricherRefBeanTypeTest.java} | 7 +-
.../org/apache/camel/dsl/yaml/AggregateTest.groovy | 30 +++++++
.../camel/maven/packaging/UpdateReadmeMojo.java | 2 +
32 files changed, 294 insertions(+), 45 deletions(-)
copy core/camel-core/src/test/java/org/apache/camel/processor/enricher/{EnricherRefTest.java => EnricherRefBeanClassTest.java} (91%)
copy core/camel-core/src/test/java/org/apache/camel/processor/enricher/{EnricherRefTest.java => EnricherRefBeanTypeTest.java} (91%)
[camel] 02/03: CAMEL-16630: camel-core - EIP model that is
configured with bean from registry,
can now use #class: to specify creating a new bean from the given class
instead of lookup.
Posted by da...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
davsclaus pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git
commit 9b4153e4d75f0f3436e7c30cfcae75a3664cdb3b
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Fri Jun 25 16:44:40 2021 +0200
CAMEL-16630: camel-core - EIP model that is configured with bean from registry, can now use #class: to specify creating a new bean from the given class instead of lookup.
---
.../org/apache/camel/catalog/models/aggregate.json | 2 +-
.../apache/camel/catalog/models/claimCheck.json | 2 +-
.../org/apache/camel/catalog/models/enrich.json | 2 +-
.../apache/camel/catalog/models/pollEnrich.json | 2 +-
.../org/apache/camel/model/aggregate.json | 2 +-
.../org/apache/camel/model/claimCheck.json | 2 +-
.../resources/org/apache/camel/model/enrich.json | 2 +-
.../org/apache/camel/model/pollEnrich.json | 2 +-
.../apache/camel/model/AggregateDefinition.java | 39 ++++++++++++++
.../apache/camel/model/ClaimCheckDefinition.java | 15 ++++++
.../org/apache/camel/model/EnrichDefinition.java | 15 ++++++
.../apache/camel/model/MulticastDefinition.java | 17 ++++++-
.../apache/camel/model/PollEnrichDefinition.java | 15 ++++++
.../camel/model/RecipientListDefinition.java | 27 +++++++---
.../org/apache/camel/model/SplitDefinition.java | 15 ++++++
.../org/apache/camel/reifier/AbstractReifier.java | 59 ++++++++++++++++------
.../enricher/EnricherRefBeanClassTest.java | 3 +-
...ClassTest.java => EnricherRefBeanTypeTest.java} | 7 ++-
18 files changed, 195 insertions(+), 33 deletions(-)
diff --git a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/models/aggregate.json b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/models/aggregate.json
index d4651eb..0482dca 100644
--- a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/models/aggregate.json
+++ b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/models/aggregate.json
@@ -21,7 +21,7 @@
"executorServiceRef": { "kind": "attribute", "displayName": "Executor Service Ref", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "If using parallelProcessing you can specify a custom thread pool to be used. In fact also if you are not using parallelProcessing this custom thread pool is used to send out aggregated exchanges as well." },
"timeoutCheckerExecutorServiceRef": { "kind": "attribute", "displayName": "Timeout Checker Executor Service Ref", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "If using either of the completionTimeout, completionTimeoutExpression, or completionInterval options a background thread is created to check for the completion for every aggregator. Set this option to provide a custom thread pool t [...]
"aggregationRepositoryRef": { "kind": "attribute", "displayName": "Aggregation Repository Ref", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Sets the custom aggregate repository to use. Will by default use org.apache.camel.processor.aggregate.MemoryAggregationRepository" },
- "strategyRef": { "kind": "attribute", "displayName": "Strategy Ref", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "A reference to lookup the AggregationStrategy in the Registry. Configuring an AggregationStrategy is required, and is used to merge the incoming Exchange with the existing already merged exchanges. At first call the oldExchange parameter is null. On subsequent invocations the [...]
+ "strategyRef": { "kind": "attribute", "displayName": "Strategy Ref", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "A reference to lookup the AggregationStrategy in the Registry. The value can either refer to a bean to lookup, or to lookup a singleton bean by its type, or to create a new bean: Lookup bean - This is the default behavior to lookup an existing bean by the bean id (value) refe [...]
"strategyMethodName": { "kind": "attribute", "displayName": "Strategy Method Name", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "This option can be used to explicit declare the method name to use, when using POJOs as the AggregationStrategy." },
"strategyMethodAllowNull": { "kind": "attribute", "displayName": "Strategy Method Allow Null", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "If this option is false then the aggregate method is not used for the very first aggregation. If this option is true then null values is used as the oldExchange (at the very first aggregation), when using POJOs as the Aggrega [...]
"completionSize": { "kind": "attribute", "displayName": "Completion Size", "required": false, "type": "integer", "javaType": "java.lang.Integer", "deprecated": false, "autowired": false, "secret": false, "description": "Number of messages aggregated before the aggregation is complete. This option can be set as either a fixed value or using an Expression which allows you to evaluate a size dynamically - will use Integer as result. If both are set Camel will fallback to use the fixed v [...]
diff --git a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/models/claimCheck.json b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/models/claimCheck.json
index c18153e..92fcd52 100644
--- a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/models/claimCheck.json
+++ b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/models/claimCheck.json
@@ -14,7 +14,7 @@
"operation": { "kind": "attribute", "displayName": "Operation", "required": false, "type": "enum", "javaType": "org.apache.camel.model.ClaimCheckOperation", "enum": [ "Get", "GetAndRemove", "Pop", "Push", "Set" ], "deprecated": false, "autowired": false, "secret": false, "description": "The claim check operation to use. The following operations is supported: Get - Gets (does not remove) the claim check by the given key. GetAndRemove - Gets and remove the claim check by the given key. [...]
"key": { "kind": "attribute", "displayName": "Key", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "To use a specific key for claim check id (for dynamic keys use simple language syntax as the key)." },
"filter": { "kind": "attribute", "displayName": "Filter", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Specified a filter to control what data gets merging data back from the claim check repository. The following syntax is supported: body - to aggregate the message body attachments - to aggregate all the message attachments headers - to aggregate all the message headers header:pattern - [...]
- "strategyRef": { "kind": "attribute", "displayName": "Strategy Ref", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "To use a custom AggregationStrategy instead of the default implementation. Notice you cannot use both custom aggregation strategy and configure data at the same time." },
+ "strategyRef": { "kind": "attribute", "displayName": "Strategy Ref", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "To use a custom AggregationStrategy instead of the default implementation. Notice you cannot use both custom aggregation strategy and configure data at the same time. The value can either refer to a bean to lookup, or to lookup a singleton bean by its type, or to create a new [...]
"strategyMethodName": { "kind": "attribute", "displayName": "Strategy Method Name", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "This option can be used to explicit declare the method name to use, when using POJOs as the AggregationStrategy." },
"id": { "kind": "attribute", "displayName": "Id", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Sets the id of this node" },
"description": { "kind": "element", "displayName": "Description", "required": false, "type": "object", "javaType": "org.apache.camel.model.DescriptionDefinition", "deprecated": false, "autowired": false, "secret": false, "description": "Sets the description of this node" }
diff --git a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/models/enrich.json b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/models/enrich.json
index c92a660c..74228ac 100644
--- a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/models/enrich.json
+++ b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/models/enrich.json
@@ -12,7 +12,7 @@
},
"properties": {
"expression": { "kind": "expression", "displayName": "Expression", "required": true, "type": "object", "javaType": "org.apache.camel.model.language.ExpressionDefinition", "oneOf": [ "constant", "csimple", "datasonnet", "exchangeProperty", "groovy", "header", "hl7terser", "joor", "jsonpath", "language", "method", "mvel", "ognl", "ref", "simple", "spel", "tokenize", "xpath", "xquery", "xtokenize" ], "deprecated": false, "autowired": false, "secret": false, "description": "Expression th [...]
- "strategyRef": { "kind": "attribute", "displayName": "Strategy Ref", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Refers to an AggregationStrategy to be used to merge the reply from the external service, into a single outgoing message. By default Camel will use the reply from the external service as outgoing message." },
+ "strategyRef": { "kind": "attribute", "displayName": "Strategy Ref", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Refers to an AggregationStrategy to be used to merge the reply from the external service, into a single outgoing message. By default Camel will use the reply from the external service as outgoing message. The value can either refer to a bean to lookup, or to lookup a singleto [...]
"strategyMethodName": { "kind": "attribute", "displayName": "Strategy Method Name", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "This option can be used to explicit declare the method name to use, when using POJOs as the AggregationStrategy." },
"strategyMethodAllowNull": { "kind": "attribute", "displayName": "Strategy Method Allow Null", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "If this option is false then the aggregate method is not used if there was no data to enrich. If this option is true then null values is used as the oldExchange (when no data to enrich), when using POJOs as the AggregationStrategy." },
"aggregateOnException": { "kind": "attribute", "displayName": "Aggregate On Exception", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "If this option is false then the aggregate method is not used if there was an exception thrown while trying to retrieve the data to enrich from the resource. Setting this option to true allows end users to control what to do if ther [...]
diff --git a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/models/pollEnrich.json b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/models/pollEnrich.json
index c258f92..c56f351 100644
--- a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/models/pollEnrich.json
+++ b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/models/pollEnrich.json
@@ -13,7 +13,7 @@
"properties": {
"expression": { "kind": "expression", "displayName": "Expression", "required": true, "type": "object", "javaType": "org.apache.camel.model.language.ExpressionDefinition", "oneOf": [ "constant", "csimple", "datasonnet", "exchangeProperty", "groovy", "header", "hl7terser", "joor", "jsonpath", "language", "method", "mvel", "ognl", "ref", "simple", "spel", "tokenize", "xpath", "xquery", "xtokenize" ], "deprecated": false, "autowired": false, "secret": false, "description": "Expression th [...]
"timeout": { "kind": "attribute", "displayName": "Timeout", "required": false, "type": "duration", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "defaultValue": "-1", "description": "Timeout in millis when polling from the external service. The timeout has influence about the poll enrich behavior. It basically operations in three different modes: negative value - Waits until a message is available and then returns it. Warning that this meth [...]
- "strategyRef": { "kind": "attribute", "displayName": "Strategy Ref", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Refers to an AggregationStrategy to be used to merge the reply from the external service, into a single outgoing message. By default Camel will use the reply from the external service as outgoing message." },
+ "strategyRef": { "kind": "attribute", "displayName": "Strategy Ref", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Refers to an AggregationStrategy to be used to merge the reply from the external service, into a single outgoing message. By default Camel will use the reply from the external service as outgoing message. The value can either refer to a bean to lookup, or to lookup a singleto [...]
"strategyMethodName": { "kind": "attribute", "displayName": "Strategy Method Name", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "This option can be used to explicit declare the method name to use, when using POJOs as the AggregationStrategy." },
"strategyMethodAllowNull": { "kind": "attribute", "displayName": "Strategy Method Allow Null", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "If this option is false then the aggregate method is not used if there was no data to enrich. If this option is true then null values is used as the oldExchange (when no data to enrich), when using POJOs as the AggregationStr [...]
"aggregateOnException": { "kind": "attribute", "displayName": "Aggregate On Exception", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "If this option is false then the aggregate method is not used if there was an exception thrown while trying to retrieve the data to enrich from the resource. Setting this option to true allows end users to control what to do if ther [...]
diff --git a/core/camel-core-model/src/generated/resources/org/apache/camel/model/aggregate.json b/core/camel-core-model/src/generated/resources/org/apache/camel/model/aggregate.json
index d4651eb..0482dca 100644
--- a/core/camel-core-model/src/generated/resources/org/apache/camel/model/aggregate.json
+++ b/core/camel-core-model/src/generated/resources/org/apache/camel/model/aggregate.json
@@ -21,7 +21,7 @@
"executorServiceRef": { "kind": "attribute", "displayName": "Executor Service Ref", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "If using parallelProcessing you can specify a custom thread pool to be used. In fact also if you are not using parallelProcessing this custom thread pool is used to send out aggregated exchanges as well." },
"timeoutCheckerExecutorServiceRef": { "kind": "attribute", "displayName": "Timeout Checker Executor Service Ref", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "If using either of the completionTimeout, completionTimeoutExpression, or completionInterval options a background thread is created to check for the completion for every aggregator. Set this option to provide a custom thread pool t [...]
"aggregationRepositoryRef": { "kind": "attribute", "displayName": "Aggregation Repository Ref", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Sets the custom aggregate repository to use. Will by default use org.apache.camel.processor.aggregate.MemoryAggregationRepository" },
- "strategyRef": { "kind": "attribute", "displayName": "Strategy Ref", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "A reference to lookup the AggregationStrategy in the Registry. Configuring an AggregationStrategy is required, and is used to merge the incoming Exchange with the existing already merged exchanges. At first call the oldExchange parameter is null. On subsequent invocations the [...]
+ "strategyRef": { "kind": "attribute", "displayName": "Strategy Ref", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "A reference to lookup the AggregationStrategy in the Registry. The value can either refer to a bean to lookup, or to lookup a singleton bean by its type, or to create a new bean: Lookup bean - This is the default behavior to lookup an existing bean by the bean id (value) refe [...]
"strategyMethodName": { "kind": "attribute", "displayName": "Strategy Method Name", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "This option can be used to explicit declare the method name to use, when using POJOs as the AggregationStrategy." },
"strategyMethodAllowNull": { "kind": "attribute", "displayName": "Strategy Method Allow Null", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "If this option is false then the aggregate method is not used for the very first aggregation. If this option is true then null values is used as the oldExchange (at the very first aggregation), when using POJOs as the Aggrega [...]
"completionSize": { "kind": "attribute", "displayName": "Completion Size", "required": false, "type": "integer", "javaType": "java.lang.Integer", "deprecated": false, "autowired": false, "secret": false, "description": "Number of messages aggregated before the aggregation is complete. This option can be set as either a fixed value or using an Expression which allows you to evaluate a size dynamically - will use Integer as result. If both are set Camel will fallback to use the fixed v [...]
diff --git a/core/camel-core-model/src/generated/resources/org/apache/camel/model/claimCheck.json b/core/camel-core-model/src/generated/resources/org/apache/camel/model/claimCheck.json
index c18153e..92fcd52 100644
--- a/core/camel-core-model/src/generated/resources/org/apache/camel/model/claimCheck.json
+++ b/core/camel-core-model/src/generated/resources/org/apache/camel/model/claimCheck.json
@@ -14,7 +14,7 @@
"operation": { "kind": "attribute", "displayName": "Operation", "required": false, "type": "enum", "javaType": "org.apache.camel.model.ClaimCheckOperation", "enum": [ "Get", "GetAndRemove", "Pop", "Push", "Set" ], "deprecated": false, "autowired": false, "secret": false, "description": "The claim check operation to use. The following operations is supported: Get - Gets (does not remove) the claim check by the given key. GetAndRemove - Gets and remove the claim check by the given key. [...]
"key": { "kind": "attribute", "displayName": "Key", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "To use a specific key for claim check id (for dynamic keys use simple language syntax as the key)." },
"filter": { "kind": "attribute", "displayName": "Filter", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Specified a filter to control what data gets merging data back from the claim check repository. The following syntax is supported: body - to aggregate the message body attachments - to aggregate all the message attachments headers - to aggregate all the message headers header:pattern - [...]
- "strategyRef": { "kind": "attribute", "displayName": "Strategy Ref", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "To use a custom AggregationStrategy instead of the default implementation. Notice you cannot use both custom aggregation strategy and configure data at the same time." },
+ "strategyRef": { "kind": "attribute", "displayName": "Strategy Ref", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "To use a custom AggregationStrategy instead of the default implementation. Notice you cannot use both custom aggregation strategy and configure data at the same time. The value can either refer to a bean to lookup, or to lookup a singleton bean by its type, or to create a new [...]
"strategyMethodName": { "kind": "attribute", "displayName": "Strategy Method Name", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "This option can be used to explicit declare the method name to use, when using POJOs as the AggregationStrategy." },
"id": { "kind": "attribute", "displayName": "Id", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Sets the id of this node" },
"description": { "kind": "element", "displayName": "Description", "required": false, "type": "object", "javaType": "org.apache.camel.model.DescriptionDefinition", "deprecated": false, "autowired": false, "secret": false, "description": "Sets the description of this node" }
diff --git a/core/camel-core-model/src/generated/resources/org/apache/camel/model/enrich.json b/core/camel-core-model/src/generated/resources/org/apache/camel/model/enrich.json
index c92a660c..74228ac 100644
--- a/core/camel-core-model/src/generated/resources/org/apache/camel/model/enrich.json
+++ b/core/camel-core-model/src/generated/resources/org/apache/camel/model/enrich.json
@@ -12,7 +12,7 @@
},
"properties": {
"expression": { "kind": "expression", "displayName": "Expression", "required": true, "type": "object", "javaType": "org.apache.camel.model.language.ExpressionDefinition", "oneOf": [ "constant", "csimple", "datasonnet", "exchangeProperty", "groovy", "header", "hl7terser", "joor", "jsonpath", "language", "method", "mvel", "ognl", "ref", "simple", "spel", "tokenize", "xpath", "xquery", "xtokenize" ], "deprecated": false, "autowired": false, "secret": false, "description": "Expression th [...]
- "strategyRef": { "kind": "attribute", "displayName": "Strategy Ref", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Refers to an AggregationStrategy to be used to merge the reply from the external service, into a single outgoing message. By default Camel will use the reply from the external service as outgoing message." },
+ "strategyRef": { "kind": "attribute", "displayName": "Strategy Ref", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Refers to an AggregationStrategy to be used to merge the reply from the external service, into a single outgoing message. By default Camel will use the reply from the external service as outgoing message. The value can either refer to a bean to lookup, or to lookup a singleto [...]
"strategyMethodName": { "kind": "attribute", "displayName": "Strategy Method Name", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "This option can be used to explicit declare the method name to use, when using POJOs as the AggregationStrategy." },
"strategyMethodAllowNull": { "kind": "attribute", "displayName": "Strategy Method Allow Null", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "If this option is false then the aggregate method is not used if there was no data to enrich. If this option is true then null values is used as the oldExchange (when no data to enrich), when using POJOs as the AggregationStrategy." },
"aggregateOnException": { "kind": "attribute", "displayName": "Aggregate On Exception", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "If this option is false then the aggregate method is not used if there was an exception thrown while trying to retrieve the data to enrich from the resource. Setting this option to true allows end users to control what to do if ther [...]
diff --git a/core/camel-core-model/src/generated/resources/org/apache/camel/model/pollEnrich.json b/core/camel-core-model/src/generated/resources/org/apache/camel/model/pollEnrich.json
index c258f92..c56f351 100644
--- a/core/camel-core-model/src/generated/resources/org/apache/camel/model/pollEnrich.json
+++ b/core/camel-core-model/src/generated/resources/org/apache/camel/model/pollEnrich.json
@@ -13,7 +13,7 @@
"properties": {
"expression": { "kind": "expression", "displayName": "Expression", "required": true, "type": "object", "javaType": "org.apache.camel.model.language.ExpressionDefinition", "oneOf": [ "constant", "csimple", "datasonnet", "exchangeProperty", "groovy", "header", "hl7terser", "joor", "jsonpath", "language", "method", "mvel", "ognl", "ref", "simple", "spel", "tokenize", "xpath", "xquery", "xtokenize" ], "deprecated": false, "autowired": false, "secret": false, "description": "Expression th [...]
"timeout": { "kind": "attribute", "displayName": "Timeout", "required": false, "type": "duration", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "defaultValue": "-1", "description": "Timeout in millis when polling from the external service. The timeout has influence about the poll enrich behavior. It basically operations in three different modes: negative value - Waits until a message is available and then returns it. Warning that this meth [...]
- "strategyRef": { "kind": "attribute", "displayName": "Strategy Ref", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Refers to an AggregationStrategy to be used to merge the reply from the external service, into a single outgoing message. By default Camel will use the reply from the external service as outgoing message." },
+ "strategyRef": { "kind": "attribute", "displayName": "Strategy Ref", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Refers to an AggregationStrategy to be used to merge the reply from the external service, into a single outgoing message. By default Camel will use the reply from the external service as outgoing message. The value can either refer to a bean to lookup, or to lookup a singleto [...]
"strategyMethodName": { "kind": "attribute", "displayName": "Strategy Method Name", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "This option can be used to explicit declare the method name to use, when using POJOs as the AggregationStrategy." },
"strategyMethodAllowNull": { "kind": "attribute", "displayName": "Strategy Method Allow Null", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "If this option is false then the aggregate method is not used if there was no data to enrich. If this option is true then null values is used as the oldExchange (when no data to enrich), when using POJOs as the AggregationStr [...]
"aggregateOnException": { "kind": "attribute", "displayName": "Aggregate On Exception", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "If this option is false then the aggregate method is not used if there was an exception thrown while trying to retrieve the data to enrich from the resource. Setting this option to true allows end users to control what to do if ther [...]
diff --git a/core/camel-core-model/src/main/java/org/apache/camel/model/AggregateDefinition.java b/core/camel-core-model/src/main/java/org/apache/camel/model/AggregateDefinition.java
index c4f719b..c079a23 100644
--- a/core/camel-core-model/src/main/java/org/apache/camel/model/AggregateDefinition.java
+++ b/core/camel-core-model/src/main/java/org/apache/camel/model/AggregateDefinition.java
@@ -214,6 +214,15 @@ public class AggregateDefinition extends OutputDefinition<AggregateDefinition>
/**
* The AggregationStrategy to use.
* <p/>
+ * For example to lookup a bean with the name foo, the value is simply just foo. However its also possible to create
+ * a new class: Values can refer to creating new beans by their class name by prefixing with #class, eg
+ * #class:com.foo.MyClassType. The class is created using a default no-arg constructor, however if you need to
+ * create the instance via a factory method then you specify the method as shown:
+ * #class:com.foo.MyClassType#myFactoryMethod. And if the factory method requires parameters they can be specified
+ * as follows: #class:com.foo.MyClassType#myFactoryMethod('Hello World', 5, true). Or if you need to create the
+ * instance via constructor parameters then you can specify the parameters as shown: #class:com.foo.MyClass('Hello
+ * World', 5, true).
+ * <p/>
* Configuring an AggregationStrategy is required, and is used to merge the incoming Exchange with the existing
* already merged exchanges. At first call the oldExchange parameter is null. On subsequent invocations the
* oldExchange contains the merged exchanges and newExchange is of course the new incoming Exchange.
@@ -229,6 +238,21 @@ public class AggregateDefinition extends OutputDefinition<AggregateDefinition>
/**
* A reference to lookup the AggregationStrategy in the Registry.
* <p/>
+ * The value can either refer to a bean to lookup, or to lookup a singleton bean by its type, or to create a new
+ * bean:
+ * <ul>
+ * <li>Lookup bean - This is the default behavior to lookup an existing bean by the bean id (value)</li>
+ * <li>reference by type - Values can refer to singleton beans by their type in the registry by prefixing with
+ * #type: syntax, eg #type:com.foo.MyClassType</li>
+ * <li>reference new class - Values can refer to creating new beans by their class name by prefixing with #class, eg
+ * #class:com.foo.MyClassType. The class is created using a default no-arg constructor, however if you need to
+ * create the instance via a factory method then you specify the method as shown:
+ * #class:com.foo.MyClassType#myFactoryMethod. And if the factory method requires parameters they can be specified
+ * as follows: #class:com.foo.MyClassType#myFactoryMethod('Hello World', 5, true). Or if you need to create the
+ * instance via constructor parameters then you can specify the parameters as shown: #class:com.foo.MyClass('Hello
+ * World', 5, true)</li>.
+ * </ul>
+ * <p/>
* Configuring an AggregationStrategy is required, and is used to merge the incoming Exchange with the existing
* already merged exchanges. At first call the oldExchange parameter is null. On subsequent invocations the
* oldExchange contains the merged exchanges and newExchange is of course the new incoming Exchange.
@@ -244,6 +268,21 @@ public class AggregateDefinition extends OutputDefinition<AggregateDefinition>
/**
* A reference to lookup the AggregationStrategy in the Registry.
* <p/>
+ * The value can either refer to a bean to lookup, or to lookup a singleton bean by its type, or to create a new
+ * bean:
+ * <ul>
+ * <li>Lookup bean - This is the default behavior to lookup an existing bean by the bean id (value)</li>
+ * <li>reference by type - Values can refer to singleton beans by their type in the registry by prefixing with
+ * #type: syntax, eg #type:com.foo.MyClassType</li>
+ * <li>reference new class - Values can refer to creating new beans by their class name by prefixing with #class, eg
+ * #class:com.foo.MyClassType. The class is created using a default no-arg constructor, however if you need to
+ * create the instance via a factory method then you specify the method as shown:
+ * #class:com.foo.MyClassType#myFactoryMethod. And if the factory method requires parameters they can be specified
+ * as follows: #class:com.foo.MyClassType#myFactoryMethod('Hello World', 5, true). Or if you need to create the
+ * instance via constructor parameters then you can specify the parameters as shown: #class:com.foo.MyClass('Hello
+ * World', 5, true)</li>.
+ * </ul>
+ * <p/>
* Configuring an AggregationStrategy is required, and is used to merge the incoming Exchange with the existing
* already merged exchanges. At first call the oldExchange parameter is null. On subsequent invocations the
* oldExchange contains the merged exchanges and newExchange is of course the new incoming Exchange.
diff --git a/core/camel-core-model/src/main/java/org/apache/camel/model/ClaimCheckDefinition.java b/core/camel-core-model/src/main/java/org/apache/camel/model/ClaimCheckDefinition.java
index 9e4dc6a..f8727d5 100644
--- a/core/camel-core-model/src/main/java/org/apache/camel/model/ClaimCheckDefinition.java
+++ b/core/camel-core-model/src/main/java/org/apache/camel/model/ClaimCheckDefinition.java
@@ -169,6 +169,21 @@ public class ClaimCheckDefinition extends NoOutputDefinition<ClaimCheckDefinitio
/**
* To use a custom {@link AggregationStrategy} instead of the default implementation. Notice you cannot use both
* custom aggregation strategy and configure data at the same time.
+ * <p/>
+ * The value can either refer to a bean to lookup, or to lookup a singleton bean by its type, or to create a new
+ * bean:
+ * <ul>
+ * <li>Lookup bean - This is the default behavior to lookup an existing bean by the bean id (value)</li>
+ * <li>reference by type - Values can refer to singleton beans by their type in the registry by prefixing with
+ * #type: syntax, eg #type:com.foo.MyClassType</li>
+ * <li>reference new class - Values can refer to creating new beans by their class name by prefixing with #class, eg
+ * #class:com.foo.MyClassType. The class is created using a default no-arg constructor, however if you need to
+ * create the instance via a factory method then you specify the method as shown:
+ * #class:com.foo.MyClassType#myFactoryMethod. And if the factory method requires parameters they can be specified
+ * as follows: #class:com.foo.MyClassType#myFactoryMethod('Hello World', 5, true). Or if you need to create the
+ * instance via constructor parameters then you can specify the parameters as shown: #class:com.foo.MyClass('Hello
+ * World', 5, true)</li>.
+ * </ul>
*/
public ClaimCheckDefinition aggregationStrategyRef(String aggregationStrategyRef) {
setAggregationStrategyRef(aggregationStrategyRef);
diff --git a/core/camel-core-model/src/main/java/org/apache/camel/model/EnrichDefinition.java b/core/camel-core-model/src/main/java/org/apache/camel/model/EnrichDefinition.java
index 94fd2da..9d28893 100644
--- a/core/camel-core-model/src/main/java/org/apache/camel/model/EnrichDefinition.java
+++ b/core/camel-core-model/src/main/java/org/apache/camel/model/EnrichDefinition.java
@@ -108,6 +108,21 @@ public class EnrichDefinition extends ExpressionNode {
/**
* Refers to an AggregationStrategy to be used to merge the reply from the external service, into a single outgoing
* message. By default Camel will use the reply from the external service as outgoing message.
+ * <p/>
+ * The value can either refer to a bean to lookup, or to lookup a singleton bean by its type, or to create a new
+ * bean:
+ * <ul>
+ * <li>Lookup bean - This is the default behavior to lookup an existing bean by the bean id (value)</li>
+ * <li>reference by type - Values can refer to singleton beans by their type in the registry by prefixing with
+ * #type: syntax, eg #type:com.foo.MyClassType</li>
+ * <li>reference new class - Values can refer to creating new beans by their class name by prefixing with #class, eg
+ * #class:com.foo.MyClassType. The class is created using a default no-arg constructor, however if you need to
+ * create the instance via a factory method then you specify the method as shown:
+ * #class:com.foo.MyClassType#myFactoryMethod. And if the factory method requires parameters they can be specified
+ * as follows: #class:com.foo.MyClassType#myFactoryMethod('Hello World', 5, true). Or if you need to create the
+ * instance via constructor parameters then you can specify the parameters as shown: #class:com.foo.MyClass('Hello
+ * World', 5, true)</li>.
+ * </ul>
*/
public EnrichDefinition aggregationStrategyRef(String aggregationStrategyRef) {
setAggregationStrategyRef(aggregationStrategyRef);
diff --git a/core/camel-core-model/src/main/java/org/apache/camel/model/MulticastDefinition.java b/core/camel-core-model/src/main/java/org/apache/camel/model/MulticastDefinition.java
index a52c9d2..11f35bc 100644
--- a/core/camel-core-model/src/main/java/org/apache/camel/model/MulticastDefinition.java
+++ b/core/camel-core-model/src/main/java/org/apache/camel/model/MulticastDefinition.java
@@ -149,9 +149,24 @@ public class MulticastDefinition extends OutputDefinition<MulticastDefinition>
/**
* Sets a reference to the AggregationStrategy to be used to assemble the replies from the multicasts, into a single
* outgoing message from the Multicast. By default Camel will use the last reply as the outgoing message. You can
- * also use a POJO as the AggregationStrategy If an exception is thrown from the aggregate method in the
+ * also use a POJO as the AggregationStrategy. If an exception is thrown from the aggregate method in the
* AggregationStrategy, then by default, that exception is not handled by the error handler. The error handler can
* be enabled to react if enabling the shareUnitOfWork option.
+ * <p/>
+ * The value can either refer to a bean to lookup, or to lookup a singleton bean by its type, or to create a new
+ * bean:
+ * <ul>
+ * <li>Lookup bean - This is the default behavior to lookup an existing bean by the bean id (value)</li>
+ * <li>reference by type - Values can refer to singleton beans by their type in the registry by prefixing with
+ * #type: syntax, eg #type:com.foo.MyClassType</li>
+ * <li>reference new class - Values can refer to creating new beans by their class name by prefixing with #class, eg
+ * #class:com.foo.MyClassType. The class is created using a default no-arg constructor, however if you need to
+ * create the instance via a factory method then you specify the method as shown:
+ * #class:com.foo.MyClassType#myFactoryMethod. And if the factory method requires parameters they can be specified
+ * as follows: #class:com.foo.MyClassType#myFactoryMethod('Hello World', 5, true). Or if you need to create the
+ * instance via constructor parameters then you can specify the parameters as shown: #class:com.foo.MyClass('Hello
+ * World', 5, true)</li>.
+ * </ul>
*/
public MulticastDefinition aggregationStrategyRef(String aggregationStrategyRef) {
setStrategyRef(aggregationStrategyRef);
diff --git a/core/camel-core-model/src/main/java/org/apache/camel/model/PollEnrichDefinition.java b/core/camel-core-model/src/main/java/org/apache/camel/model/PollEnrichDefinition.java
index 3105977..ca45db2 100644
--- a/core/camel-core-model/src/main/java/org/apache/camel/model/PollEnrichDefinition.java
+++ b/core/camel-core-model/src/main/java/org/apache/camel/model/PollEnrichDefinition.java
@@ -126,6 +126,21 @@ public class PollEnrichDefinition extends ExpressionNode {
/**
* Refers to an AggregationStrategy to be used to merge the reply from the external service, into a single outgoing
* message. By default Camel will use the reply from the external service as outgoing message.
+ * <p/>
+ * The value can either refer to a bean to lookup, or to lookup a singleton bean by its type, or to create a new
+ * bean:
+ * <ul>
+ * <li>Lookup bean - This is the default behavior to lookup an existing bean by the bean id (value)</li>
+ * <li>reference by type - Values can refer to singleton beans by their type in the registry by prefixing with
+ * #type: syntax, eg #type:com.foo.MyClassType</li>
+ * <li>reference new class - Values can refer to creating new beans by their class name by prefixing with #class, eg
+ * #class:com.foo.MyClassType. The class is created using a default no-arg constructor, however if you need to
+ * create the instance via a factory method then you specify the method as shown:
+ * #class:com.foo.MyClassType#myFactoryMethod. And if the factory method requires parameters they can be specified
+ * as follows: #class:com.foo.MyClassType#myFactoryMethod('Hello World', 5, true). Or if you need to create the
+ * instance via constructor parameters then you can specify the parameters as shown: #class:com.foo.MyClass('Hello
+ * World', 5, true)</li>.
+ * </ul>
*/
public PollEnrichDefinition aggregationStrategyRef(String aggregationStrategyRef) {
setAggregationStrategyRef(aggregationStrategyRef);
diff --git a/core/camel-core-model/src/main/java/org/apache/camel/model/RecipientListDefinition.java b/core/camel-core-model/src/main/java/org/apache/camel/model/RecipientListDefinition.java
index e7d2bf2..7fb784b 100644
--- a/core/camel-core-model/src/main/java/org/apache/camel/model/RecipientListDefinition.java
+++ b/core/camel-core-model/src/main/java/org/apache/camel/model/RecipientListDefinition.java
@@ -161,6 +161,21 @@ public class RecipientListDefinition<Type extends ProcessorDefinition<Type>> ext
* Sets a reference to the AggregationStrategy to be used to assemble the replies from the recipients, into a single
* outgoing message from the RecipientList. By default Camel will use the last reply as the outgoing message. You
* can also use a POJO as the AggregationStrategy
+ * <p/>
+ * The value can either refer to a bean to lookup, or to lookup a singleton bean by its type, or to create a new
+ * bean:
+ * <ul>
+ * <li>Lookup bean - This is the default behavior to lookup an existing bean by the bean id (value)</li>
+ * <li>reference by type - Values can refer to singleton beans by their type in the registry by prefixing with
+ * #type: syntax, eg #type:com.foo.MyClassType</li>
+ * <li>reference new class - Values can refer to creating new beans by their class name by prefixing with #class, eg
+ * #class:com.foo.MyClassType. The class is created using a default no-arg constructor, however if you need to
+ * create the instance via a factory method then you specify the method as shown:
+ * #class:com.foo.MyClassType#myFactoryMethod. And if the factory method requires parameters they can be specified
+ * as follows: #class:com.foo.MyClassType#myFactoryMethod('Hello World', 5, true). Or if you need to create the
+ * instance via constructor parameters then you can specify the parameters as shown: #class:com.foo.MyClass('Hello
+ * World', 5, true)</li>.
+ * </ul>
*/
public RecipientListDefinition<Type> aggregationStrategyRef(String aggregationStrategyRef) {
setStrategyRef(aggregationStrategyRef);
@@ -363,16 +378,16 @@ public class RecipientListDefinition<Type extends ProcessorDefinition<Type>> ext
/**
* Sets the maximum size used by the {@link org.apache.camel.spi.ProducerCache} which is used to cache and reuse
* producers when using this recipient list, when uris are reused.
- *
+ * <p>
* Beware that when using dynamic endpoints then it affects how well the cache can be utilized. If each dynamic
* endpoint is unique then its best to turn of caching by setting this to -1, which allows Camel to not cache both
* the producers and endpoints; they are regarded as prototype scoped and will be stopped and discarded after use.
* This reduces memory usage as otherwise producers/endpoints are stored in memory in the caches.
- *
+ * <p>
* However if there are a high degree of dynamic endpoints that have been used before, then it can benefit to use
* the cache to reuse both producers and endpoints and therefore the cache size can be set accordingly or rely on
* the default size (1000).
- *
+ * <p>
* If there is a mix of unique and used before dynamic endpoints, then setting a reasonable cache size can help
* reduce memory usage to avoid storing too many non frequent used producers.
*
@@ -387,16 +402,16 @@ public class RecipientListDefinition<Type extends ProcessorDefinition<Type>> ext
/**
* Sets the maximum size used by the {@link org.apache.camel.spi.ProducerCache} which is used to cache and reuse
* producers when using this recipient list, when uris are reused.
- *
+ * <p>
* Beware that when using dynamic endpoints then it affects how well the cache can be utilized. If each dynamic
* endpoint is unique then its best to turn of caching by setting this to -1, which allows Camel to not cache both
* the producers and endpoints; they are regarded as prototype scoped and will be stopped and discarded after use.
* This reduces memory usage as otherwise producers/endpoints are stored in memory in the caches.
- *
+ * <p>
* However if there are a high degree of dynamic endpoints that have been used before, then it can benefit to use
* the cache to reuse both producers and endpoints and therefore the cache size can be set accordingly or rely on
* the default size (1000).
- *
+ * <p>
* If there is a mix of unique and used before dynamic endpoints, then setting a reasonable cache size can help
* reduce memory usage to avoid storing too many non frequent used producers.
*
diff --git a/core/camel-core-model/src/main/java/org/apache/camel/model/SplitDefinition.java b/core/camel-core-model/src/main/java/org/apache/camel/model/SplitDefinition.java
index b6dd618..602953e 100644
--- a/core/camel-core-model/src/main/java/org/apache/camel/model/SplitDefinition.java
+++ b/core/camel-core-model/src/main/java/org/apache/camel/model/SplitDefinition.java
@@ -146,6 +146,21 @@ public class SplitDefinition extends OutputExpressionNode implements ExecutorSer
* Sets a reference to the AggregationStrategy to be used to assemble the replies from the splitted messages, into a
* single outgoing message from the Splitter. By default Camel will use the original incoming message to the
* splitter (leave it unchanged). You can also use a POJO as the AggregationStrategy
+ * <p/>
+ * The value can either refer to a bean to lookup, or to lookup a singleton bean by its type, or to create a new
+ * bean:
+ * <ul>
+ * <li>Lookup bean - This is the default behavior to lookup an existing bean by the bean id (value)</li>
+ * <li>reference by type - Values can refer to singleton beans by their type in the registry by prefixing with
+ * #type: syntax, eg #type:com.foo.MyClassType</li>
+ * <li>reference new class - Values can refer to creating new beans by their class name by prefixing with #class, eg
+ * #class:com.foo.MyClassType. The class is created using a default no-arg constructor, however if you need to
+ * create the instance via a factory method then you specify the method as shown:
+ * #class:com.foo.MyClassType#myFactoryMethod. And if the factory method requires parameters they can be specified
+ * as follows: #class:com.foo.MyClassType#myFactoryMethod('Hello World', 5, true). Or if you need to create the
+ * instance via constructor parameters then you can specify the parameters as shown: #class:com.foo.MyClass('Hello
+ * World', 5, true)</li>.
+ * </ul>
*/
public SplitDefinition aggregationStrategyRef(String aggregationStrategyRef) {
setStrategyRef(aggregationStrategyRef);
diff --git a/core/camel-core-reifier/src/main/java/org/apache/camel/reifier/AbstractReifier.java b/core/camel-core-reifier/src/main/java/org/apache/camel/reifier/AbstractReifier.java
index efdd572..8269e69 100644
--- a/core/camel-core-reifier/src/main/java/org/apache/camel/reifier/AbstractReifier.java
+++ b/core/camel-core-reifier/src/main/java/org/apache/camel/reifier/AbstractReifier.java
@@ -23,6 +23,7 @@ import java.util.Set;
import org.apache.camel.CamelContext;
import org.apache.camel.Endpoint;
import org.apache.camel.Expression;
+import org.apache.camel.NoSuchBeanException;
import org.apache.camel.NoSuchEndpointException;
import org.apache.camel.Predicate;
import org.apache.camel.Route;
@@ -152,6 +153,8 @@ public abstract class AbstractReifier implements BeanRepository {
public Object lookupByName(String name) {
if (name != null && name.startsWith("#class:")) {
return createBean(name, Object.class);
+ } else if (name != null && name.startsWith("#type:")) {
+ return lookupBean(name, Object.class);
} else {
return getRegistry().lookupByName(name);
}
@@ -160,6 +163,8 @@ public abstract class AbstractReifier implements BeanRepository {
public <T> T lookup(String name, Class<T> type) {
if (name != null && name.startsWith("#class:")) {
return createBean(name, type);
+ } else if (name != null && name.startsWith("#type:")) {
+ return lookupBean(name, type);
} else {
return lookupByNameAndType(name, type);
}
@@ -168,11 +173,32 @@ public abstract class AbstractReifier implements BeanRepository {
public <T> T lookupByNameAndType(String name, Class<T> type) {
if (name != null && name.startsWith("#class:")) {
return createBean(name, type);
+ } else if (name != null && name.startsWith("#type:")) {
+ return lookupBean(name, type);
} else {
return getRegistry().lookupByNameAndType(name, type);
}
}
+ @Override
+ public <T> Map<String, T> findByTypeWithName(Class<T> type) {
+ return getRegistry().findByTypeWithName(type);
+ }
+
+ @Override
+ public <T> Set<T> findByType(Class<T> type) {
+ return getRegistry().findByType(type);
+ }
+
+ @Override
+ public Object unwrap(Object value) {
+ return getRegistry().unwrap(value);
+ }
+
+ public Endpoint resolveEndpoint(String uri) throws NoSuchEndpointException {
+ return CamelContextHelper.getMandatoryEndpoint(camelContext, uri);
+ }
+
private <T> T createBean(String name, Class<T> type) {
try {
return doCreateBean(name, type);
@@ -215,23 +241,26 @@ public abstract class AbstractReifier implements BeanRepository {
return type.cast(answer);
}
- @Override
- public <T> Map<String, T> findByTypeWithName(Class<T> type) {
- return getRegistry().findByTypeWithName(type);
- }
-
- @Override
- public <T> Set<T> findByType(Class<T> type) {
- return getRegistry().findByType(type);
- }
-
- @Override
- public Object unwrap(Object value) {
- return getRegistry().unwrap(value);
+ private <T> T lookupBean(String name, Class<T> type) {
+ try {
+ return doLookupBean(name, type);
+ } catch (Exception e) {
+ throw RuntimeCamelException.wrapRuntimeException(e);
+ }
}
- public Endpoint resolveEndpoint(String uri) throws NoSuchEndpointException {
- return CamelContextHelper.getMandatoryEndpoint(camelContext, uri);
+ private <T> T doLookupBean(String name, Class<T> type) throws ClassNotFoundException {
+ Class<?> clazz = camelContext.getClassResolver().resolveMandatoryClass(name.substring(6));
+ Set<?> found = getRegistry().findByType(clazz);
+ if (found == null || found.isEmpty()) {
+ throw new NoSuchBeanException(null, clazz.getName());
+ } else if (found.size() > 1) {
+ throw new NoSuchBeanException(
+ "Found " + found.size() + " beans of type: " + clazz + ". Only one bean expected.");
+ } else {
+ Object answer = found.iterator().next();
+ return type.cast(answer);
+ }
}
}
diff --git a/core/camel-core/src/test/java/org/apache/camel/processor/enricher/EnricherRefBeanClassTest.java b/core/camel-core/src/test/java/org/apache/camel/processor/enricher/EnricherRefBeanClassTest.java
index eabe781..44f203d 100644
--- a/core/camel-core/src/test/java/org/apache/camel/processor/enricher/EnricherRefBeanClassTest.java
+++ b/core/camel-core/src/test/java/org/apache/camel/processor/enricher/EnricherRefBeanClassTest.java
@@ -60,7 +60,8 @@ public class EnricherRefBeanClassTest extends ContextTestSupport {
public void configure() throws Exception {
cool.setCamelContext(context);
- from("direct:start").enrich().simple("ref:cool").aggregationStrategyRef("#class:org.apache.camel.processor.aggregate.UseLatestAggregationStrategy");
+ from("direct:start").enrich().simple("ref:cool")
+ .aggregationStrategyRef("#class:org.apache.camel.processor.aggregate.UseLatestAggregationStrategy");
}
};
}
diff --git a/core/camel-core/src/test/java/org/apache/camel/processor/enricher/EnricherRefBeanClassTest.java b/core/camel-core/src/test/java/org/apache/camel/processor/enricher/EnricherRefBeanTypeTest.java
similarity index 88%
copy from core/camel-core/src/test/java/org/apache/camel/processor/enricher/EnricherRefBeanClassTest.java
copy to core/camel-core/src/test/java/org/apache/camel/processor/enricher/EnricherRefBeanTypeTest.java
index eabe781..fc6754c 100644
--- a/core/camel-core/src/test/java/org/apache/camel/processor/enricher/EnricherRefBeanClassTest.java
+++ b/core/camel-core/src/test/java/org/apache/camel/processor/enricher/EnricherRefBeanTypeTest.java
@@ -22,12 +22,13 @@ import org.apache.camel.Processor;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.mock.MockComponent;
import org.apache.camel.component.mock.MockEndpoint;
+import org.apache.camel.processor.aggregate.UseLatestAggregationStrategy;
import org.apache.camel.spi.Registry;
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.assertEquals;
-public class EnricherRefBeanClassTest extends ContextTestSupport {
+public class EnricherRefBeanTypeTest extends ContextTestSupport {
private MockEndpoint cool = new MockEndpoint("mock:cool", new MockComponent(context));
@@ -35,6 +36,7 @@ public class EnricherRefBeanClassTest extends ContextTestSupport {
protected Registry createRegistry() throws Exception {
Registry jndi = super.createRegistry();
jndi.bind("cool", cool);
+ jndi.bind("latest", new UseLatestAggregationStrategy());
return jndi;
}
@@ -60,7 +62,8 @@ public class EnricherRefBeanClassTest extends ContextTestSupport {
public void configure() throws Exception {
cool.setCamelContext(context);
- from("direct:start").enrich().simple("ref:cool").aggregationStrategyRef("#class:org.apache.camel.processor.aggregate.UseLatestAggregationStrategy");
+ from("direct:start").enrich().simple("ref:cool")
+ .aggregationStrategyRef("#type:org.apache.camel.AggregationStrategy");
}
};
}
[camel] 03/03: Fixed update EIP docs maven plugin
Posted by da...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
davsclaus pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git
commit c0eade158f51033741e9fb79d367359332c15018
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Fri Jun 25 16:54:46 2021 +0200
Fixed update EIP docs maven plugin
---
.../resources/org/apache/camel/catalog/docs/aggregate-eip.adoc | 2 +-
.../resources/org/apache/camel/catalog/docs/bean-eip.adoc | 8 ++++----
.../resources/org/apache/camel/catalog/docs/claimCheck-eip.adoc | 2 +-
.../resources/org/apache/camel/catalog/docs/enrich-eip.adoc | 2 +-
.../resources/org/apache/camel/catalog/docs/pollEnrich-eip.adoc | 2 +-
.../resources/org/apache/camel/catalog/docs/removeHeader-eip.adoc | 5 +++--
.../src/main/docs/modules/eips/pages/aggregate-eip.adoc | 2 +-
.../src/main/docs/modules/eips/pages/bean-eip.adoc | 8 ++++----
.../src/main/docs/modules/eips/pages/claimCheck-eip.adoc | 2 +-
.../src/main/docs/modules/eips/pages/enrich-eip.adoc | 2 +-
.../src/main/docs/modules/eips/pages/pollEnrich-eip.adoc | 2 +-
.../src/main/docs/modules/eips/pages/removeHeader-eip.adoc | 5 +++--
.../java/org/apache/camel/maven/packaging/UpdateReadmeMojo.java | 2 ++
13 files changed, 24 insertions(+), 20 deletions(-)
diff --git a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/aggregate-eip.adoc b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/aggregate-eip.adoc
index 5f70fa9..65b06dd 100644
--- a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/aggregate-eip.adoc
+++ b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/aggregate-eip.adoc
@@ -36,7 +36,7 @@ The Aggregate EIP supports 27 options which are listed below:
| *executorServiceRef* | If using parallelProcessing you can specify a custom thread pool to be used. In fact also if you are not using parallelProcessing this custom thread pool is used to send out aggregated exchanges as well. | | String
| *timeoutCheckerExecutorService{zwsp}Ref* | If using either of the completionTimeout, completionTimeoutExpression, or completionInterval options a background thread is created to check for the completion for every aggregator. Set this option to provide a custom thread pool to be used rather than creating a new thread for every aggregator. | | String
| *aggregationRepositoryRef* | Sets the custom aggregate repository to use. Will by default use org.apache.camel.processor.aggregate.MemoryAggregationRepository | | String
-| *strategyRef* | A reference to lookup the AggregationStrategy in the Registry. Configuring an AggregationStrategy is required, and is used to merge the incoming Exchange with the existing already merged exchanges. At first call the oldExchange parameter is null. On subsequent invocations the oldExchange contains the merged exchanges and newExchange is of course the new incoming Exchange. | | String
+| *strategyRef* | A reference to lookup the AggregationStrategy in the Registry. The value can either refer to a bean to lookup, or to lookup a singleton bean by its type, or to create a new bean: Lookup bean - This is the default behavior to lookup an existing bean by the bean id (value) reference by type - Values can refer to singleton beans by their type in the registry by prefixing with #type: syntax, eg #type:com.foo.MyClassType reference new class - Values can refer to creating new [...]
| *strategyMethodName* | This option can be used to explicit declare the method name to use, when using POJOs as the AggregationStrategy. | | String
| *strategyMethodAllowNull* | If this option is false then the aggregate method is not used for the very first aggregation. If this option is true then null values is used as the oldExchange (at the very first aggregation), when using POJOs as the AggregationStrategy. | false | Boolean
| *completionSize* | Number of messages aggregated before the aggregation is complete. This option can be set as either a fixed value or using an Expression which allows you to evaluate a size dynamically - will use Integer as result. If both are set Camel will fallback to use the fixed value if the Expression result was null or 0. | | Integer
diff --git a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/bean-eip.adoc b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/bean-eip.adoc
index e37f30c..8003b0b 100644
--- a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/bean-eip.adoc
+++ b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/bean-eip.adoc
@@ -1,7 +1,7 @@
[[bean-eip]]
= Bean EIP
:docTitle: Bean
-:description: Calls a java bean
+:description: Calls a Java bean
:since:
:supportLevel: Stable
@@ -25,11 +25,11 @@ The Bean EIP supports 5 options which are listed below:
[width="100%",cols="2,5,^1,2",options="header"]
|===
| Name | Description | Default | Type
-| *ref* | Sets a reference to a bean to use | | String
+| *ref* | Sets a reference to an exiting bean to use, which is looked up from the registry | | String
| *method* | Sets the method name on the bean to use | | String
-| *beanType* | Sets the Class of the bean | | String
+| *beanType* | Sets the class name (fully qualified) of the bean to use | | String
| *cache* | *Deprecated* Use singleton option instead | true | Boolean
-| *scope* | Scope of bean. When using singleton scope (default) the bean is created or looked up only once and reused for the lifetime of the endpoint. The bean should be thread-safe in case concurrent threads is calling the bean at the same time. When using request scope the bean is created or looked up once per request (exchange). This can be used if you want to store state on a bean while processing a request and you want to call the same bean instance multiple times while processing [...]
+| *scope* | Scope of bean. When using singleton scope (default) the bean is created or looked up only once and reused for the lifetime of the endpoint. The bean should be thread-safe in case concurrent threads is calling the bean at the same time. When using request scope the bean is created or looked up once per request (exchange). This can be used if you want to store state on a bean while processing a request and you want to call the same bean instance multiple times while processing [...]
|===
// eip options: END
diff --git a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/claimCheck-eip.adoc b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/claimCheck-eip.adoc
index 6b0438c..f3cf3ef 100644
--- a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/claimCheck-eip.adoc
+++ b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/claimCheck-eip.adoc
@@ -26,7 +26,7 @@ The Claim Check EIP supports 5 options which are listed below:
| *operation* | The claim check operation to use. The following operations is supported: Get - Gets (does not remove) the claim check by the given key. GetAndRemove - Gets and remove the claim check by the given key. Set - Sets a new (will override if key already exists) claim check with the given key. Push - Sets a new claim check on the stack (does not use key). Pop - Gets the latest claim check from the stack (does not use key). | | ClaimCheckOperation
| *key* | To use a specific key for claim check id (for dynamic keys use simple language syntax as the key). | | String
| *filter* | Specified a filter to control what data gets merging data back from the claim check repository. The following syntax is supported: body - to aggregate the message body attachments - to aggregate all the message attachments headers - to aggregate all the message headers header:pattern - to aggregate all the message headers that matches the pattern. The pattern uses the following rules are applied in this order: exact match, returns true wildcard match (pattern ends with a and [...]
-| *strategyRef* | To use a custom AggregationStrategy instead of the default implementation. Notice you cannot use both custom aggregation strategy and configure data at the same time. | | String
+| *strategyRef* | To use a custom AggregationStrategy instead of the default implementation. Notice you cannot use both custom aggregation strategy and configure data at the same time. The value can either refer to a bean to lookup, or to lookup a singleton bean by its type, or to create a new bean: Lookup bean - This is the default behavior to lookup an existing bean by the bean id (value) reference by type - Values can refer to singleton beans by their type in the registry by prefixing [...]
| *strategyMethodName* | This option can be used to explicit declare the method name to use, when using POJOs as the AggregationStrategy. | | String
|===
// eip options: END
diff --git a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/enrich-eip.adoc b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/enrich-eip.adoc
index 2b3b3b9..467b5c0 100644
--- a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/enrich-eip.adoc
+++ b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/enrich-eip.adoc
@@ -17,7 +17,7 @@ The Enrich EIP supports 8 options which are listed below:
[width="100%",cols="2,5,^1,2",options="header"]
|===
| Name | Description | Default | Type
-| *strategyRef* | Refers to an AggregationStrategy to be used to merge the reply from the external service, into a single outgoing message. By default Camel will use the reply from the external service as outgoing message. | | String
+| *strategyRef* | Refers to an AggregationStrategy to be used to merge the reply from the external service, into a single outgoing message. By default Camel will use the reply from the external service as outgoing message. The value can either refer to a bean to lookup, or to lookup a singleton bean by its type, or to create a new bean: Lookup bean - This is the default behavior to lookup an existing bean by the bean id (value) reference by type - Values can refer to singleton beans by t [...]
| *strategyMethodName* | This option can be used to explicit declare the method name to use, when using POJOs as the AggregationStrategy. | | String
| *strategyMethodAllowNull* | If this option is false then the aggregate method is not used if there was no data to enrich. If this option is true then null values is used as the oldExchange (when no data to enrich), when using POJOs as the AggregationStrategy. | | String
| *aggregateOnException* | If this option is false then the aggregate method is not used if there was an exception thrown while trying to retrieve the data to enrich from the resource. Setting this option to true allows end users to control what to do if there was an exception in the aggregate method. For example to suppress the exception or set a custom message body etc. | false | Boolean
diff --git a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/pollEnrich-eip.adoc b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/pollEnrich-eip.adoc
index 5c1178c..f377609 100644
--- a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/pollEnrich-eip.adoc
+++ b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/pollEnrich-eip.adoc
@@ -44,7 +44,7 @@ The Poll Enrich EIP supports 7 options which are listed below:
|===
| Name | Description | Default | Type
| *timeout* | Timeout in millis when polling from the external service. The timeout has influence about the poll enrich behavior. It basically operations in three different modes: negative value - Waits until a message is available and then returns it. Warning that this method could block indefinitely if no messages are available. 0 - Attempts to receive a message exchange immediately without waiting and returning null if a message exchange is not available yet. positive value - Attempts [...]
-| *strategyRef* | Refers to an AggregationStrategy to be used to merge the reply from the external service, into a single outgoing message. By default Camel will use the reply from the external service as outgoing message. | | String
+| *strategyRef* | Refers to an AggregationStrategy to be used to merge the reply from the external service, into a single outgoing message. By default Camel will use the reply from the external service as outgoing message. The value can either refer to a bean to lookup, or to lookup a singleton bean by its type, or to create a new bean: Lookup bean - This is the default behavior to lookup an existing bean by the bean id (value) reference by type - Values can refer to singleton beans by t [...]
| *strategyMethodName* | This option can be used to explicit declare the method name to use, when using POJOs as the AggregationStrategy. | | String
| *strategyMethodAllowNull* | If this option is false then the aggregate method is not used if there was no data to enrich. If this option is true then null values is used as the oldExchange (when no data to enrich), when using POJOs as the AggregationStrategy. | false | Boolean
| *aggregateOnException* | If this option is false then the aggregate method is not used if there was an exception thrown while trying to retrieve the data to enrich from the resource. Setting this option to true allows end users to control what to do if there was an exception in the aggregate method. For example to suppress the exception or set a custom message body etc. | false | Boolean
diff --git a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/removeHeader-eip.adoc b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/removeHeader-eip.adoc
index a389bda..a885486 100644
--- a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/removeHeader-eip.adoc
+++ b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/removeHeader-eip.adoc
@@ -8,12 +8,13 @@
== Options
// eip options: START
-The Remove Header EIP supports 1 options which are listed below:
+The Remove Header EIP supports 2 options which are listed below:
[width="100%",cols="2,5,^1,2",options="header"]
|===
| Name | Description | Default | Type
-| *headerName* | *Required* Name of header to remove | | String
+| *name* | Name of header to remove | | String
+| *headerName* | *Deprecated* Name of header to remove (deprecated use name instead) | | String
|===
// eip options: END
diff --git a/core/camel-core-engine/src/main/docs/modules/eips/pages/aggregate-eip.adoc b/core/camel-core-engine/src/main/docs/modules/eips/pages/aggregate-eip.adoc
index 5f70fa9..65b06dd 100644
--- a/core/camel-core-engine/src/main/docs/modules/eips/pages/aggregate-eip.adoc
+++ b/core/camel-core-engine/src/main/docs/modules/eips/pages/aggregate-eip.adoc
@@ -36,7 +36,7 @@ The Aggregate EIP supports 27 options which are listed below:
| *executorServiceRef* | If using parallelProcessing you can specify a custom thread pool to be used. In fact also if you are not using parallelProcessing this custom thread pool is used to send out aggregated exchanges as well. | | String
| *timeoutCheckerExecutorService{zwsp}Ref* | If using either of the completionTimeout, completionTimeoutExpression, or completionInterval options a background thread is created to check for the completion for every aggregator. Set this option to provide a custom thread pool to be used rather than creating a new thread for every aggregator. | | String
| *aggregationRepositoryRef* | Sets the custom aggregate repository to use. Will by default use org.apache.camel.processor.aggregate.MemoryAggregationRepository | | String
-| *strategyRef* | A reference to lookup the AggregationStrategy in the Registry. Configuring an AggregationStrategy is required, and is used to merge the incoming Exchange with the existing already merged exchanges. At first call the oldExchange parameter is null. On subsequent invocations the oldExchange contains the merged exchanges and newExchange is of course the new incoming Exchange. | | String
+| *strategyRef* | A reference to lookup the AggregationStrategy in the Registry. The value can either refer to a bean to lookup, or to lookup a singleton bean by its type, or to create a new bean: Lookup bean - This is the default behavior to lookup an existing bean by the bean id (value) reference by type - Values can refer to singleton beans by their type in the registry by prefixing with #type: syntax, eg #type:com.foo.MyClassType reference new class - Values can refer to creating new [...]
| *strategyMethodName* | This option can be used to explicit declare the method name to use, when using POJOs as the AggregationStrategy. | | String
| *strategyMethodAllowNull* | If this option is false then the aggregate method is not used for the very first aggregation. If this option is true then null values is used as the oldExchange (at the very first aggregation), when using POJOs as the AggregationStrategy. | false | Boolean
| *completionSize* | Number of messages aggregated before the aggregation is complete. This option can be set as either a fixed value or using an Expression which allows you to evaluate a size dynamically - will use Integer as result. If both are set Camel will fallback to use the fixed value if the Expression result was null or 0. | | Integer
diff --git a/core/camel-core-engine/src/main/docs/modules/eips/pages/bean-eip.adoc b/core/camel-core-engine/src/main/docs/modules/eips/pages/bean-eip.adoc
index e37f30c..8003b0b 100644
--- a/core/camel-core-engine/src/main/docs/modules/eips/pages/bean-eip.adoc
+++ b/core/camel-core-engine/src/main/docs/modules/eips/pages/bean-eip.adoc
@@ -1,7 +1,7 @@
[[bean-eip]]
= Bean EIP
:docTitle: Bean
-:description: Calls a java bean
+:description: Calls a Java bean
:since:
:supportLevel: Stable
@@ -25,11 +25,11 @@ The Bean EIP supports 5 options which are listed below:
[width="100%",cols="2,5,^1,2",options="header"]
|===
| Name | Description | Default | Type
-| *ref* | Sets a reference to a bean to use | | String
+| *ref* | Sets a reference to an exiting bean to use, which is looked up from the registry | | String
| *method* | Sets the method name on the bean to use | | String
-| *beanType* | Sets the Class of the bean | | String
+| *beanType* | Sets the class name (fully qualified) of the bean to use | | String
| *cache* | *Deprecated* Use singleton option instead | true | Boolean
-| *scope* | Scope of bean. When using singleton scope (default) the bean is created or looked up only once and reused for the lifetime of the endpoint. The bean should be thread-safe in case concurrent threads is calling the bean at the same time. When using request scope the bean is created or looked up once per request (exchange). This can be used if you want to store state on a bean while processing a request and you want to call the same bean instance multiple times while processing [...]
+| *scope* | Scope of bean. When using singleton scope (default) the bean is created or looked up only once and reused for the lifetime of the endpoint. The bean should be thread-safe in case concurrent threads is calling the bean at the same time. When using request scope the bean is created or looked up once per request (exchange). This can be used if you want to store state on a bean while processing a request and you want to call the same bean instance multiple times while processing [...]
|===
// eip options: END
diff --git a/core/camel-core-engine/src/main/docs/modules/eips/pages/claimCheck-eip.adoc b/core/camel-core-engine/src/main/docs/modules/eips/pages/claimCheck-eip.adoc
index 6b0438c..f3cf3ef 100644
--- a/core/camel-core-engine/src/main/docs/modules/eips/pages/claimCheck-eip.adoc
+++ b/core/camel-core-engine/src/main/docs/modules/eips/pages/claimCheck-eip.adoc
@@ -26,7 +26,7 @@ The Claim Check EIP supports 5 options which are listed below:
| *operation* | The claim check operation to use. The following operations is supported: Get - Gets (does not remove) the claim check by the given key. GetAndRemove - Gets and remove the claim check by the given key. Set - Sets a new (will override if key already exists) claim check with the given key. Push - Sets a new claim check on the stack (does not use key). Pop - Gets the latest claim check from the stack (does not use key). | | ClaimCheckOperation
| *key* | To use a specific key for claim check id (for dynamic keys use simple language syntax as the key). | | String
| *filter* | Specified a filter to control what data gets merging data back from the claim check repository. The following syntax is supported: body - to aggregate the message body attachments - to aggregate all the message attachments headers - to aggregate all the message headers header:pattern - to aggregate all the message headers that matches the pattern. The pattern uses the following rules are applied in this order: exact match, returns true wildcard match (pattern ends with a and [...]
-| *strategyRef* | To use a custom AggregationStrategy instead of the default implementation. Notice you cannot use both custom aggregation strategy and configure data at the same time. | | String
+| *strategyRef* | To use a custom AggregationStrategy instead of the default implementation. Notice you cannot use both custom aggregation strategy and configure data at the same time. The value can either refer to a bean to lookup, or to lookup a singleton bean by its type, or to create a new bean: Lookup bean - This is the default behavior to lookup an existing bean by the bean id (value) reference by type - Values can refer to singleton beans by their type in the registry by prefixing [...]
| *strategyMethodName* | This option can be used to explicit declare the method name to use, when using POJOs as the AggregationStrategy. | | String
|===
// eip options: END
diff --git a/core/camel-core-engine/src/main/docs/modules/eips/pages/enrich-eip.adoc b/core/camel-core-engine/src/main/docs/modules/eips/pages/enrich-eip.adoc
index 2b3b3b9..467b5c0 100644
--- a/core/camel-core-engine/src/main/docs/modules/eips/pages/enrich-eip.adoc
+++ b/core/camel-core-engine/src/main/docs/modules/eips/pages/enrich-eip.adoc
@@ -17,7 +17,7 @@ The Enrich EIP supports 8 options which are listed below:
[width="100%",cols="2,5,^1,2",options="header"]
|===
| Name | Description | Default | Type
-| *strategyRef* | Refers to an AggregationStrategy to be used to merge the reply from the external service, into a single outgoing message. By default Camel will use the reply from the external service as outgoing message. | | String
+| *strategyRef* | Refers to an AggregationStrategy to be used to merge the reply from the external service, into a single outgoing message. By default Camel will use the reply from the external service as outgoing message. The value can either refer to a bean to lookup, or to lookup a singleton bean by its type, or to create a new bean: Lookup bean - This is the default behavior to lookup an existing bean by the bean id (value) reference by type - Values can refer to singleton beans by t [...]
| *strategyMethodName* | This option can be used to explicit declare the method name to use, when using POJOs as the AggregationStrategy. | | String
| *strategyMethodAllowNull* | If this option is false then the aggregate method is not used if there was no data to enrich. If this option is true then null values is used as the oldExchange (when no data to enrich), when using POJOs as the AggregationStrategy. | | String
| *aggregateOnException* | If this option is false then the aggregate method is not used if there was an exception thrown while trying to retrieve the data to enrich from the resource. Setting this option to true allows end users to control what to do if there was an exception in the aggregate method. For example to suppress the exception or set a custom message body etc. | false | Boolean
diff --git a/core/camel-core-engine/src/main/docs/modules/eips/pages/pollEnrich-eip.adoc b/core/camel-core-engine/src/main/docs/modules/eips/pages/pollEnrich-eip.adoc
index 5c1178c..f377609 100644
--- a/core/camel-core-engine/src/main/docs/modules/eips/pages/pollEnrich-eip.adoc
+++ b/core/camel-core-engine/src/main/docs/modules/eips/pages/pollEnrich-eip.adoc
@@ -44,7 +44,7 @@ The Poll Enrich EIP supports 7 options which are listed below:
|===
| Name | Description | Default | Type
| *timeout* | Timeout in millis when polling from the external service. The timeout has influence about the poll enrich behavior. It basically operations in three different modes: negative value - Waits until a message is available and then returns it. Warning that this method could block indefinitely if no messages are available. 0 - Attempts to receive a message exchange immediately without waiting and returning null if a message exchange is not available yet. positive value - Attempts [...]
-| *strategyRef* | Refers to an AggregationStrategy to be used to merge the reply from the external service, into a single outgoing message. By default Camel will use the reply from the external service as outgoing message. | | String
+| *strategyRef* | Refers to an AggregationStrategy to be used to merge the reply from the external service, into a single outgoing message. By default Camel will use the reply from the external service as outgoing message. The value can either refer to a bean to lookup, or to lookup a singleton bean by its type, or to create a new bean: Lookup bean - This is the default behavior to lookup an existing bean by the bean id (value) reference by type - Values can refer to singleton beans by t [...]
| *strategyMethodName* | This option can be used to explicit declare the method name to use, when using POJOs as the AggregationStrategy. | | String
| *strategyMethodAllowNull* | If this option is false then the aggregate method is not used if there was no data to enrich. If this option is true then null values is used as the oldExchange (when no data to enrich), when using POJOs as the AggregationStrategy. | false | Boolean
| *aggregateOnException* | If this option is false then the aggregate method is not used if there was an exception thrown while trying to retrieve the data to enrich from the resource. Setting this option to true allows end users to control what to do if there was an exception in the aggregate method. For example to suppress the exception or set a custom message body etc. | false | Boolean
diff --git a/core/camel-core-engine/src/main/docs/modules/eips/pages/removeHeader-eip.adoc b/core/camel-core-engine/src/main/docs/modules/eips/pages/removeHeader-eip.adoc
index a389bda..a885486 100644
--- a/core/camel-core-engine/src/main/docs/modules/eips/pages/removeHeader-eip.adoc
+++ b/core/camel-core-engine/src/main/docs/modules/eips/pages/removeHeader-eip.adoc
@@ -8,12 +8,13 @@
== Options
// eip options: START
-The Remove Header EIP supports 1 options which are listed below:
+The Remove Header EIP supports 2 options which are listed below:
[width="100%",cols="2,5,^1,2",options="header"]
|===
| Name | Description | Default | Type
-| *headerName* | *Required* Name of header to remove | | String
+| *name* | Name of header to remove | | String
+| *headerName* | *Deprecated* Name of header to remove (deprecated use name instead) | | String
|===
// eip options: END
diff --git a/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/UpdateReadmeMojo.java b/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/UpdateReadmeMojo.java
index 580a1c5..669d9de 100644
--- a/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/UpdateReadmeMojo.java
+++ b/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/UpdateReadmeMojo.java
@@ -143,6 +143,8 @@ public class UpdateReadmeMojo extends AbstractGeneratorMojo {
executeOther();
executeDataFormat();
executeLanguage();
+ File engine = findCamelDirectory(project.getBasedir(), "camel-core-engine");
+ eipDocDir = new File(engine, "/src/main/docs/modules/eips/pages");
executeEips();
}
[camel] 01/03: CAMEL-16630: camel-core - EIP model that is
configured with bean from registry,
can now use #class: to specify creating a new bean from the given class
instead of lookup.
Posted by da...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
davsclaus pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git
commit d4a22ecfa69c0f1810a5bd349da785813c46ce5d
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Fri Jun 25 16:18:07 2021 +0200
CAMEL-16630: camel-core - EIP model that is configured with bean from registry, can now use #class: to specify creating a new bean from the given class instead of lookup.
---
.../org/apache/camel/reifier/AbstractReifier.java | 63 +++++++++++++++++++-
.../enricher/EnricherRefBeanClassTest.java | 67 ++++++++++++++++++++++
.../org/apache/camel/dsl/yaml/AggregateTest.groovy | 30 ++++++++++
3 files changed, 157 insertions(+), 3 deletions(-)
diff --git a/core/camel-core-reifier/src/main/java/org/apache/camel/reifier/AbstractReifier.java b/core/camel-core-reifier/src/main/java/org/apache/camel/reifier/AbstractReifier.java
index e6b67f1..efdd572 100644
--- a/core/camel-core-reifier/src/main/java/org/apache/camel/reifier/AbstractReifier.java
+++ b/core/camel-core-reifier/src/main/java/org/apache/camel/reifier/AbstractReifier.java
@@ -26,12 +26,15 @@ import org.apache.camel.Expression;
import org.apache.camel.NoSuchEndpointException;
import org.apache.camel.Predicate;
import org.apache.camel.Route;
+import org.apache.camel.RuntimeCamelException;
import org.apache.camel.model.ExpressionSubElementDefinition;
import org.apache.camel.model.language.ExpressionDefinition;
import org.apache.camel.reifier.language.ExpressionReifier;
import org.apache.camel.spi.BeanRepository;
import org.apache.camel.support.CamelContextHelper;
+import org.apache.camel.support.PropertyBindingSupport;
import org.apache.camel.util.ObjectHelper;
+import org.apache.camel.util.StringHelper;
public abstract class AbstractReifier implements BeanRepository {
@@ -147,15 +150,69 @@ public abstract class AbstractReifier implements BeanRepository {
@Override
public Object lookupByName(String name) {
- return getRegistry().lookupByName(name);
+ if (name != null && name.startsWith("#class:")) {
+ return createBean(name, Object.class);
+ } else {
+ return getRegistry().lookupByName(name);
+ }
}
public <T> T lookup(String name, Class<T> type) {
- return lookupByNameAndType(name, type);
+ if (name != null && name.startsWith("#class:")) {
+ return createBean(name, type);
+ } else {
+ return lookupByNameAndType(name, type);
+ }
}
public <T> T lookupByNameAndType(String name, Class<T> type) {
- return getRegistry().lookupByNameAndType(name, type);
+ if (name != null && name.startsWith("#class:")) {
+ return createBean(name, type);
+ } else {
+ return getRegistry().lookupByNameAndType(name, type);
+ }
+ }
+
+ private <T> T createBean(String name, Class<T> type) {
+ try {
+ return doCreateBean(name, type);
+ } catch (Exception e) {
+ throw RuntimeCamelException.wrapRuntimeException(e);
+ }
+ }
+
+ private <T> T doCreateBean(String name, Class<T> type) throws Exception {
+ Object answer;
+
+ // if there is a factory method then the class/bean should be created in a different way
+ String className;
+ String factoryMethod = null;
+ String parameters = null;
+ className = name.substring(7);
+ if (className.endsWith(")") && className.indexOf('(') != -1) {
+ parameters = StringHelper.after(className, "(");
+ parameters = parameters.substring(0, parameters.length() - 1); // clip last )
+ className = StringHelper.before(className, "(");
+ }
+ if (className != null && className.indexOf('#') != -1) {
+ factoryMethod = StringHelper.after(className, "#");
+ className = StringHelper.before(className, "#");
+ }
+ Class<?> clazz = camelContext.getClassResolver().resolveMandatoryClass(className);
+
+ if (factoryMethod != null && parameters != null) {
+ answer = PropertyBindingSupport.newInstanceFactoryParameters(camelContext, clazz, factoryMethod, parameters);
+ } else if (factoryMethod != null) {
+ answer = camelContext.getInjector().newInstance(type, factoryMethod);
+ } else if (parameters != null) {
+ answer = PropertyBindingSupport.newInstanceConstructorParameters(camelContext, clazz, parameters);
+ } else {
+ answer = camelContext.getInjector().newInstance(clazz);
+ }
+ if (answer == null) {
+ throw new IllegalStateException("Cannot create bean: " + name);
+ }
+ return type.cast(answer);
}
@Override
diff --git a/core/camel-core/src/test/java/org/apache/camel/processor/enricher/EnricherRefBeanClassTest.java b/core/camel-core/src/test/java/org/apache/camel/processor/enricher/EnricherRefBeanClassTest.java
new file mode 100644
index 0000000..eabe781
--- /dev/null
+++ b/core/camel-core/src/test/java/org/apache/camel/processor/enricher/EnricherRefBeanClassTest.java
@@ -0,0 +1,67 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.processor.enricher;
+
+import org.apache.camel.ContextTestSupport;
+import org.apache.camel.Exchange;
+import org.apache.camel.Processor;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.mock.MockComponent;
+import org.apache.camel.component.mock.MockEndpoint;
+import org.apache.camel.spi.Registry;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+
+public class EnricherRefBeanClassTest extends ContextTestSupport {
+
+ private MockEndpoint cool = new MockEndpoint("mock:cool", new MockComponent(context));
+
+ @Override
+ protected Registry createRegistry() throws Exception {
+ Registry jndi = super.createRegistry();
+ jndi.bind("cool", cool);
+ return jndi;
+ }
+
+ @Test
+ public void testEnrichRef() throws Exception {
+ cool.whenAnyExchangeReceived(new Processor() {
+ public void process(Exchange exchange) throws Exception {
+ exchange.getMessage().setBody("Bye World");
+ }
+ });
+ cool.expectedBodiesReceived("Hello World");
+
+ String out = template.requestBody("direct:start", "Hello World", String.class);
+ assertEquals("Bye World", out);
+
+ cool.assertIsSatisfied();
+ }
+
+ @Override
+ protected RouteBuilder createRouteBuilder() throws Exception {
+ return new RouteBuilder() {
+ @Override
+ public void configure() throws Exception {
+ cool.setCamelContext(context);
+
+ from("direct:start").enrich().simple("ref:cool").aggregationStrategyRef("#class:org.apache.camel.processor.aggregate.UseLatestAggregationStrategy");
+ }
+ };
+ }
+}
diff --git a/dsl/camel-yaml-dsl/camel-yaml-dsl/src/test/groovy/org/apache/camel/dsl/yaml/AggregateTest.groovy b/dsl/camel-yaml-dsl/camel-yaml-dsl/src/test/groovy/org/apache/camel/dsl/yaml/AggregateTest.groovy
index 8ed4ee4..5e96353 100644
--- a/dsl/camel-yaml-dsl/camel-yaml-dsl/src/test/groovy/org/apache/camel/dsl/yaml/AggregateTest.groovy
+++ b/dsl/camel-yaml-dsl/camel-yaml-dsl/src/test/groovy/org/apache/camel/dsl/yaml/AggregateTest.groovy
@@ -114,4 +114,34 @@ class AggregateTest extends YamlTestSupport {
def ex = thrown(FailedToCreateRouteException)
ex.message.contains('Failed to create route')
}
+
+ def 'aggregate (strategy-ref class)'() {
+ setup:
+ loadRoutes '''
+ - from:
+ uri: "direct:route"
+ steps:
+ - aggregate:
+ strategy-ref: "#class:org.apache.camel.processor.aggregate.UseLatestAggregationStrategy"
+ completion-size: 2
+ correlation-expression:
+ simple: "${header.StockSymbol}"
+ steps:
+ - to: "mock:route"
+ '''
+
+ withMock('mock:route') {
+ expectedBodiesReceived '2', '4'
+ }
+
+ when:
+ withTemplate {
+ to('direct:route').withBody('1').withHeader('StockSymbol', 1).send()
+ to('direct:route').withBody('2').withHeader('StockSymbol', 1).send()
+ to('direct:route').withBody('3').withHeader('StockSymbol', 2).send()
+ to('direct:route').withBody('4').withHeader('StockSymbol', 2).send()
+ }
+ then:
+ MockEndpoint.assertIsSatisfied(context)
+ }
}