This is an automated email from the ASF dual-hosted git repository. davsclaus pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/camel.git
commit 78ea548cb166c8657c4226d339e516a6b8b4c0bd Author: Claus Ibsen <claus.ib...@gmail.com> AuthorDate: Sun Mar 14 17:52:04 2021 +0100 CAMEL-16355: camel-core - Optimize Filter and Choice EIP --- .../camel/catalog/docs/aws2-sqs-component.adoc | 4 ++-- .../apache/camel/component/aws2/sqs/aws2-sqs.json | 4 ++-- .../src/main/docs/aws2-sqs-component.adoc | 4 ++-- .../component/aws2/sqs/Sqs2Configuration.java | 1 + .../camel/component/aws2/sqs/Sqs2Consumer.java | 4 ++-- .../src/main/java/org/apache/camel/Exchange.java | 1 + .../java/org/apache/camel/ExchangePropertyKey.java | 3 --- .../dsl/Aws2SqsComponentBuilderFactory.java | 1 + .../apache/camel/processor/ChoiceProcessor.java | 23 ++++------------------ .../apache/camel/processor/FilterProcessor.java | 4 ---- .../camel/processor/FilterNotMatchedTest.java | 8 -------- .../org/apache/camel/processor/FilterNotTest.java | 2 -- .../org/apache/camel/processor/FilterTest.java | 2 -- .../endpoint/dsl/Sqs2EndpointBuilderFactory.java | 2 ++ .../modules/ROOT/pages/aws2-sqs-component.adoc | 4 ++-- 15 files changed, 19 insertions(+), 48 deletions(-) diff --git a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/aws2-sqs-component.adoc b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/aws2-sqs-component.adoc index 6955a7d..4e5675c 100644 --- a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/aws2-sqs-component.adoc +++ b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/aws2-sqs-component.adoc @@ -67,7 +67,7 @@ The AWS 2 Simple Queue Service (SQS) component supports 43 options, which are li | *concurrentConsumers* (consumer) | Allows you to use multiple threads to poll the sqs queue to increase throughput | 1 | int | *defaultVisibilityTimeout* (consumer) | The default visibility timeout (in seconds) | | Integer | *deleteAfterRead* (consumer) | Delete message from SQS after it has been read | true | boolean -| *deleteIfFiltered* (consumer) | Whether or not to send the DeleteMessage to the SQS queue if an exchange fails to get through a filter. If 'false' and exchange does not make it through a Camel filter upstream in the route, then don't send DeleteMessage. | true | boolean +| *deleteIfFiltered* (consumer) | *Deprecated* Whether or not to send the DeleteMessage to the SQS queue if an exchange fails to get through a filter. If 'false' and exchange does not make it through a Camel filter upstream in the route, then don't send DeleteMessage. | true | boolean | *extendMessageVisibility* (consumer) | If enabled then a scheduled background task will keep extending the message visibility on SQS. This is needed if it takes a long time to process the message. If set to true defaultVisibilityTimeout must be set. See details at Amazon docs. | false | boolean | *kmsDataKeyReusePeriodSeconds* (consumer) | The length of time, in seconds, for which Amazon SQS can reuse a data key to encrypt or decrypt messages before calling AWS KMS again. An integer representing seconds, between 60 seconds (1 minute) and 86,400 seconds (24 hours). Default: 300 (5 minutes). | | Integer | *kmsMasterKeyId* (consumer) | The ID of an AWS-managed customer master key (CMK) for Amazon SQS or a custom CMK. | | String @@ -145,7 +145,7 @@ with the following path and query parameters: | *concurrentConsumers* (consumer) | Allows you to use multiple threads to poll the sqs queue to increase throughput | 1 | int | *defaultVisibilityTimeout* (consumer) | The default visibility timeout (in seconds) | | Integer | *deleteAfterRead* (consumer) | Delete message from SQS after it has been read | true | boolean -| *deleteIfFiltered* (consumer) | Whether or not to send the DeleteMessage to the SQS queue if an exchange fails to get through a filter. If 'false' and exchange does not make it through a Camel filter upstream in the route, then don't send DeleteMessage. | true | boolean +| *deleteIfFiltered* (consumer) | *Deprecated* Whether or not to send the DeleteMessage to the SQS queue if an exchange fails to get through a filter. If 'false' and exchange does not make it through a Camel filter upstream in the route, then don't send DeleteMessage. | true | boolean | *extendMessageVisibility* (consumer) | If enabled then a scheduled background task will keep extending the message visibility on SQS. This is needed if it takes a long time to process the message. If set to true defaultVisibilityTimeout must be set. See details at Amazon docs. | false | boolean | *kmsDataKeyReusePeriodSeconds* (consumer) | The length of time, in seconds, for which Amazon SQS can reuse a data key to encrypt or decrypt messages before calling AWS KMS again. An integer representing seconds, between 60 seconds (1 minute) and 86,400 seconds (24 hours). Default: 300 (5 minutes). | | Integer | *kmsMasterKeyId* (consumer) | The ID of an AWS-managed customer master key (CMK) for Amazon SQS or a custom CMK. | | String diff --git a/components/camel-aws/camel-aws2-sqs/src/generated/resources/org/apache/camel/component/aws2/sqs/aws2-sqs.json b/components/camel-aws/camel-aws2-sqs/src/generated/resources/org/apache/camel/component/aws2/sqs/aws2-sqs.json index 426106a..e4e37be 100644 --- a/components/camel-aws/camel-aws2-sqs/src/generated/resources/org/apache/camel/component/aws2/sqs/aws2-sqs.json +++ b/components/camel-aws/camel-aws2-sqs/src/generated/resources/org/apache/camel/component/aws2/sqs/aws2-sqs.json @@ -39,7 +39,7 @@ "concurrentConsumers": { "kind": "property", "displayName": "Concurrent Consumers", "group": "consumer", "label": "consumer", "required": false, "type": "integer", "javaType": "int", "deprecated": false, "autowired": false, "secret": false, "defaultValue": 1, "configurationClass": "org.apache.camel.component.aws2.sqs.Sqs2Configuration", "configurationField": "configuration", "description": "Allows you to use multiple threads to poll the sqs queue to increase throughput" }, "defaultVisibilityTimeout": { "kind": "property", "displayName": "Default Visibility Timeout", "group": "consumer", "label": "consumer", "required": false, "type": "integer", "javaType": "java.lang.Integer", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.aws2.sqs.Sqs2Configuration", "configurationField": "configuration", "description": "The default visibility timeout (in seconds)" }, "deleteAfterRead": { "kind": "property", "displayName": "Delete After Read", "group": "consumer", "label": "consumer", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": true, "configurationClass": "org.apache.camel.component.aws2.sqs.Sqs2Configuration", "configurationField": "configuration", "description": "Delete message from SQS after it has been read" }, - "deleteIfFiltered": { "kind": "property", "displayName": "Delete If Filtered", "group": "consumer", "label": "consumer", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": true, "configurationClass": "org.apache.camel.component.aws2.sqs.Sqs2Configuration", "configurationField": "configuration", "description": "Whether or not to send the DeleteMessage to the SQS queue if an exchange fails to get throug [...] + "deleteIfFiltered": { "kind": "property", "displayName": "Delete If Filtered", "group": "consumer", "label": "consumer", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": true, "autowired": false, "secret": false, "defaultValue": true, "configurationClass": "org.apache.camel.component.aws2.sqs.Sqs2Configuration", "configurationField": "configuration", "description": "Whether or not to send the DeleteMessage to the SQS queue if an exchange fails to get through [...] "extendMessageVisibility": { "kind": "property", "displayName": "Extend Message Visibility", "group": "consumer", "label": "consumer", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "configurationClass": "org.apache.camel.component.aws2.sqs.Sqs2Configuration", "configurationField": "configuration", "description": "If enabled then a scheduled background task will keep extending the message v [...] "kmsDataKeyReusePeriodSeconds": { "kind": "property", "displayName": "Kms Data Key Reuse Period Seconds", "group": "consumer", "label": "consumer", "required": false, "type": "integer", "javaType": "java.lang.Integer", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.aws2.sqs.Sqs2Configuration", "configurationField": "configuration", "description": "The length of time, in seconds, for which Amazon SQS can reuse a data key to [...] "kmsMasterKeyId": { "kind": "property", "displayName": "Kms Master Key Id", "group": "consumer", "label": "consumer", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.aws2.sqs.Sqs2Configuration", "configurationField": "configuration", "description": "The ID of an AWS-managed customer master key (CMK) for Amazon SQS or a custom CMK." }, @@ -85,7 +85,7 @@ "concurrentConsumers": { "kind": "parameter", "displayName": "Concurrent Consumers", "group": "consumer", "label": "consumer", "required": false, "type": "integer", "javaType": "int", "deprecated": false, "autowired": false, "secret": false, "defaultValue": 1, "configurationClass": "org.apache.camel.component.aws2.sqs.Sqs2Configuration", "configurationField": "configuration", "description": "Allows you to use multiple threads to poll the sqs queue to increase throughput" }, "defaultVisibilityTimeout": { "kind": "parameter", "displayName": "Default Visibility Timeout", "group": "consumer", "label": "consumer", "required": false, "type": "integer", "javaType": "java.lang.Integer", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.aws2.sqs.Sqs2Configuration", "configurationField": "configuration", "description": "The default visibility timeout (in seconds)" }, "deleteAfterRead": { "kind": "parameter", "displayName": "Delete After Read", "group": "consumer", "label": "consumer", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": true, "configurationClass": "org.apache.camel.component.aws2.sqs.Sqs2Configuration", "configurationField": "configuration", "description": "Delete message from SQS after it has been read" }, - "deleteIfFiltered": { "kind": "parameter", "displayName": "Delete If Filtered", "group": "consumer", "label": "consumer", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": true, "configurationClass": "org.apache.camel.component.aws2.sqs.Sqs2Configuration", "configurationField": "configuration", "description": "Whether or not to send the DeleteMessage to the SQS queue if an exchange fails to get throu [...] + "deleteIfFiltered": { "kind": "parameter", "displayName": "Delete If Filtered", "group": "consumer", "label": "consumer", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": true, "autowired": false, "secret": false, "defaultValue": true, "configurationClass": "org.apache.camel.component.aws2.sqs.Sqs2Configuration", "configurationField": "configuration", "description": "Whether or not to send the DeleteMessage to the SQS queue if an exchange fails to get throug [...] "extendMessageVisibility": { "kind": "parameter", "displayName": "Extend Message Visibility", "group": "consumer", "label": "consumer", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "configurationClass": "org.apache.camel.component.aws2.sqs.Sqs2Configuration", "configurationField": "configuration", "description": "If enabled then a scheduled background task will keep extending the message [...] "kmsDataKeyReusePeriodSeconds": { "kind": "parameter", "displayName": "Kms Data Key Reuse Period Seconds", "group": "consumer", "label": "consumer", "required": false, "type": "integer", "javaType": "java.lang.Integer", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.aws2.sqs.Sqs2Configuration", "configurationField": "configuration", "description": "The length of time, in seconds, for which Amazon SQS can reuse a data key to [...] "kmsMasterKeyId": { "kind": "parameter", "displayName": "Kms Master Key Id", "group": "consumer", "label": "consumer", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.aws2.sqs.Sqs2Configuration", "configurationField": "configuration", "description": "The ID of an AWS-managed customer master key (CMK) for Amazon SQS or a custom CMK." }, diff --git a/components/camel-aws/camel-aws2-sqs/src/main/docs/aws2-sqs-component.adoc b/components/camel-aws/camel-aws2-sqs/src/main/docs/aws2-sqs-component.adoc index 6955a7d..4e5675c 100644 --- a/components/camel-aws/camel-aws2-sqs/src/main/docs/aws2-sqs-component.adoc +++ b/components/camel-aws/camel-aws2-sqs/src/main/docs/aws2-sqs-component.adoc @@ -67,7 +67,7 @@ The AWS 2 Simple Queue Service (SQS) component supports 43 options, which are li | *concurrentConsumers* (consumer) | Allows you to use multiple threads to poll the sqs queue to increase throughput | 1 | int | *defaultVisibilityTimeout* (consumer) | The default visibility timeout (in seconds) | | Integer | *deleteAfterRead* (consumer) | Delete message from SQS after it has been read | true | boolean -| *deleteIfFiltered* (consumer) | Whether or not to send the DeleteMessage to the SQS queue if an exchange fails to get through a filter. If 'false' and exchange does not make it through a Camel filter upstream in the route, then don't send DeleteMessage. | true | boolean +| *deleteIfFiltered* (consumer) | *Deprecated* Whether or not to send the DeleteMessage to the SQS queue if an exchange fails to get through a filter. If 'false' and exchange does not make it through a Camel filter upstream in the route, then don't send DeleteMessage. | true | boolean | *extendMessageVisibility* (consumer) | If enabled then a scheduled background task will keep extending the message visibility on SQS. This is needed if it takes a long time to process the message. If set to true defaultVisibilityTimeout must be set. See details at Amazon docs. | false | boolean | *kmsDataKeyReusePeriodSeconds* (consumer) | The length of time, in seconds, for which Amazon SQS can reuse a data key to encrypt or decrypt messages before calling AWS KMS again. An integer representing seconds, between 60 seconds (1 minute) and 86,400 seconds (24 hours). Default: 300 (5 minutes). | | Integer | *kmsMasterKeyId* (consumer) | The ID of an AWS-managed customer master key (CMK) for Amazon SQS or a custom CMK. | | String @@ -145,7 +145,7 @@ with the following path and query parameters: | *concurrentConsumers* (consumer) | Allows you to use multiple threads to poll the sqs queue to increase throughput | 1 | int | *defaultVisibilityTimeout* (consumer) | The default visibility timeout (in seconds) | | Integer | *deleteAfterRead* (consumer) | Delete message from SQS after it has been read | true | boolean -| *deleteIfFiltered* (consumer) | Whether or not to send the DeleteMessage to the SQS queue if an exchange fails to get through a filter. If 'false' and exchange does not make it through a Camel filter upstream in the route, then don't send DeleteMessage. | true | boolean +| *deleteIfFiltered* (consumer) | *Deprecated* Whether or not to send the DeleteMessage to the SQS queue if an exchange fails to get through a filter. If 'false' and exchange does not make it through a Camel filter upstream in the route, then don't send DeleteMessage. | true | boolean | *extendMessageVisibility* (consumer) | If enabled then a scheduled background task will keep extending the message visibility on SQS. This is needed if it takes a long time to process the message. If set to true defaultVisibilityTimeout must be set. See details at Amazon docs. | false | boolean | *kmsDataKeyReusePeriodSeconds* (consumer) | The length of time, in seconds, for which Amazon SQS can reuse a data key to encrypt or decrypt messages before calling AWS KMS again. An integer representing seconds, between 60 seconds (1 minute) and 86,400 seconds (24 hours). Default: 300 (5 minutes). | | Integer | *kmsMasterKeyId* (consumer) | The ID of an AWS-managed customer master key (CMK) for Amazon SQS or a custom CMK. | | String diff --git a/components/camel-aws/camel-aws2-sqs/src/main/java/org/apache/camel/component/aws2/sqs/Sqs2Configuration.java b/components/camel-aws/camel-aws2-sqs/src/main/java/org/apache/camel/component/aws2/sqs/Sqs2Configuration.java index df7d02d..3ba8bb1 100644 --- a/components/camel-aws/camel-aws2-sqs/src/main/java/org/apache/camel/component/aws2/sqs/Sqs2Configuration.java +++ b/components/camel-aws/camel-aws2-sqs/src/main/java/org/apache/camel/component/aws2/sqs/Sqs2Configuration.java @@ -60,6 +60,7 @@ public class Sqs2Configuration implements Cloneable { @UriParam(label = "consumer", defaultValue = "true") private boolean deleteAfterRead = true; @UriParam(label = "consumer", defaultValue = "true") + @Deprecated private boolean deleteIfFiltered = true; @UriParam(label = "consumer") private Integer visibilityTimeout; diff --git a/components/camel-aws/camel-aws2-sqs/src/main/java/org/apache/camel/component/aws2/sqs/Sqs2Consumer.java b/components/camel-aws/camel-aws2-sqs/src/main/java/org/apache/camel/component/aws2/sqs/Sqs2Consumer.java index 9e9d2f2..9d06355 100644 --- a/components/camel-aws/camel-aws2-sqs/src/main/java/org/apache/camel/component/aws2/sqs/Sqs2Consumer.java +++ b/components/camel-aws/camel-aws2-sqs/src/main/java/org/apache/camel/component/aws2/sqs/Sqs2Consumer.java @@ -250,14 +250,14 @@ public class Sqs2Consumer extends ScheduledBatchPollingConsumer { } private boolean shouldDelete(Exchange exchange) { - boolean shouldDeleteByFilter = exchange.getProperty(ExchangePropertyKey.FILTER_MATCHED) != null + boolean shouldDeleteByFilter = exchange.getProperty(Exchange.FILTER_MATCHED) != null && getConfiguration().isDeleteIfFiltered() && passedThroughFilter(exchange); return getConfiguration().isDeleteAfterRead() || shouldDeleteByFilter; } private boolean passedThroughFilter(Exchange exchange) { - return exchange.getProperty(ExchangePropertyKey.FILTER_MATCHED, false, Boolean.class); + return exchange.getProperty(Exchange.FILTER_MATCHED, false, Boolean.class); } /** diff --git a/core/camel-api/src/main/java/org/apache/camel/Exchange.java b/core/camel-api/src/main/java/org/apache/camel/Exchange.java index 0c20528..a8bcd31 100644 --- a/core/camel-api/src/main/java/org/apache/camel/Exchange.java +++ b/core/camel-api/src/main/java/org/apache/camel/Exchange.java @@ -136,6 +136,7 @@ public interface Exchange { String FILE_LOCK_EXCLUSIVE_LOCK = "CamelFileLockExclusiveLock"; String FILE_LOCK_RANDOM_ACCESS_FILE = "CamelFileLockRandomAccessFile"; String FILE_LOCK_CHANNEL_FILE = "CamelFileLockChannelFile"; + @Deprecated String FILTER_MATCHED = "CamelFilterMatched"; String FILTER_NON_XML_CHARS = "CamelFilterNonXmlChars"; diff --git a/core/camel-api/src/main/java/org/apache/camel/ExchangePropertyKey.java b/core/camel-api/src/main/java/org/apache/camel/ExchangePropertyKey.java index af2ae97..5bac8ad 100644 --- a/core/camel-api/src/main/java/org/apache/camel/ExchangePropertyKey.java +++ b/core/camel-api/src/main/java/org/apache/camel/ExchangePropertyKey.java @@ -43,7 +43,6 @@ public enum ExchangePropertyKey { FAILURE_HANDLED(Exchange.FAILURE_HANDLED), FAILURE_ROUTE_ID(Exchange.FAILURE_ROUTE_ID), FATAL_FALLBACK_ERROR_HANDLER(Exchange.FATAL_FALLBACK_ERROR_HANDLER), - FILTER_MATCHED(Exchange.FILTER_MATCHED), GROUPED_EXCHANGE(Exchange.GROUPED_EXCHANGE), INTERCEPT_SEND_TO_ENDPOINT_WHEN_MATCHED(Exchange.INTERCEPT_SEND_TO_ENDPOINT_WHEN_MATCHED), LOOP_INDEX(Exchange.LOOP_INDEX), @@ -123,8 +122,6 @@ public enum ExchangePropertyKey { return FAILURE_ROUTE_ID; case Exchange.FATAL_FALLBACK_ERROR_HANDLER: return FATAL_FALLBACK_ERROR_HANDLER; - case Exchange.FILTER_MATCHED: - return FILTER_MATCHED; case Exchange.GROUPED_EXCHANGE: return GROUPED_EXCHANGE; case Exchange.INTERCEPT_SEND_TO_ENDPOINT_WHEN_MATCHED: diff --git a/core/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/dsl/Aws2SqsComponentBuilderFactory.java b/core/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/dsl/Aws2SqsComponentBuilderFactory.java index ea05f87..d4b219b 100644 --- a/core/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/dsl/Aws2SqsComponentBuilderFactory.java +++ b/core/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/dsl/Aws2SqsComponentBuilderFactory.java @@ -344,6 +344,7 @@ public interface Aws2SqsComponentBuilderFactory { * @param deleteIfFiltered the value to set * @return the dsl builder */ + @Deprecated default Aws2SqsComponentBuilder deleteIfFiltered( boolean deleteIfFiltered) { doSetProperty("deleteIfFiltered", deleteIfFiltered); diff --git a/core/camel-core-processor/src/main/java/org/apache/camel/processor/ChoiceProcessor.java b/core/camel-core-processor/src/main/java/org/apache/camel/processor/ChoiceProcessor.java index 6fce791..be781ec 100644 --- a/core/camel-core-processor/src/main/java/org/apache/camel/processor/ChoiceProcessor.java +++ b/core/camel-core-processor/src/main/java/org/apache/camel/processor/ChoiceProcessor.java @@ -23,7 +23,6 @@ import java.util.List; import org.apache.camel.AsyncCallback; import org.apache.camel.AsyncProcessor; import org.apache.camel.Exchange; -import org.apache.camel.ExchangePropertyKey; import org.apache.camel.Navigate; import org.apache.camel.Processor; import org.apache.camel.Traceable; @@ -61,20 +60,6 @@ public class ChoiceProcessor extends AsyncProcessorSupport implements Navigate<P @Override public boolean process(final Exchange exchange, final AsyncCallback callback) { - // callback to restore existing FILTER_MATCHED property on the Exchange - final Object existing = exchange.getProperty(ExchangePropertyKey.FILTER_MATCHED); - final AsyncCallback choiceCallback = new AsyncCallback() { - @Override - public void done(boolean doneSync) { - if (existing != null) { - exchange.setProperty(ExchangePropertyKey.FILTER_MATCHED, existing); - } else { - exchange.removeProperty(ExchangePropertyKey.FILTER_MATCHED); - } - callback.done(doneSync); - } - }; - // find the first matching filter and process the exchange using it for (int i = 0; i < len; i++) { FilterProcessor filter = filters[i]; @@ -91,7 +76,7 @@ public class ChoiceProcessor extends AsyncProcessorSupport implements Navigate<P // check for error if so we should break out if (!continueProcessing(exchange, "so breaking out of choice", LOG)) { // okay there was an error in the predicate so we should exit - choiceCallback.done(true); + callback.done(true); return true; } @@ -101,16 +86,16 @@ public class ChoiceProcessor extends AsyncProcessorSupport implements Navigate<P } // okay we found a filter then process it directly via its processor as we have already done the matching - return filter.getProcessor().process(exchange, choiceCallback); + return filter.getProcessor().process(exchange, callback); } if (otherwise != null) { // no filter matched then use otherwise notFiltered++; - return otherwise.process(exchange, choiceCallback); + return otherwise.process(exchange, callback); } else { // when no filter matches and there is no otherwise, then just continue - choiceCallback.done(true); + callback.done(true); return true; } } diff --git a/core/camel-core-processor/src/main/java/org/apache/camel/processor/FilterProcessor.java b/core/camel-core-processor/src/main/java/org/apache/camel/processor/FilterProcessor.java index 71b6466..ae41e5b 100644 --- a/core/camel-core-processor/src/main/java/org/apache/camel/processor/FilterProcessor.java +++ b/core/camel-core-processor/src/main/java/org/apache/camel/processor/FilterProcessor.java @@ -19,7 +19,6 @@ package org.apache.camel.processor; import org.apache.camel.AsyncCallback; import org.apache.camel.CamelContext; import org.apache.camel.Exchange; -import org.apache.camel.ExchangePropertyKey; import org.apache.camel.Predicate; import org.apache.camel.Processor; import org.apache.camel.Traceable; @@ -79,9 +78,6 @@ public class FilterProcessor extends DelegateAsyncProcessor implements Traceable LOG.debug("Filter matches: {} for exchange: {}", matches, exchange); - // set property whether the filter matches or not - exchange.setProperty(ExchangePropertyKey.FILTER_MATCHED, matches); - if (matches) { filtered++; } diff --git a/core/camel-core/src/test/java/org/apache/camel/processor/FilterNotMatchedTest.java b/core/camel-core/src/test/java/org/apache/camel/processor/FilterNotMatchedTest.java index f24d07a..f473e56 100644 --- a/core/camel-core/src/test/java/org/apache/camel/processor/FilterNotMatchedTest.java +++ b/core/camel-core/src/test/java/org/apache/camel/processor/FilterNotMatchedTest.java @@ -17,7 +17,6 @@ package org.apache.camel.processor; import org.apache.camel.ContextTestSupport; -import org.apache.camel.Exchange; import org.apache.camel.builder.RouteBuilder; import org.apache.camel.component.mock.MockEndpoint; import org.junit.jupiter.api.Test; @@ -28,10 +27,6 @@ public class FilterNotMatchedTest extends ContextTestSupport { public void testSendMatchingMessage() throws Exception { MockEndpoint mock = getMockEndpoint("mock:result"); mock.expectedMessageCount(1); - mock.message(0).exchangeProperty(Exchange.FILTER_MATCHED).isEqualTo(true); - - getMockEndpoint("mock:end").message(0).exchangeProperty(Exchange.FILTER_MATCHED).isNotNull(); - getMockEndpoint("mock:end").message(0).exchangeProperty(Exchange.FILTER_MATCHED).isEqualTo(true); template.sendBodyAndHeader("direct:start", "<matched/>", "foo", "bar"); @@ -43,9 +38,6 @@ public class FilterNotMatchedTest extends ContextTestSupport { MockEndpoint mock = getMockEndpoint("mock:result"); mock.expectedMessageCount(0); - getMockEndpoint("mock:end").message(0).exchangeProperty(Exchange.FILTER_MATCHED).isNotNull(); - getMockEndpoint("mock:end").message(0).exchangeProperty(Exchange.FILTER_MATCHED).isEqualTo(false); - template.sendBodyAndHeader("direct:start", "<notMatched/>", "foo", "notMatchedHeaderValue"); assertMockEndpointsSatisfied(); diff --git a/core/camel-core/src/test/java/org/apache/camel/processor/FilterNotTest.java b/core/camel-core/src/test/java/org/apache/camel/processor/FilterNotTest.java index 7b81792..954ffe4 100644 --- a/core/camel-core/src/test/java/org/apache/camel/processor/FilterNotTest.java +++ b/core/camel-core/src/test/java/org/apache/camel/processor/FilterNotTest.java @@ -17,7 +17,6 @@ package org.apache.camel.processor; import org.apache.camel.ContextTestSupport; -import org.apache.camel.Exchange; import org.apache.camel.builder.RouteBuilder; import org.apache.camel.component.mock.MockEndpoint; import org.junit.jupiter.api.Test; @@ -40,7 +39,6 @@ public class FilterNotTest extends ContextTestSupport { public void testSendNotMatchingMessage() throws Exception { MockEndpoint resultEndpoint = resolveMandatoryEndpoint("mock:result", MockEndpoint.class); resultEndpoint.expectedMessageCount(1); - resultEndpoint.message(0).exchangeProperty(Exchange.FILTER_MATCHED).isEqualTo(true); template.sendBody("direct:start", "<notMatched/>"); diff --git a/core/camel-core/src/test/java/org/apache/camel/processor/FilterTest.java b/core/camel-core/src/test/java/org/apache/camel/processor/FilterTest.java index c0cc004..b579da9 100644 --- a/core/camel-core/src/test/java/org/apache/camel/processor/FilterTest.java +++ b/core/camel-core/src/test/java/org/apache/camel/processor/FilterTest.java @@ -17,7 +17,6 @@ package org.apache.camel.processor; import org.apache.camel.ContextTestSupport; -import org.apache.camel.Exchange; import org.apache.camel.builder.RouteBuilder; import org.apache.camel.component.mock.MockEndpoint; import org.junit.jupiter.api.Test; @@ -30,7 +29,6 @@ public class FilterTest extends ContextTestSupport { public void testSendMatchingMessage() throws Exception { MockEndpoint resultEndpoint = resolveMandatoryEndpoint("mock:result", MockEndpoint.class); resultEndpoint.expectedMessageCount(1); - resultEndpoint.message(0).exchangeProperty(Exchange.FILTER_MATCHED).isEqualTo(true); template.sendBodyAndHeader("direct:start", "<matched/>", "foo", "bar"); diff --git a/core/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/Sqs2EndpointBuilderFactory.java b/core/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/Sqs2EndpointBuilderFactory.java index 1f200ad..7c8b0d7 100644 --- a/core/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/Sqs2EndpointBuilderFactory.java +++ b/core/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/Sqs2EndpointBuilderFactory.java @@ -536,6 +536,7 @@ public interface Sqs2EndpointBuilderFactory { * @param deleteIfFiltered the value to set * @return the dsl builder */ + @Deprecated default Sqs2EndpointConsumerBuilder deleteIfFiltered( boolean deleteIfFiltered) { doSetProperty("deleteIfFiltered", deleteIfFiltered); @@ -556,6 +557,7 @@ public interface Sqs2EndpointBuilderFactory { * @param deleteIfFiltered the value to set * @return the dsl builder */ + @Deprecated default Sqs2EndpointConsumerBuilder deleteIfFiltered( String deleteIfFiltered) { doSetProperty("deleteIfFiltered", deleteIfFiltered); diff --git a/docs/components/modules/ROOT/pages/aws2-sqs-component.adoc b/docs/components/modules/ROOT/pages/aws2-sqs-component.adoc index 84706a4..5b50203 100644 --- a/docs/components/modules/ROOT/pages/aws2-sqs-component.adoc +++ b/docs/components/modules/ROOT/pages/aws2-sqs-component.adoc @@ -69,7 +69,7 @@ The AWS 2 Simple Queue Service (SQS) component supports 43 options, which are li | *concurrentConsumers* (consumer) | Allows you to use multiple threads to poll the sqs queue to increase throughput | 1 | int | *defaultVisibilityTimeout* (consumer) | The default visibility timeout (in seconds) | | Integer | *deleteAfterRead* (consumer) | Delete message from SQS after it has been read | true | boolean -| *deleteIfFiltered* (consumer) | Whether or not to send the DeleteMessage to the SQS queue if an exchange fails to get through a filter. If 'false' and exchange does not make it through a Camel filter upstream in the route, then don't send DeleteMessage. | true | boolean +| *deleteIfFiltered* (consumer) | *Deprecated* Whether or not to send the DeleteMessage to the SQS queue if an exchange fails to get through a filter. If 'false' and exchange does not make it through a Camel filter upstream in the route, then don't send DeleteMessage. | true | boolean | *extendMessageVisibility* (consumer) | If enabled then a scheduled background task will keep extending the message visibility on SQS. This is needed if it takes a long time to process the message. If set to true defaultVisibilityTimeout must be set. See details at Amazon docs. | false | boolean | *kmsDataKeyReusePeriodSeconds* (consumer) | The length of time, in seconds, for which Amazon SQS can reuse a data key to encrypt or decrypt messages before calling AWS KMS again. An integer representing seconds, between 60 seconds (1 minute) and 86,400 seconds (24 hours). Default: 300 (5 minutes). | | Integer | *kmsMasterKeyId* (consumer) | The ID of an AWS-managed customer master key (CMK) for Amazon SQS or a custom CMK. | | String @@ -147,7 +147,7 @@ with the following path and query parameters: | *concurrentConsumers* (consumer) | Allows you to use multiple threads to poll the sqs queue to increase throughput | 1 | int | *defaultVisibilityTimeout* (consumer) | The default visibility timeout (in seconds) | | Integer | *deleteAfterRead* (consumer) | Delete message from SQS after it has been read | true | boolean -| *deleteIfFiltered* (consumer) | Whether or not to send the DeleteMessage to the SQS queue if an exchange fails to get through a filter. If 'false' and exchange does not make it through a Camel filter upstream in the route, then don't send DeleteMessage. | true | boolean +| *deleteIfFiltered* (consumer) | *Deprecated* Whether or not to send the DeleteMessage to the SQS queue if an exchange fails to get through a filter. If 'false' and exchange does not make it through a Camel filter upstream in the route, then don't send DeleteMessage. | true | boolean | *extendMessageVisibility* (consumer) | If enabled then a scheduled background task will keep extending the message visibility on SQS. This is needed if it takes a long time to process the message. If set to true defaultVisibilityTimeout must be set. See details at Amazon docs. | false | boolean | *kmsDataKeyReusePeriodSeconds* (consumer) | The length of time, in seconds, for which Amazon SQS can reuse a data key to encrypt or decrypt messages before calling AWS KMS again. An integer representing seconds, between 60 seconds (1 minute) and 86,400 seconds (24 hours). Default: 300 (5 minutes). | | Integer | *kmsMasterKeyId* (consumer) | The ID of an AWS-managed customer master key (CMK) for Amazon SQS or a custom CMK. | | String