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/03/11 14:12:29 UTC
[camel] 03/04: CAMEL-16326: camel-core - Optimize usage of
exchanage properties for state in routing engine.
This is an automated email from the ASF dual-hosted git repository.
davsclaus pushed a commit to branch opt-exchangekey
in repository https://gitbox.apache.org/repos/asf/camel.git
commit b03ae23b966ab04d659cacb989613e4e5a01710a
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Thu Mar 11 15:07:53 2021 +0100
CAMEL-16326: camel-core - Optimize usage of exchanage properties for state in routing engine.
---
.../org/apache/camel/component/ahc/helper/AhcHelper.java | 3 ++-
.../org/apache/camel/component/aws2/s3/AWS2S3Consumer.java | 7 ++++---
.../org/apache/camel/component/aws2/sqs/Sqs2Consumer.java | 11 ++++++-----
.../camel/component/azure/storage/blob/BlobConsumer.java | 7 ++++---
.../component/azure/storage/datalake/DataLakeConsumer.java | 7 ++++---
.../camel/component/azure/storage/queue/QueueConsumer.java | 7 ++++---
.../java/org/apache/camel/component/bean/MethodInfo.java | 7 ++++---
.../processor/aggregate/cassandra/CassandraCamelCodec.java | 9 +++++----
.../camel/component/cxf/transport/CamelOutputStream.java | 3 ++-
.../org/apache/camel/component/cxf/DefaultCxfBinding.java | 7 ++++---
.../camel/component/cxf/jaxrs/DefaultCxfRsBinding.java | 3 ++-
.../camel/component/cxf/CxfCustomizedExceptionTest.java | 3 ++-
.../apache/camel/component/directvm/DirectVmProcessor.java | 5 +++--
.../apache/camel/component/file/GenericFileConsumer.java | 7 ++++---
.../apache/camel/component/file/GenericFileEndpoint.java | 3 ++-
.../camel/component/file/GenericFileOnCompletion.java | 3 ++-
.../camel/component/file/remote/RemoteFileConsumer.java | 3 ++-
.../camel/component/file/remote/RemoteFileProducer.java | 3 ++-
.../component/google/bigquery/GoogleBigQueryProducer.java | 5 +++--
.../calendar/stream/GoogleCalendarStreamConsumer.java | 7 ++++---
.../google/mail/stream/GoogleMailStreamConsumer.java | 7 ++++---
.../google/sheets/stream/GoogleSheetsStreamConsumer.java | 7 ++++---
.../google/storage/GoogleCloudStorageConsumer.java | 7 ++++---
.../org/apache/camel/component/hbase/HBaseConsumer.java | 7 ++++---
.../java/org/apache/camel/component/hdfs/HdfsConsumer.java | 9 +++++----
.../java/org/apache/camel/component/hl7/AckExpression.java | 3 ++-
.../main/java/org/apache/camel/http/base/HttpHelper.java | 3 ++-
.../org/apache/camel/http/common/DefaultHttpBinding.java | 3 ++-
.../java/org/apache/camel/component/http/HttpProducer.java | 3 ++-
.../camel/component/hystrix/processor/HystrixProcessor.java | 5 +++--
.../hystrix/processor/HystrixProcessorCommand.java | 9 +++++----
.../org/apache/camel/component/ironmq/IronMQConsumer.java | 7 ++++---
.../apache/camel/converter/jaxb/FallbackTypeConverter.java | 3 ++-
.../org/apache/camel/converter/jaxb/JaxbDataFormat.java | 5 +++--
.../camel/component/jclouds/JcloudsBlobStoreConsumer.java | 7 ++++---
.../java/org/apache/camel/component/jpa/JpaConsumer.java | 7 ++++---
.../apache/camel/component/leveldb/LevelDBCamelCodec.java | 9 +++++----
.../leveldb/serializer/AbstractLevelDBSerializer.java | 9 +++++----
.../java/org/apache/camel/component/mail/MailConsumer.java | 7 ++++---
.../faulttolerance/FaultToleranceProcessor.java | 13 +++++++------
.../java/org/apache/camel/component/mina/MinaConsumer.java | 3 ++-
.../java/org/apache/camel/component/mina/MinaProducer.java | 3 ++-
.../org/apache/camel/component/minio/MinioConsumer.java | 7 ++++---
.../java/org/apache/camel/component/mllp/MllpEndpoint.java | 3 ++-
.../apache/camel/component/mllp/MllpTcpClientProducer.java | 3 ++-
.../apache/camel/component/mllp/MllpTcpServerConsumer.java | 3 ++-
.../org/apache/camel/component/mybatis/MyBatisConsumer.java | 7 ++++---
.../camel/component/netty/http/NettyHttpConverter.java | 3 ++-
.../apache/camel/component/netty/http/NettyHttpHelper.java | 3 ++-
.../netty/http/handlers/HttpServerChannelHandler.java | 3 ++-
.../org/apache/camel/component/netty/NettyProducer.java | 3 ++-
.../component/netty/handlers/ServerChannelHandler.java | 3 ++-
.../platform/http/vertx/VertxPlatformHttpConsumer.java | 3 ++-
.../camel/component/resilience4j/ResilienceProcessor.java | 11 ++++++-----
.../org/apache/camel/component/slack/SlackConsumer.java | 7 ++++---
.../camel/dataformat/soap/Soap11DataFormatAdapter.java | 3 ++-
.../camel/dataformat/soap/Soap12DataFormatAdapter.java | 3 ++-
.../org/apache/camel/component/splunk/SplunkConsumer.java | 7 ++++---
.../java/org/apache/camel/component/sql/SqlConsumer.java | 7 ++++---
.../camel/processor/aggregate/jdbc/JdbcCamelCodec.java | 11 ++++++-----
.../org/apache/camel/component/stream/StreamProducer.java | 3 ++-
.../apache/camel/component/undertow/UndertowConsumer.java | 3 ++-
.../camel/component/vertx/common/VertxBufferConverter.java | 3 ++-
.../camel/component/vertx/http/DefaultVertxHttpBinding.java | 3 ++-
.../apache/camel/component/vertx/http/VertxHttpHelper.java | 3 ++-
.../apache/camel/dataformat/xstream/XStreamDataFormat.java | 5 +++--
66 files changed, 211 insertions(+), 145 deletions(-)
diff --git a/components/camel-ahc/src/main/java/org/apache/camel/component/ahc/helper/AhcHelper.java b/components/camel-ahc/src/main/java/org/apache/camel/component/ahc/helper/AhcHelper.java
index cf6b7d9..4ded81d 100644
--- a/components/camel-ahc/src/main/java/org/apache/camel/component/ahc/helper/AhcHelper.java
+++ b/components/camel-ahc/src/main/java/org/apache/camel/component/ahc/helper/AhcHelper.java
@@ -26,6 +26,7 @@ import java.net.URI;
import java.net.URISyntaxException;
import org.apache.camel.Exchange;
+import org.apache.camel.ExchangePropertyKey;
import org.apache.camel.RuntimeExchangeException;
import org.apache.camel.component.ahc.AhcEndpoint;
import org.apache.camel.util.IOHelper;
@@ -81,7 +82,7 @@ public final class AhcHelper {
public static void setCharsetFromContentType(String contentType, Exchange exchange) {
if (contentType != null) {
- exchange.setProperty(Exchange.CHARSET_NAME, IOHelper.getCharsetNameFromContentType(contentType));
+ exchange.setProperty(ExchangePropertyKey.CHARSET_NAME, IOHelper.getCharsetNameFromContentType(contentType));
}
}
diff --git a/components/camel-aws/camel-aws2-s3/src/main/java/org/apache/camel/component/aws2/s3/AWS2S3Consumer.java b/components/camel-aws/camel-aws2-s3/src/main/java/org/apache/camel/component/aws2/s3/AWS2S3Consumer.java
index a1a4d135..2c5192e 100644
--- a/components/camel-aws/camel-aws2-s3/src/main/java/org/apache/camel/component/aws2/s3/AWS2S3Consumer.java
+++ b/components/camel-aws/camel-aws2-s3/src/main/java/org/apache/camel/component/aws2/s3/AWS2S3Consumer.java
@@ -27,6 +27,7 @@ import java.util.Queue;
import org.apache.camel.AsyncCallback;
import org.apache.camel.Exchange;
import org.apache.camel.ExchangePattern;
+import org.apache.camel.ExchangePropertyKey;
import org.apache.camel.ExtendedExchange;
import org.apache.camel.Message;
import org.apache.camel.Processor;
@@ -260,9 +261,9 @@ public class AWS2S3Consumer extends ScheduledBatchPollingConsumer {
// only loop if we are started (allowed to run)
final Exchange exchange = ObjectHelper.cast(Exchange.class, exchanges.poll());
// add current index and total as properties
- exchange.setProperty(Exchange.BATCH_INDEX, index);
- exchange.setProperty(Exchange.BATCH_SIZE, total);
- exchange.setProperty(Exchange.BATCH_COMPLETE, index == total - 1);
+ exchange.setProperty(ExchangePropertyKey.BATCH_INDEX, index);
+ exchange.setProperty(ExchangePropertyKey.BATCH_SIZE, total);
+ exchange.setProperty(ExchangePropertyKey.BATCH_COMPLETE, index == total - 1);
// update pending number of exchanges
pendingExchanges = total - index - 1;
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 c1f6421..9e9d2f2 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
@@ -30,6 +30,7 @@ import java.util.concurrent.TimeUnit;
import org.apache.camel.AsyncCallback;
import org.apache.camel.Exchange;
import org.apache.camel.ExchangePattern;
+import org.apache.camel.ExchangePropertyKey;
import org.apache.camel.ExtendedExchange;
import org.apache.camel.Message;
import org.apache.camel.Processor;
@@ -157,9 +158,9 @@ public class Sqs2Consumer extends ScheduledBatchPollingConsumer {
// only loop if we are started (allowed to run)
final Exchange exchange = ObjectHelper.cast(Exchange.class, exchanges.poll());
// add current index and total as properties
- exchange.setProperty(Exchange.BATCH_INDEX, index);
- exchange.setProperty(Exchange.BATCH_SIZE, total);
- exchange.setProperty(Exchange.BATCH_COMPLETE, index == total - 1);
+ exchange.setProperty(ExchangePropertyKey.BATCH_INDEX, index);
+ exchange.setProperty(ExchangePropertyKey.BATCH_SIZE, total);
+ exchange.setProperty(ExchangePropertyKey.BATCH_COMPLETE, index == total - 1);
// update pending number of exchanges
pendingExchanges = total - index - 1;
@@ -249,14 +250,14 @@ public class Sqs2Consumer extends ScheduledBatchPollingConsumer {
}
private boolean shouldDelete(Exchange exchange) {
- boolean shouldDeleteByFilter = exchange.getProperty(Exchange.FILTER_MATCHED) != null
+ boolean shouldDeleteByFilter = exchange.getProperty(ExchangePropertyKey.FILTER_MATCHED) != null
&& getConfiguration().isDeleteIfFiltered() && passedThroughFilter(exchange);
return getConfiguration().isDeleteAfterRead() || shouldDeleteByFilter;
}
private boolean passedThroughFilter(Exchange exchange) {
- return exchange.getProperty(Exchange.FILTER_MATCHED, false, Boolean.class);
+ return exchange.getProperty(ExchangePropertyKey.FILTER_MATCHED, false, Boolean.class);
}
/**
diff --git a/components/camel-azure/camel-azure-storage-blob/src/main/java/org/apache/camel/component/azure/storage/blob/BlobConsumer.java b/components/camel-azure/camel-azure-storage-blob/src/main/java/org/apache/camel/component/azure/storage/blob/BlobConsumer.java
index 115e797..dbac12c 100644
--- a/components/camel-azure/camel-azure-storage-blob/src/main/java/org/apache/camel/component/azure/storage/blob/BlobConsumer.java
+++ b/components/camel-azure/camel-azure-storage-blob/src/main/java/org/apache/camel/component/azure/storage/blob/BlobConsumer.java
@@ -26,6 +26,7 @@ import com.azure.storage.blob.models.BlobItem;
import com.azure.storage.blob.models.BlobStorageException;
import org.apache.camel.AsyncCallback;
import org.apache.camel.Exchange;
+import org.apache.camel.ExchangePropertyKey;
import org.apache.camel.ExtendedExchange;
import org.apache.camel.Processor;
import org.apache.camel.component.azure.storage.blob.client.BlobClientWrapper;
@@ -130,9 +131,9 @@ public class BlobConsumer extends ScheduledBatchPollingConsumer {
final Exchange exchange = ObjectHelper.cast(Exchange.class, exchanges.poll());
// add current index and total as properties
- exchange.setProperty(Exchange.BATCH_INDEX, index);
- exchange.setProperty(Exchange.BATCH_SIZE, total);
- exchange.setProperty(Exchange.BATCH_COMPLETE, index == total - 1);
+ exchange.setProperty(ExchangePropertyKey.BATCH_INDEX, index);
+ exchange.setProperty(ExchangePropertyKey.BATCH_SIZE, total);
+ exchange.setProperty(ExchangePropertyKey.BATCH_COMPLETE, index == total - 1);
// update pending number of exchanges
pendingExchanges = total - index - 1;
diff --git a/components/camel-azure/camel-azure-storage-datalake/src/main/java/org/apache/camel/component/azure/storage/datalake/DataLakeConsumer.java b/components/camel-azure/camel-azure-storage-datalake/src/main/java/org/apache/camel/component/azure/storage/datalake/DataLakeConsumer.java
index 0189931..52c500d 100644
--- a/components/camel-azure/camel-azure-storage-datalake/src/main/java/org/apache/camel/component/azure/storage/datalake/DataLakeConsumer.java
+++ b/components/camel-azure/camel-azure-storage-datalake/src/main/java/org/apache/camel/component/azure/storage/datalake/DataLakeConsumer.java
@@ -27,6 +27,7 @@ import com.azure.storage.file.datalake.models.PathItem;
import org.apache.camel.AsyncCallback;
import org.apache.camel.Endpoint;
import org.apache.camel.Exchange;
+import org.apache.camel.ExchangePropertyKey;
import org.apache.camel.ExtendedExchange;
import org.apache.camel.Processor;
import org.apache.camel.component.azure.storage.datalake.client.DataLakeFileClientWrapper;
@@ -131,9 +132,9 @@ class DataLakeConsumer extends ScheduledBatchPollingConsumer {
for (int i = 0; i < total && isBatchAllowed(); i++) {
final Exchange exchange = ObjectHelper.cast(Exchange.class, exchanges.poll());
- exchange.setProperty(Exchange.BATCH_INDEX, i);
- exchange.setProperty(Exchange.BATCH_SIZE, total);
- exchange.setProperty(Exchange.BATCH_COMPLETE, i == total - 1);
+ exchange.setProperty(ExchangePropertyKey.BATCH_INDEX, i);
+ exchange.setProperty(ExchangePropertyKey.BATCH_SIZE, total);
+ exchange.setProperty(ExchangePropertyKey.BATCH_COMPLETE, i == total - 1);
pendingExchanges = total - i - 1;
diff --git a/components/camel-azure/camel-azure-storage-queue/src/main/java/org/apache/camel/component/azure/storage/queue/QueueConsumer.java b/components/camel-azure/camel-azure-storage-queue/src/main/java/org/apache/camel/component/azure/storage/queue/QueueConsumer.java
index b5e8969..4364a1f 100644
--- a/components/camel-azure/camel-azure-storage-queue/src/main/java/org/apache/camel/component/azure/storage/queue/QueueConsumer.java
+++ b/components/camel-azure/camel-azure-storage-queue/src/main/java/org/apache/camel/component/azure/storage/queue/QueueConsumer.java
@@ -27,6 +27,7 @@ import com.azure.storage.queue.models.QueueMessageItem;
import com.azure.storage.queue.models.QueueStorageException;
import org.apache.camel.AsyncCallback;
import org.apache.camel.Exchange;
+import org.apache.camel.ExchangePropertyKey;
import org.apache.camel.ExtendedExchange;
import org.apache.camel.Message;
import org.apache.camel.Processor;
@@ -107,9 +108,9 @@ public class QueueConsumer extends ScheduledBatchPollingConsumer {
final Exchange exchange = ObjectHelper.cast(Exchange.class, exchanges.poll());
// add current index and total as properties
- exchange.setProperty(Exchange.BATCH_INDEX, index);
- exchange.setProperty(Exchange.BATCH_SIZE, total);
- exchange.setProperty(Exchange.BATCH_COMPLETE, index == total - 1);
+ exchange.setProperty(ExchangePropertyKey.BATCH_INDEX, index);
+ exchange.setProperty(ExchangePropertyKey.BATCH_SIZE, total);
+ exchange.setProperty(ExchangePropertyKey.BATCH_COMPLETE, index == total - 1);
// update pending number of exchanges
pendingExchanges = total - index - 1;
diff --git a/components/camel-bean/src/main/java/org/apache/camel/component/bean/MethodInfo.java b/components/camel-bean/src/main/java/org/apache/camel/component/bean/MethodInfo.java
index 252d4af..7dc62ba 100644
--- a/components/camel-bean/src/main/java/org/apache/camel/component/bean/MethodInfo.java
+++ b/components/camel-bean/src/main/java/org/apache/camel/component/bean/MethodInfo.java
@@ -36,6 +36,7 @@ import org.apache.camel.AsyncProcessor;
import org.apache.camel.CamelContext;
import org.apache.camel.Exchange;
import org.apache.camel.ExchangePattern;
+import org.apache.camel.ExchangePropertyKey;
import org.apache.camel.Expression;
import org.apache.camel.ExpressionEvaluationException;
import org.apache.camel.ExtendedCamelContext;
@@ -303,7 +304,7 @@ public class MethodInfo {
// use a expression which invokes the method to be used by dynamic router
Expression expression = new DynamicRouterExpression(pojo);
expression.init(camelContext);
- exchange.setProperty(Exchange.EVALUATE_EXPRESSION_RESULT, expression);
+ exchange.setProperty(ExchangePropertyKey.EVALUATE_EXPRESSION_RESULT, expression);
return dynamicRouter.process(exchange, callback);
}
@@ -331,14 +332,14 @@ public class MethodInfo {
if (!ServiceHelper.isStarted(recipientList)) {
ServiceHelper.startService(recipientList);
}
- exchange.setProperty(Exchange.EVALUATE_EXPRESSION_RESULT, result);
+ exchange.setProperty(ExchangePropertyKey.EVALUATE_EXPRESSION_RESULT, result);
return recipientList.process(exchange, callback);
}
if (routingSlip != null) {
if (!ServiceHelper.isStarted(routingSlip)) {
ServiceHelper.startService(routingSlip);
}
- exchange.setProperty(Exchange.EVALUATE_EXPRESSION_RESULT, result);
+ exchange.setProperty(ExchangePropertyKey.EVALUATE_EXPRESSION_RESULT, result);
return routingSlip.process(exchange, callback);
}
diff --git a/components/camel-cassandraql/src/main/java/org/apache/camel/processor/aggregate/cassandra/CassandraCamelCodec.java b/components/camel-cassandraql/src/main/java/org/apache/camel/processor/aggregate/cassandra/CassandraCamelCodec.java
index 1385266..464a2de 100644
--- a/components/camel-cassandraql/src/main/java/org/apache/camel/processor/aggregate/cassandra/CassandraCamelCodec.java
+++ b/components/camel-cassandraql/src/main/java/org/apache/camel/processor/aggregate/cassandra/CassandraCamelCodec.java
@@ -26,6 +26,7 @@ import java.nio.ByteBuffer;
import org.apache.camel.CamelContext;
import org.apache.camel.Endpoint;
import org.apache.camel.Exchange;
+import org.apache.camel.ExchangePropertyKey;
import org.apache.camel.ExtendedExchange;
import org.apache.camel.support.DefaultExchange;
import org.apache.camel.support.DefaultExchangeHolder;
@@ -42,15 +43,15 @@ public class CassandraCamelCodec {
// add the aggregated size and timeout property as the only properties
// we want to retain
DefaultExchangeHolder.addProperty(pe, Exchange.AGGREGATED_SIZE,
- exchange.getProperty(Exchange.AGGREGATED_SIZE, Integer.class));
+ exchange.getProperty(ExchangePropertyKey.AGGREGATED_SIZE, Integer.class));
DefaultExchangeHolder.addProperty(pe, Exchange.AGGREGATED_TIMEOUT,
- exchange.getProperty(Exchange.AGGREGATED_TIMEOUT, Long.class));
+ exchange.getProperty(ExchangePropertyKey.AGGREGATED_TIMEOUT, Long.class));
// add the aggregated completed by property to retain
DefaultExchangeHolder.addProperty(pe, Exchange.AGGREGATED_COMPLETED_BY,
- exchange.getProperty(Exchange.AGGREGATED_COMPLETED_BY, String.class));
+ exchange.getProperty(ExchangePropertyKey.AGGREGATED_COMPLETED_BY, String.class));
// add the aggregated correlation key property to retain
DefaultExchangeHolder.addProperty(pe, Exchange.AGGREGATED_CORRELATION_KEY,
- exchange.getProperty(Exchange.AGGREGATED_CORRELATION_KEY, String.class));
+ exchange.getProperty(ExchangePropertyKey.AGGREGATED_CORRELATION_KEY, String.class));
// and a guard property if using the flexible toolbox aggregator
DefaultExchangeHolder.addProperty(pe, Exchange.AGGREGATED_COLLECTION_GUARD,
exchange.getProperty(Exchange.AGGREGATED_COLLECTION_GUARD, String.class));
diff --git a/components/camel-cxf-transport/src/main/java/org/apache/camel/component/cxf/transport/CamelOutputStream.java b/components/camel-cxf-transport/src/main/java/org/apache/camel/component/cxf/transport/CamelOutputStream.java
index 617cd79..3112b8b 100644
--- a/components/camel-cxf-transport/src/main/java/org/apache/camel/component/cxf/transport/CamelOutputStream.java
+++ b/components/camel-cxf-transport/src/main/java/org/apache/camel/component/cxf/transport/CamelOutputStream.java
@@ -23,6 +23,7 @@ import java.util.concurrent.RejectedExecutionException;
import org.apache.camel.Exchange;
import org.apache.camel.ExchangePattern;
+import org.apache.camel.ExchangePropertyKey;
import org.apache.camel.Producer;
import org.apache.camel.component.cxf.common.header.CxfHeaderHelper;
import org.apache.camel.component.cxf.common.message.CxfMessageHelper;
@@ -88,7 +89,7 @@ class CamelOutputStream extends CachedOutputStream {
LOG.debug("send the message to endpoint {}", this.targetCamelEndpointUri);
final org.apache.camel.Exchange exchange = this.producer.getEndpoint().createExchange(pattern);
- exchange.setProperty(Exchange.TO_ENDPOINT, this.targetCamelEndpointUri);
+ exchange.setProperty(ExchangePropertyKey.TO_ENDPOINT, this.targetCamelEndpointUri);
CachedOutputStream outputStream = (CachedOutputStream) outMessage.getContent(OutputStream.class);
// Send out the request message here, copy the protocolHeader back
CxfHeaderHelper.propagateCxfToCamel(this.headerFilterStrategy, outMessage, exchange.getIn(), exchange);
diff --git a/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/DefaultCxfBinding.java b/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/DefaultCxfBinding.java
index cd90b79..b7c4ea4 100644
--- a/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/DefaultCxfBinding.java
+++ b/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/DefaultCxfBinding.java
@@ -38,6 +38,7 @@ import javax.xml.transform.Source;
import javax.xml.transform.dom.DOMSource;
import javax.xml.ws.Holder;
+import org.apache.camel.ExchangePropertyKey;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.NamedNodeMap;
@@ -176,7 +177,7 @@ public class DefaultCxfBinding implements CxfBinding, HeaderFilterStrategyAware
camelExchange.getOut().getHeaders().putAll(camelExchange.getIn().getHeaders());
// propagate body
- String encoding = (String) camelExchange.getProperty(Exchange.CHARSET_NAME);
+ String encoding = (String) camelExchange.getProperty(ExchangePropertyKey.CHARSET_NAME);
camelExchange.getOut().setBody(DefaultCxfBinding.getContentFromCxf(cxfMessage,
camelExchange.getProperty(CxfConstants.DATA_FORMAT_PROPERTY, DataFormat.class), encoding));
@@ -303,7 +304,7 @@ public class DefaultCxfBinding implements CxfBinding, HeaderFilterStrategyAware
setCharsetWithContentType(camelExchange);
// set body
- String encoding = (String) camelExchange.getProperty(Exchange.CHARSET_NAME);
+ String encoding = (String) camelExchange.getProperty(ExchangePropertyKey.CHARSET_NAME);
Object body = DefaultCxfBinding.getContentFromCxf(cxfMessage,
camelExchange.getProperty(CxfConstants.DATA_FORMAT_PROPERTY, DataFormat.class), encoding);
if (body != null) {
@@ -496,7 +497,7 @@ public class DefaultCxfBinding implements CxfBinding, HeaderFilterStrategyAware
String charset = HttpHeaderHelper.findCharset(contentTypeHeader);
String normalizedEncoding = HttpHeaderHelper.mapCharset(charset, Charset.forName("UTF-8").name());
if (normalizedEncoding != null) {
- camelExchange.setProperty(Exchange.CHARSET_NAME, normalizedEncoding);
+ camelExchange.setProperty(ExchangePropertyKey.CHARSET_NAME, normalizedEncoding);
}
}
}
diff --git a/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/jaxrs/DefaultCxfRsBinding.java b/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/jaxrs/DefaultCxfRsBinding.java
index fd3c6af..44e88d4 100644
--- a/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/jaxrs/DefaultCxfRsBinding.java
+++ b/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/jaxrs/DefaultCxfRsBinding.java
@@ -33,6 +33,7 @@ import javax.ws.rs.core.Response;
import javax.ws.rs.core.Variant;
import org.apache.camel.Exchange;
+import org.apache.camel.ExchangePropertyKey;
import org.apache.camel.Message;
import org.apache.camel.component.cxf.common.header.CxfHeaderHelper;
import org.apache.camel.component.cxf.common.message.CxfConstants;
@@ -184,7 +185,7 @@ public class DefaultCxfRsBinding implements CxfRsBinding, HeaderFilterStrategyAw
String charset = HttpHeaderHelper.findCharset(contentTypeHeader);
String normalizedEncoding = HttpHeaderHelper.mapCharset(charset, Charset.forName("UTF-8").name());
if (normalizedEncoding != null) {
- camelExchange.setProperty(Exchange.CHARSET_NAME, normalizedEncoding);
+ camelExchange.setProperty(ExchangePropertyKey.CHARSET_NAME, normalizedEncoding);
}
}
}
diff --git a/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfCustomizedExceptionTest.java b/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfCustomizedExceptionTest.java
index 75d0c12..b9210cc 100644
--- a/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfCustomizedExceptionTest.java
+++ b/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfCustomizedExceptionTest.java
@@ -22,6 +22,7 @@ import java.io.OutputStream;
import java.net.URL;
import java.net.URLConnection;
+import org.apache.camel.ExchangePropertyKey;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Text;
@@ -101,7 +102,7 @@ public class CxfCustomizedExceptionTest extends CamelTestSupport {
.handled(true)
.process(new Processor() {
public void process(Exchange exchange) throws Exception {
- SoapFault fault = exchange.getProperty(Exchange.EXCEPTION_CAUGHT, SoapFault.class);
+ SoapFault fault = exchange.getProperty(ExchangePropertyKey.EXCEPTION_CAUGHT, SoapFault.class);
exchange.getMessage().setBody(fault);
}
diff --git a/components/camel-directvm/src/main/java/org/apache/camel/component/directvm/DirectVmProcessor.java b/components/camel-directvm/src/main/java/org/apache/camel/component/directvm/DirectVmProcessor.java
index 5260096..8a46866 100644
--- a/components/camel-directvm/src/main/java/org/apache/camel/component/directvm/DirectVmProcessor.java
+++ b/components/camel-directvm/src/main/java/org/apache/camel/component/directvm/DirectVmProcessor.java
@@ -18,6 +18,7 @@ package org.apache.camel.component.directvm;
import org.apache.camel.AsyncCallback;
import org.apache.camel.Exchange;
+import org.apache.camel.ExchangePropertyKey;
import org.apache.camel.ExtendedExchange;
import org.apache.camel.Processor;
import org.apache.camel.support.ExchangeHelper;
@@ -94,8 +95,8 @@ public final class DirectVmProcessor extends DelegateAsyncProcessor {
// work of the parent route or grand parent route or grand grand parent route ...(in case of nesting).
// Set therefore the unit of work of the parent route as stream cache unit of work,
// if it is not already set.
- if (newExchange.getProperty(Exchange.STREAM_CACHE_UNIT_OF_WORK) == null) {
- newExchange.setProperty(Exchange.STREAM_CACHE_UNIT_OF_WORK, exchange.getUnitOfWork());
+ if (newExchange.getProperty(ExchangePropertyKey.STREAM_CACHE_UNIT_OF_WORK) == null) {
+ newExchange.setProperty(ExchangePropertyKey.STREAM_CACHE_UNIT_OF_WORK, exchange.getUnitOfWork());
}
return newExchange;
}
diff --git a/components/camel-file/src/main/java/org/apache/camel/component/file/GenericFileConsumer.java b/components/camel-file/src/main/java/org/apache/camel/component/file/GenericFileConsumer.java
index 51b53a0..f6effa9 100644
--- a/components/camel-file/src/main/java/org/apache/camel/component/file/GenericFileConsumer.java
+++ b/components/camel-file/src/main/java/org/apache/camel/component/file/GenericFileConsumer.java
@@ -26,6 +26,7 @@ import java.util.regex.Pattern;
import org.apache.camel.CamelContextAware;
import org.apache.camel.Exchange;
+import org.apache.camel.ExchangePropertyKey;
import org.apache.camel.ExtendedExchange;
import org.apache.camel.Message;
import org.apache.camel.Processor;
@@ -228,9 +229,9 @@ public abstract class GenericFileConsumer<T> extends ScheduledBatchPollingConsum
// after we have processed it
Exchange exchange = (Exchange) exchanges.poll();
// add current index and total as properties
- exchange.setProperty(Exchange.BATCH_INDEX, index);
- exchange.setProperty(Exchange.BATCH_SIZE, total);
- exchange.setProperty(Exchange.BATCH_COMPLETE, index == total - 1);
+ exchange.setProperty(ExchangePropertyKey.BATCH_INDEX, index);
+ exchange.setProperty(ExchangePropertyKey.BATCH_SIZE, total);
+ exchange.setProperty(ExchangePropertyKey.BATCH_COMPLETE, index == total - 1);
// update pending number of exchanges
pendingExchanges = total - index - 1;
diff --git a/components/camel-file/src/main/java/org/apache/camel/component/file/GenericFileEndpoint.java b/components/camel-file/src/main/java/org/apache/camel/component/file/GenericFileEndpoint.java
index 30d4f32..a1dd9bc 100644
--- a/components/camel-file/src/main/java/org/apache/camel/component/file/GenericFileEndpoint.java
+++ b/components/camel-file/src/main/java/org/apache/camel/component/file/GenericFileEndpoint.java
@@ -27,6 +27,7 @@ import java.util.regex.Pattern;
import org.apache.camel.Component;
import org.apache.camel.Exchange;
+import org.apache.camel.ExchangePropertyKey;
import org.apache.camel.Expression;
import org.apache.camel.ExpressionIllegalSyntaxException;
import org.apache.camel.LoggingLevel;
@@ -1544,7 +1545,7 @@ public abstract class GenericFileEndpoint<T> extends ScheduledPollEndpoint imple
public void configureExchange(Exchange exchange) {
// Now we just set the charset property here
if (getCharset() != null) {
- exchange.setProperty(Exchange.CHARSET_NAME, getCharset());
+ exchange.setProperty(ExchangePropertyKey.CHARSET_NAME, getCharset());
}
}
diff --git a/components/camel-file/src/main/java/org/apache/camel/component/file/GenericFileOnCompletion.java b/components/camel-file/src/main/java/org/apache/camel/component/file/GenericFileOnCompletion.java
index 83efc6b..38c8d5b 100644
--- a/components/camel-file/src/main/java/org/apache/camel/component/file/GenericFileOnCompletion.java
+++ b/components/camel-file/src/main/java/org/apache/camel/component/file/GenericFileOnCompletion.java
@@ -17,6 +17,7 @@
package org.apache.camel.component.file;
import org.apache.camel.Exchange;
+import org.apache.camel.ExchangePropertyKey;
import org.apache.camel.spi.ExceptionHandler;
import org.apache.camel.spi.Synchronization;
import org.apache.camel.support.LoggingExceptionHandler;
@@ -167,7 +168,7 @@ public class GenericFileOnCompletion<T> implements Synchronization {
protected void handleDoneFile(Exchange exchange) {
// must be last in batch to delete the done file name
// delete done file if used (and not noop=true)
- boolean complete = exchange.getProperty(Exchange.BATCH_COMPLETE, false, Boolean.class);
+ boolean complete = exchange.getProperty(ExchangePropertyKey.BATCH_COMPLETE, false, Boolean.class);
if (endpoint.getDoneFileName() != null && !endpoint.isNoop()) {
// done file must be in same path as the original input file
String doneFileName = endpoint.createDoneFileName(absoluteFileName);
diff --git a/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/RemoteFileConsumer.java b/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/RemoteFileConsumer.java
index 83e2292..9a651e5 100644
--- a/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/RemoteFileConsumer.java
+++ b/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/RemoteFileConsumer.java
@@ -20,6 +20,7 @@ import java.io.IOException;
import java.util.List;
import org.apache.camel.Exchange;
+import org.apache.camel.ExchangePropertyKey;
import org.apache.camel.ExtendedExchange;
import org.apache.camel.Ordered;
import org.apache.camel.Processor;
@@ -125,7 +126,7 @@ public abstract class RemoteFileConsumer<T> extends GenericFileConsumer<T> {
// defer disconnect til the UoW is complete - but only the last exchange
// from the batch should do that
- boolean isLast = exchange.getProperty(Exchange.BATCH_COMPLETE, true, Boolean.class);
+ boolean isLast = exchange.getProperty(ExchangePropertyKey.BATCH_COMPLETE, true, Boolean.class);
if (isLast && getEndpoint().isDisconnect()) {
exchange.adapt(ExtendedExchange.class).addOnCompletion(new SynchronizationAdapter() {
@Override
diff --git a/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/RemoteFileProducer.java b/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/RemoteFileProducer.java
index a239a2f..a415f88 100644
--- a/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/RemoteFileProducer.java
+++ b/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/RemoteFileProducer.java
@@ -17,6 +17,7 @@
package org.apache.camel.component.file.remote;
import org.apache.camel.Exchange;
+import org.apache.camel.ExchangePropertyKey;
import org.apache.camel.component.file.GenericFileOperationFailedException;
import org.apache.camel.component.file.GenericFileProducer;
import org.apache.camel.util.URISupport;
@@ -146,7 +147,7 @@ public class RemoteFileProducer<T> extends GenericFileProducer<T> {
@Override
public void postWriteCheck(Exchange exchange) {
try {
- boolean isLast = exchange.getProperty(Exchange.BATCH_COMPLETE, false, Boolean.class);
+ boolean isLast = exchange.getProperty(ExchangePropertyKey.BATCH_COMPLETE, false, Boolean.class);
if (isLast && getEndpoint().isDisconnectOnBatchComplete()) {
LOG.trace("postWriteCheck disconnect on batch complete from: {}", getEndpoint());
disconnect();
diff --git a/components/camel-google/camel-google-bigquery/src/main/java/org/apache/camel/component/google/bigquery/GoogleBigQueryProducer.java b/components/camel-google/camel-google-bigquery/src/main/java/org/apache/camel/component/google/bigquery/GoogleBigQueryProducer.java
index 8438008..0857461 100644
--- a/components/camel-google/camel-google-bigquery/src/main/java/org/apache/camel/component/google/bigquery/GoogleBigQueryProducer.java
+++ b/components/camel-google/camel-google-bigquery/src/main/java/org/apache/camel/component/google/bigquery/GoogleBigQueryProducer.java
@@ -25,6 +25,7 @@ import com.google.cloud.bigquery.BigQuery;
import com.google.cloud.bigquery.InsertAllRequest;
import com.google.cloud.bigquery.InsertAllResponse;
import org.apache.camel.Exchange;
+import org.apache.camel.ExchangePropertyKey;
import org.apache.camel.support.DefaultProducer;
import org.apache.camel.util.ObjectHelper;
import org.slf4j.Logger;
@@ -53,11 +54,11 @@ public class GoogleBigQueryProducer extends DefaultProducer {
private static List<Exchange> prepareExchangeList(Exchange exchange) {
List<Exchange> entryList;
- if (null == exchange.getProperty(Exchange.GROUPED_EXCHANGE)) {
+ if (null == exchange.getProperty(ExchangePropertyKey.GROUPED_EXCHANGE)) {
entryList = new ArrayList<>();
entryList.add(exchange);
} else {
- entryList = (List<Exchange>) exchange.getProperty(Exchange.GROUPED_EXCHANGE);
+ entryList = (List<Exchange>) exchange.getProperty(ExchangePropertyKey.GROUPED_EXCHANGE);
}
return entryList;
diff --git a/components/camel-google/camel-google-calendar/src/main/java/org/apache/camel/component/google/calendar/stream/GoogleCalendarStreamConsumer.java b/components/camel-google/camel-google-calendar/src/main/java/org/apache/camel/component/google/calendar/stream/GoogleCalendarStreamConsumer.java
index 100be42..3701415 100644
--- a/components/camel-google/camel-google-calendar/src/main/java/org/apache/camel/component/google/calendar/stream/GoogleCalendarStreamConsumer.java
+++ b/components/camel-google/camel-google-calendar/src/main/java/org/apache/camel/component/google/calendar/stream/GoogleCalendarStreamConsumer.java
@@ -29,6 +29,7 @@ import com.google.api.services.calendar.model.Event;
import com.google.api.services.calendar.model.Events;
import org.apache.camel.Endpoint;
import org.apache.camel.Exchange;
+import org.apache.camel.ExchangePropertyKey;
import org.apache.camel.Processor;
import org.apache.camel.support.EmptyAsyncCallback;
import org.apache.camel.support.ScheduledBatchPollingConsumer;
@@ -173,9 +174,9 @@ public class GoogleCalendarStreamConsumer extends ScheduledBatchPollingConsumer
// only loop if we are started (allowed to run)
final Exchange exchange = ObjectHelper.cast(Exchange.class, exchanges.poll());
// add current index and total as properties
- exchange.setProperty(Exchange.BATCH_INDEX, index);
- exchange.setProperty(Exchange.BATCH_SIZE, total);
- exchange.setProperty(Exchange.BATCH_COMPLETE, index == total - 1);
+ exchange.setProperty(ExchangePropertyKey.BATCH_INDEX, index);
+ exchange.setProperty(ExchangePropertyKey.BATCH_SIZE, total);
+ exchange.setProperty(ExchangePropertyKey.BATCH_COMPLETE, index == total - 1);
// update pending number of exchanges
pendingExchanges = total - index - 1;
diff --git a/components/camel-google/camel-google-mail/src/main/java/org/apache/camel/component/google/mail/stream/GoogleMailStreamConsumer.java b/components/camel-google/camel-google-mail/src/main/java/org/apache/camel/component/google/mail/stream/GoogleMailStreamConsumer.java
index 4acf6cb..425189d 100644
--- a/components/camel-google/camel-google-mail/src/main/java/org/apache/camel/component/google/mail/stream/GoogleMailStreamConsumer.java
+++ b/components/camel-google/camel-google-mail/src/main/java/org/apache/camel/component/google/mail/stream/GoogleMailStreamConsumer.java
@@ -32,6 +32,7 @@ import com.google.api.services.gmail.model.ModifyMessageRequest;
import org.apache.camel.Endpoint;
import org.apache.camel.Exchange;
import org.apache.camel.ExchangePattern;
+import org.apache.camel.ExchangePropertyKey;
import org.apache.camel.ExtendedExchange;
import org.apache.camel.Processor;
import org.apache.camel.spi.Synchronization;
@@ -105,9 +106,9 @@ public class GoogleMailStreamConsumer extends ScheduledBatchPollingConsumer {
// only loop if we are started (allowed to run)
final Exchange exchange = ObjectHelper.cast(Exchange.class, exchanges.poll());
// add current index and total as properties
- exchange.setProperty(Exchange.BATCH_INDEX, index);
- exchange.setProperty(Exchange.BATCH_SIZE, total);
- exchange.setProperty(Exchange.BATCH_COMPLETE, index == total - 1);
+ exchange.setProperty(ExchangePropertyKey.BATCH_INDEX, index);
+ exchange.setProperty(ExchangePropertyKey.BATCH_SIZE, total);
+ exchange.setProperty(ExchangePropertyKey.BATCH_COMPLETE, index == total - 1);
// update pending number of exchanges
pendingExchanges = total - index - 1;
diff --git a/components/camel-google/camel-google-sheets/src/main/java/org/apache/camel/component/google/sheets/stream/GoogleSheetsStreamConsumer.java b/components/camel-google/camel-google-sheets/src/main/java/org/apache/camel/component/google/sheets/stream/GoogleSheetsStreamConsumer.java
index 41b708a..b1993b9 100644
--- a/components/camel-google/camel-google-sheets/src/main/java/org/apache/camel/component/google/sheets/stream/GoogleSheetsStreamConsumer.java
+++ b/components/camel-google/camel-google-sheets/src/main/java/org/apache/camel/component/google/sheets/stream/GoogleSheetsStreamConsumer.java
@@ -31,6 +31,7 @@ import com.google.api.services.sheets.v4.model.ValueRange;
import org.apache.camel.AsyncCallback;
import org.apache.camel.Endpoint;
import org.apache.camel.Exchange;
+import org.apache.camel.ExchangePropertyKey;
import org.apache.camel.Message;
import org.apache.camel.Processor;
import org.apache.camel.support.ScheduledBatchPollingConsumer;
@@ -139,9 +140,9 @@ public class GoogleSheetsStreamConsumer extends ScheduledBatchPollingConsumer {
// only loop if we are started (allowed to run)
final Exchange exchange = ObjectHelper.cast(Exchange.class, exchanges.poll());
// add current index and total as properties
- exchange.setProperty(Exchange.BATCH_INDEX, index);
- exchange.setProperty(Exchange.BATCH_SIZE, total);
- exchange.setProperty(Exchange.BATCH_COMPLETE, index == total - 1);
+ exchange.setProperty(ExchangePropertyKey.BATCH_INDEX, index);
+ exchange.setProperty(ExchangePropertyKey.BATCH_SIZE, total);
+ exchange.setProperty(ExchangePropertyKey.BATCH_COMPLETE, index == total - 1);
// update pending number of exchanges
pendingExchanges = total - index - 1;
diff --git a/components/camel-google/camel-google-storage/src/main/java/org/apache/camel/component/google/storage/GoogleCloudStorageConsumer.java b/components/camel-google/camel-google-storage/src/main/java/org/apache/camel/component/google/storage/GoogleCloudStorageConsumer.java
index 2a299b2..991c151 100644
--- a/components/camel-google/camel-google-storage/src/main/java/org/apache/camel/component/google/storage/GoogleCloudStorageConsumer.java
+++ b/components/camel-google/camel-google-storage/src/main/java/org/apache/camel/component/google/storage/GoogleCloudStorageConsumer.java
@@ -31,6 +31,7 @@ import com.google.cloud.storage.Storage.CopyRequest;
import org.apache.camel.AsyncCallback;
import org.apache.camel.Exchange;
import org.apache.camel.ExchangePattern;
+import org.apache.camel.ExchangePropertyKey;
import org.apache.camel.ExtendedExchange;
import org.apache.camel.Message;
import org.apache.camel.Processor;
@@ -155,9 +156,9 @@ public class GoogleCloudStorageConsumer extends ScheduledBatchPollingConsumer {
// only loop if we are started (allowed to run)
final Exchange exchange = ObjectHelper.cast(Exchange.class, exchanges.poll());
// add current index and total as properties
- exchange.setProperty(Exchange.BATCH_INDEX, index);
- exchange.setProperty(Exchange.BATCH_SIZE, total);
- exchange.setProperty(Exchange.BATCH_COMPLETE, index == total - 1);
+ exchange.setProperty(ExchangePropertyKey.BATCH_INDEX, index);
+ exchange.setProperty(ExchangePropertyKey.BATCH_SIZE, total);
+ exchange.setProperty(ExchangePropertyKey.BATCH_COMPLETE, index == total - 1);
// update pending number of exchanges
pendingExchanges = total - index - 1;
diff --git a/components/camel-hbase/src/main/java/org/apache/camel/component/hbase/HBaseConsumer.java b/components/camel-hbase/src/main/java/org/apache/camel/component/hbase/HBaseConsumer.java
index d2c3867..88b3b64 100644
--- a/components/camel-hbase/src/main/java/org/apache/camel/component/hbase/HBaseConsumer.java
+++ b/components/camel-hbase/src/main/java/org/apache/camel/component/hbase/HBaseConsumer.java
@@ -23,6 +23,7 @@ import java.util.Queue;
import java.util.Set;
import org.apache.camel.Exchange;
+import org.apache.camel.ExchangePropertyKey;
import org.apache.camel.Processor;
import org.apache.camel.component.hbase.mapping.CellMappingStrategy;
import org.apache.camel.component.hbase.mapping.CellMappingStrategyFactory;
@@ -168,9 +169,9 @@ public class HBaseConsumer extends ScheduledBatchPollingConsumer {
// only loop if we are started (allowed to run)
Exchange exchange = ObjectHelper.cast(Exchange.class, exchanges.poll());
// add current index and total as properties
- exchange.setProperty(Exchange.BATCH_INDEX, index);
- exchange.setProperty(Exchange.BATCH_SIZE, total);
- exchange.setProperty(Exchange.BATCH_COMPLETE, index == total - 1);
+ exchange.setProperty(ExchangePropertyKey.BATCH_INDEX, index);
+ exchange.setProperty(ExchangePropertyKey.BATCH_SIZE, total);
+ exchange.setProperty(ExchangePropertyKey.BATCH_COMPLETE, index == total - 1);
// update pending number of exchanges
pendingExchanges = total - index - 1;
diff --git a/components/camel-hdfs/src/main/java/org/apache/camel/component/hdfs/HdfsConsumer.java b/components/camel-hdfs/src/main/java/org/apache/camel/component/hdfs/HdfsConsumer.java
index 7e197a4..1e38fc6 100644
--- a/components/camel-hdfs/src/main/java/org/apache/camel/component/hdfs/HdfsConsumer.java
+++ b/components/camel-hdfs/src/main/java/org/apache/camel/component/hdfs/HdfsConsumer.java
@@ -29,6 +29,7 @@ import java.util.stream.Collectors;
import javax.security.auth.login.Configuration;
import org.apache.camel.Exchange;
+import org.apache.camel.ExchangePropertyKey;
import org.apache.camel.ExtendedExchange;
import org.apache.camel.Message;
import org.apache.camel.Processor;
@@ -252,14 +253,14 @@ public final class HdfsConsumer extends ScheduledPollConsumer {
// do not share unit of work
exchange.adapt(ExtendedExchange.class).setUnitOfWork(null);
- exchange.setProperty(Exchange.SPLIT_INDEX, index);
+ exchange.setProperty(ExchangePropertyKey.SPLIT_INDEX, index);
if (hdfsFile.hasNext()) {
- exchange.setProperty(Exchange.SPLIT_COMPLETE, Boolean.FALSE);
+ exchange.setProperty(ExchangePropertyKey.SPLIT_COMPLETE, Boolean.FALSE);
} else {
- exchange.setProperty(Exchange.SPLIT_COMPLETE, Boolean.TRUE);
+ exchange.setProperty(ExchangePropertyKey.SPLIT_COMPLETE, Boolean.TRUE);
// streaming mode, so set total size when we are complete based on the index
- exchange.setProperty(Exchange.SPLIT_SIZE, index + 1);
+ exchange.setProperty(ExchangePropertyKey.SPLIT_SIZE, index + 1);
}
}
diff --git a/components/camel-hl7/src/main/java/org/apache/camel/component/hl7/AckExpression.java b/components/camel-hl7/src/main/java/org/apache/camel/component/hl7/AckExpression.java
index ac9cfbb..1564d7f 100644
--- a/components/camel-hl7/src/main/java/org/apache/camel/component/hl7/AckExpression.java
+++ b/components/camel-hl7/src/main/java/org/apache/camel/component/hl7/AckExpression.java
@@ -21,6 +21,7 @@ import ca.uhn.hl7v2.ErrorCode;
import ca.uhn.hl7v2.HL7Exception;
import ca.uhn.hl7v2.model.Message;
import org.apache.camel.Exchange;
+import org.apache.camel.ExchangePropertyKey;
import org.apache.camel.RuntimeCamelException;
import org.apache.camel.support.ExpressionAdapter;
@@ -46,7 +47,7 @@ public class AckExpression extends ExpressionAdapter {
@Override
public Object evaluate(Exchange exchange) {
- Throwable t = exchange.getProperty(Exchange.EXCEPTION_CAUGHT, Throwable.class);
+ Throwable t = exchange.getProperty(ExchangePropertyKey.EXCEPTION_CAUGHT, Throwable.class);
Message msg = exchange.getIn().getBody(Message.class);
try {
HL7Exception hl7e = generateHL7Exception(t);
diff --git a/components/camel-http-base/src/main/java/org/apache/camel/http/base/HttpHelper.java b/components/camel-http-base/src/main/java/org/apache/camel/http/base/HttpHelper.java
index db64572..4035a99 100644
--- a/components/camel-http-base/src/main/java/org/apache/camel/http/base/HttpHelper.java
+++ b/components/camel-http-base/src/main/java/org/apache/camel/http/base/HttpHelper.java
@@ -22,6 +22,7 @@ import java.util.List;
import java.util.Map;
import org.apache.camel.Exchange;
+import org.apache.camel.ExchangePropertyKey;
import org.apache.camel.util.IOHelper;
import org.apache.camel.util.ObjectHelper;
import org.apache.camel.util.StringHelper;
@@ -69,7 +70,7 @@ public final class HttpHelper {
if (contentType != null) {
String charset = IOHelper.getCharsetNameFromContentType(contentType);
if (charset != null) {
- exchange.setProperty(Exchange.CHARSET_NAME, charset);
+ exchange.setProperty(ExchangePropertyKey.CHARSET_NAME, charset);
}
}
}
diff --git a/components/camel-http-common/src/main/java/org/apache/camel/http/common/DefaultHttpBinding.java b/components/camel-http-common/src/main/java/org/apache/camel/http/common/DefaultHttpBinding.java
index e7f9c56..3a0bdfd 100644
--- a/components/camel-http-common/src/main/java/org/apache/camel/http/common/DefaultHttpBinding.java
+++ b/components/camel-http-common/src/main/java/org/apache/camel/http/common/DefaultHttpBinding.java
@@ -41,6 +41,7 @@ import javax.servlet.http.HttpServletResponse;
import org.apache.camel.Endpoint;
import org.apache.camel.Exchange;
+import org.apache.camel.ExchangePropertyKey;
import org.apache.camel.InvalidPayloadException;
import org.apache.camel.Message;
import org.apache.camel.RuntimeCamelException;
@@ -176,7 +177,7 @@ public class DefaultHttpBinding implements HttpBinding {
if (request.getCharacterEncoding() != null) {
headers.put(Exchange.HTTP_CHARACTER_ENCODING, request.getCharacterEncoding());
- message.getExchange().setProperty(Exchange.CHARSET_NAME, request.getCharacterEncoding());
+ message.getExchange().setProperty(ExchangePropertyKey.CHARSET_NAME, request.getCharacterEncoding());
}
try {
diff --git a/components/camel-http/src/main/java/org/apache/camel/component/http/HttpProducer.java b/components/camel-http/src/main/java/org/apache/camel/component/http/HttpProducer.java
index 048f8a5..20d794f 100644
--- a/components/camel-http/src/main/java/org/apache/camel/component/http/HttpProducer.java
+++ b/components/camel-http/src/main/java/org/apache/camel/component/http/HttpProducer.java
@@ -36,6 +36,7 @@ import java.util.Map.Entry;
import org.apache.camel.CamelExchangeException;
import org.apache.camel.Exchange;
+import org.apache.camel.ExchangePropertyKey;
import org.apache.camel.ExtendedExchange;
import org.apache.camel.Message;
import org.apache.camel.TypeConverter;
@@ -359,7 +360,7 @@ public class HttpProducer extends DefaultProducer {
}
if (!found && name.equalsIgnoreCase("content-type")) {
name = Exchange.CONTENT_TYPE;
- exchange.setProperty(Exchange.CHARSET_NAME, IOHelper.getCharsetNameFromContentType(value));
+ exchange.setProperty(ExchangePropertyKey.CHARSET_NAME, IOHelper.getCharsetNameFromContentType(value));
found = true;
}
// use http helper to extract parameter value as it may contain multiple values
diff --git a/components/camel-hystrix/src/main/java/org/apache/camel/component/hystrix/processor/HystrixProcessor.java b/components/camel-hystrix/src/main/java/org/apache/camel/component/hystrix/processor/HystrixProcessor.java
index 4004b78..686c37c 100644
--- a/components/camel-hystrix/src/main/java/org/apache/camel/component/hystrix/processor/HystrixProcessor.java
+++ b/components/camel-hystrix/src/main/java/org/apache/camel/component/hystrix/processor/HystrixProcessor.java
@@ -26,6 +26,7 @@ import com.netflix.hystrix.HystrixCommandKey;
import com.netflix.hystrix.HystrixCommandMetrics;
import org.apache.camel.AsyncCallback;
import org.apache.camel.Exchange;
+import org.apache.camel.ExchangePropertyKey;
import org.apache.camel.Navigate;
import org.apache.camel.Processor;
import org.apache.camel.api.management.ManagedAttribute;
@@ -187,7 +188,7 @@ public class HystrixProcessor extends AsyncProcessorSupport
@Override
public boolean process(Exchange exchange, AsyncCallback callback) {
// run this as if we run inside try .. catch so there is no regular Camel error handler
- exchange.setProperty(Exchange.TRY_ROUTE_BLOCK, true);
+ exchange.setProperty(ExchangePropertyKey.TRY_ROUTE_BLOCK, true);
try {
HystrixProcessorCommandFallbackViaNetwork fallbackCommand = null;
@@ -205,7 +206,7 @@ public class HystrixProcessor extends AsyncProcessorSupport
exchange.setException(e);
}
- exchange.removeProperty(Exchange.TRY_ROUTE_BLOCK);
+ exchange.removeProperty(ExchangePropertyKey.TRY_ROUTE_BLOCK);
callback.done(true);
return true;
}
diff --git a/components/camel-hystrix/src/main/java/org/apache/camel/component/hystrix/processor/HystrixProcessorCommand.java b/components/camel-hystrix/src/main/java/org/apache/camel/component/hystrix/processor/HystrixProcessorCommand.java
index 1e13dec..0a1d04e 100644
--- a/components/camel-hystrix/src/main/java/org/apache/camel/component/hystrix/processor/HystrixProcessorCommand.java
+++ b/components/camel-hystrix/src/main/java/org/apache/camel/component/hystrix/processor/HystrixProcessorCommand.java
@@ -22,6 +22,7 @@ import com.netflix.hystrix.HystrixCommand;
import com.netflix.hystrix.exception.HystrixBadRequestException;
import org.apache.camel.CamelExchangeException;
import org.apache.camel.Exchange;
+import org.apache.camel.ExchangePropertyKey;
import org.apache.camel.ExtendedExchange;
import org.apache.camel.Message;
import org.apache.camel.Processor;
@@ -80,12 +81,12 @@ public class HystrixProcessorCommand extends HystrixCommand {
LOG.debug("Error occurred processing. Will now run fallback.");
}
// store the last to endpoint as the failure endpoint
- if (exchange.getProperty(Exchange.FAILURE_ENDPOINT) == null) {
- exchange.setProperty(Exchange.FAILURE_ENDPOINT, exchange.getProperty(Exchange.TO_ENDPOINT));
+ if (exchange.getProperty(ExchangePropertyKey.FAILURE_ENDPOINT) == null) {
+ exchange.setProperty(ExchangePropertyKey.FAILURE_ENDPOINT, exchange.getProperty(ExchangePropertyKey.TO_ENDPOINT));
}
// give the rest of the pipeline another chance
- exchange.setProperty(Exchange.EXCEPTION_HANDLED, true);
- exchange.setProperty(Exchange.EXCEPTION_CAUGHT, exception);
+ exchange.setProperty(ExchangePropertyKey.EXCEPTION_HANDLED, true);
+ exchange.setProperty(ExchangePropertyKey.EXCEPTION_CAUGHT, exception);
exchange.setRouteStop(false);
exchange.setException(null);
// and we should not be regarded as exhausted as we are in a try .. catch block
diff --git a/components/camel-ironmq/src/main/java/org/apache/camel/component/ironmq/IronMQConsumer.java b/components/camel-ironmq/src/main/java/org/apache/camel/component/ironmq/IronMQConsumer.java
index 30d45e2..adb2b39 100644
--- a/components/camel-ironmq/src/main/java/org/apache/camel/component/ironmq/IronMQConsumer.java
+++ b/components/camel-ironmq/src/main/java/org/apache/camel/component/ironmq/IronMQConsumer.java
@@ -24,6 +24,7 @@ import io.iron.ironmq.Message;
import io.iron.ironmq.Messages;
import org.apache.camel.Endpoint;
import org.apache.camel.Exchange;
+import org.apache.camel.ExchangePropertyKey;
import org.apache.camel.ExtendedExchange;
import org.apache.camel.Processor;
import org.apache.camel.spi.Synchronization;
@@ -98,9 +99,9 @@ public class IronMQConsumer extends ScheduledBatchPollingConsumer {
// only loop if we are started (allowed to run)
final Exchange exchange = ObjectHelper.cast(Exchange.class, exchanges.poll());
// add current index and total as properties
- exchange.setProperty(Exchange.BATCH_INDEX, index);
- exchange.setProperty(Exchange.BATCH_SIZE, total);
- exchange.setProperty(Exchange.BATCH_COMPLETE, index == total - 1);
+ exchange.setProperty(ExchangePropertyKey.BATCH_INDEX, index);
+ exchange.setProperty(ExchangePropertyKey.BATCH_SIZE, total);
+ exchange.setProperty(ExchangePropertyKey.BATCH_COMPLETE, index == total - 1);
// update pending number of exchanges
pendingExchanges = total - index - 1;
diff --git a/components/camel-jaxb/src/main/java/org/apache/camel/converter/jaxb/FallbackTypeConverter.java b/components/camel-jaxb/src/main/java/org/apache/camel/converter/jaxb/FallbackTypeConverter.java
index 272a53a..6cba113 100644
--- a/components/camel-jaxb/src/main/java/org/apache/camel/converter/jaxb/FallbackTypeConverter.java
+++ b/components/camel-jaxb/src/main/java/org/apache/camel/converter/jaxb/FallbackTypeConverter.java
@@ -43,6 +43,7 @@ import javax.xml.transform.Source;
import org.apache.camel.Converter;
import org.apache.camel.Exchange;
+import org.apache.camel.ExchangePropertyKey;
import org.apache.camel.FallbackConverter;
import org.apache.camel.StreamCache;
import org.apache.camel.TypeConversionException;
@@ -239,7 +240,7 @@ public class FallbackTypeConverter {
if (prettyPrint) {
marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE);
}
- String charset = exchange != null ? exchange.getProperty(Exchange.CHARSET_NAME, String.class) : null;
+ String charset = exchange != null ? exchange.getProperty(ExchangePropertyKey.CHARSET_NAME, String.class) : null;
if (charset != null) {
marshaller.setProperty(Marshaller.JAXB_ENCODING, charset);
}
diff --git a/components/camel-jaxb/src/main/java/org/apache/camel/converter/jaxb/JaxbDataFormat.java b/components/camel-jaxb/src/main/java/org/apache/camel/converter/jaxb/JaxbDataFormat.java
index 6f063e1..0c6565d 100644
--- a/components/camel-jaxb/src/main/java/org/apache/camel/converter/jaxb/JaxbDataFormat.java
+++ b/components/camel-jaxb/src/main/java/org/apache/camel/converter/jaxb/JaxbDataFormat.java
@@ -48,6 +48,7 @@ import javax.xml.transform.stream.StreamSource;
import javax.xml.validation.Schema;
import javax.xml.validation.SchemaFactory;
+import org.apache.camel.ExchangePropertyKey;
import org.xml.sax.SAXException;
import org.apache.camel.CamelContext;
@@ -134,12 +135,12 @@ public class JaxbDataFormat extends ServiceSupport
marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE);
}
// exchange take precedence over encoding option
- String charset = exchange.getProperty(Exchange.CHARSET_NAME, String.class);
+ String charset = exchange.getProperty(ExchangePropertyKey.CHARSET_NAME, String.class);
if (charset == null) {
charset = encoding;
//Propagate the encoding of the exchange
if (charset != null) {
- exchange.setProperty(Exchange.CHARSET_NAME, charset);
+ exchange.setProperty(ExchangePropertyKey.CHARSET_NAME, charset);
}
}
if (charset != null) {
diff --git a/components/camel-jclouds/src/main/java/org/apache/camel/component/jclouds/JcloudsBlobStoreConsumer.java b/components/camel-jclouds/src/main/java/org/apache/camel/component/jclouds/JcloudsBlobStoreConsumer.java
index 7812704..674ce78 100644
--- a/components/camel-jclouds/src/main/java/org/apache/camel/component/jclouds/JcloudsBlobStoreConsumer.java
+++ b/components/camel-jclouds/src/main/java/org/apache/camel/component/jclouds/JcloudsBlobStoreConsumer.java
@@ -22,6 +22,7 @@ import java.util.Queue;
import com.google.common.base.Strings;
import org.apache.camel.Exchange;
+import org.apache.camel.ExchangePropertyKey;
import org.apache.camel.Processor;
import org.apache.camel.converter.stream.CachedOutputStream;
import org.apache.camel.support.ScheduledBatchPollingConsumer;
@@ -96,9 +97,9 @@ public class JcloudsBlobStoreConsumer extends ScheduledBatchPollingConsumer {
// only loop if we are started (allowed to run)
Exchange exchange = ObjectHelper.cast(Exchange.class, exchanges.poll());
// add current index and total as properties
- exchange.setProperty(Exchange.BATCH_INDEX, index);
- exchange.setProperty(Exchange.BATCH_SIZE, total);
- exchange.setProperty(Exchange.BATCH_COMPLETE, index == total - 1);
+ exchange.setProperty(ExchangePropertyKey.BATCH_INDEX, index);
+ exchange.setProperty(ExchangePropertyKey.BATCH_SIZE, total);
+ exchange.setProperty(ExchangePropertyKey.BATCH_COMPLETE, index == total - 1);
// update pending number of exchanges
pendingExchanges = total - index - 1;
diff --git a/components/camel-jpa/src/main/java/org/apache/camel/component/jpa/JpaConsumer.java b/components/camel-jpa/src/main/java/org/apache/camel/component/jpa/JpaConsumer.java
index cf99d19..3197383 100644
--- a/components/camel-jpa/src/main/java/org/apache/camel/component/jpa/JpaConsumer.java
+++ b/components/camel-jpa/src/main/java/org/apache/camel/component/jpa/JpaConsumer.java
@@ -34,6 +34,7 @@ import javax.persistence.PessimisticLockException;
import javax.persistence.Query;
import org.apache.camel.Exchange;
+import org.apache.camel.ExchangePropertyKey;
import org.apache.camel.Processor;
import org.apache.camel.support.ObjectHelper;
import org.apache.camel.support.ScheduledBatchPollingConsumer;
@@ -188,9 +189,9 @@ public class JpaConsumer extends ScheduledBatchPollingConsumer {
Object result = holder.result;
// add current index and total as properties
- exchange.setProperty(Exchange.BATCH_INDEX, index);
- exchange.setProperty(Exchange.BATCH_SIZE, total);
- exchange.setProperty(Exchange.BATCH_COMPLETE, index == total - 1);
+ exchange.setProperty(ExchangePropertyKey.BATCH_INDEX, index);
+ exchange.setProperty(ExchangePropertyKey.BATCH_SIZE, total);
+ exchange.setProperty(ExchangePropertyKey.BATCH_COMPLETE, index == total - 1);
// update pending number of exchanges
pendingExchanges = total - index - 1;
diff --git a/components/camel-leveldb-legacy/src/main/java/org/apache/camel/component/leveldb/LevelDBCamelCodec.java b/components/camel-leveldb-legacy/src/main/java/org/apache/camel/component/leveldb/LevelDBCamelCodec.java
index 6da1445..d967c58 100644
--- a/components/camel-leveldb-legacy/src/main/java/org/apache/camel/component/leveldb/LevelDBCamelCodec.java
+++ b/components/camel-leveldb-legacy/src/main/java/org/apache/camel/component/leveldb/LevelDBCamelCodec.java
@@ -21,6 +21,7 @@ import java.io.IOException;
import org.apache.camel.CamelContext;
import org.apache.camel.Endpoint;
import org.apache.camel.Exchange;
+import org.apache.camel.ExchangePropertyKey;
import org.apache.camel.ExtendedExchange;
import org.apache.camel.support.DefaultExchange;
import org.apache.camel.support.DefaultExchangeHolder;
@@ -55,15 +56,15 @@ public final class LevelDBCamelCodec {
DefaultExchangeHolder pe = DefaultExchangeHolder.marshal(exchange, false, allowSerializedHeaders);
// add the aggregated size and timeout property as the only properties we want to retain
DefaultExchangeHolder.addProperty(pe, Exchange.AGGREGATED_SIZE,
- exchange.getProperty(Exchange.AGGREGATED_SIZE, Integer.class));
+ exchange.getProperty(ExchangePropertyKey.AGGREGATED_SIZE, Integer.class));
DefaultExchangeHolder.addProperty(pe, Exchange.AGGREGATED_TIMEOUT,
- exchange.getProperty(Exchange.AGGREGATED_TIMEOUT, Long.class));
+ exchange.getProperty(ExchangePropertyKey.AGGREGATED_TIMEOUT, Long.class));
// add the aggregated completed by property to retain
DefaultExchangeHolder.addProperty(pe, Exchange.AGGREGATED_COMPLETED_BY,
- exchange.getProperty(Exchange.AGGREGATED_COMPLETED_BY, String.class));
+ exchange.getProperty(ExchangePropertyKey.AGGREGATED_COMPLETED_BY, String.class));
// add the aggregated correlation key property to retain
DefaultExchangeHolder.addProperty(pe, Exchange.AGGREGATED_CORRELATION_KEY,
- exchange.getProperty(Exchange.AGGREGATED_CORRELATION_KEY, String.class));
+ exchange.getProperty(ExchangePropertyKey.AGGREGATED_CORRELATION_KEY, String.class));
// and a guard property if using the flexible toolbox aggregator
DefaultExchangeHolder.addProperty(pe, Exchange.AGGREGATED_COLLECTION_GUARD,
exchange.getProperty(Exchange.AGGREGATED_COLLECTION_GUARD, String.class));
diff --git a/components/camel-leveldb/src/main/java/org/apache/camel/component/leveldb/serializer/AbstractLevelDBSerializer.java b/components/camel-leveldb/src/main/java/org/apache/camel/component/leveldb/serializer/AbstractLevelDBSerializer.java
index ae7ed4f..89f203c 100644
--- a/components/camel-leveldb/src/main/java/org/apache/camel/component/leveldb/serializer/AbstractLevelDBSerializer.java
+++ b/components/camel-leveldb/src/main/java/org/apache/camel/component/leveldb/serializer/AbstractLevelDBSerializer.java
@@ -20,6 +20,7 @@ import java.io.IOException;
import org.apache.camel.CamelContext;
import org.apache.camel.Exchange;
+import org.apache.camel.ExchangePropertyKey;
import org.apache.camel.component.leveldb.LevelDBSerializer;
import org.apache.camel.support.DefaultExchange;
import org.apache.camel.support.DefaultExchangeHolder;
@@ -47,15 +48,15 @@ public abstract class AbstractLevelDBSerializer implements LevelDBSerializer {
DefaultExchangeHolder pe = DefaultExchangeHolder.marshal(exchange, false, allowSerializedHeaders);
// add the aggregated size and timeout property as the only properties we want to retain
DefaultExchangeHolder.addProperty(pe, Exchange.AGGREGATED_SIZE,
- exchange.getProperty(Exchange.AGGREGATED_SIZE, Integer.class));
+ exchange.getProperty(ExchangePropertyKey.AGGREGATED_SIZE, Integer.class));
DefaultExchangeHolder.addProperty(pe, Exchange.AGGREGATED_TIMEOUT,
- exchange.getProperty(Exchange.AGGREGATED_TIMEOUT, Long.class));
+ exchange.getProperty(ExchangePropertyKey.AGGREGATED_TIMEOUT, Long.class));
// add the aggregated completed by property to retain
DefaultExchangeHolder.addProperty(pe, Exchange.AGGREGATED_COMPLETED_BY,
- exchange.getProperty(Exchange.AGGREGATED_COMPLETED_BY, String.class));
+ exchange.getProperty(ExchangePropertyKey.AGGREGATED_COMPLETED_BY, String.class));
// add the aggregated correlation key property to retain
DefaultExchangeHolder.addProperty(pe, Exchange.AGGREGATED_CORRELATION_KEY,
- exchange.getProperty(Exchange.AGGREGATED_CORRELATION_KEY, String.class));
+ exchange.getProperty(ExchangePropertyKey.AGGREGATED_CORRELATION_KEY, String.class));
// and a guard property if using the flexible toolbox aggregator
DefaultExchangeHolder.addProperty(pe, Exchange.AGGREGATED_COLLECTION_GUARD,
exchange.getProperty(Exchange.AGGREGATED_COLLECTION_GUARD, String.class));
diff --git a/components/camel-mail/src/main/java/org/apache/camel/component/mail/MailConsumer.java b/components/camel-mail/src/main/java/org/apache/camel/component/mail/MailConsumer.java
index 6fe7825..74fdc8d 100644
--- a/components/camel-mail/src/main/java/org/apache/camel/component/mail/MailConsumer.java
+++ b/components/camel-mail/src/main/java/org/apache/camel/component/mail/MailConsumer.java
@@ -37,6 +37,7 @@ import com.sun.mail.imap.IMAPFolder;
import com.sun.mail.imap.IMAPStore;
import com.sun.mail.imap.SortTerm;
import org.apache.camel.Exchange;
+import org.apache.camel.ExchangePropertyKey;
import org.apache.camel.ExtendedCamelContext;
import org.apache.camel.ExtendedExchange;
import org.apache.camel.Processor;
@@ -215,9 +216,9 @@ public class MailConsumer extends ScheduledBatchPollingConsumer {
// only loop if we are started (allowed to run)
Exchange exchange = ObjectHelper.cast(Exchange.class, exchanges.poll());
// add current index and total as properties
- exchange.setProperty(Exchange.BATCH_INDEX, index);
- exchange.setProperty(Exchange.BATCH_SIZE, total);
- exchange.setProperty(Exchange.BATCH_COMPLETE, index == total - 1);
+ exchange.setProperty(ExchangePropertyKey.BATCH_INDEX, index);
+ exchange.setProperty(ExchangePropertyKey.BATCH_SIZE, total);
+ exchange.setProperty(ExchangePropertyKey.BATCH_COMPLETE, index == total - 1);
// update pending number of exchanges
pendingExchanges = total - index - 1;
diff --git a/components/camel-microprofile-fault-tolerance/src/main/java/org/apache/camel/component/microprofile/faulttolerance/FaultToleranceProcessor.java b/components/camel-microprofile-fault-tolerance/src/main/java/org/apache/camel/component/microprofile/faulttolerance/FaultToleranceProcessor.java
index e8eb374..0da5c05 100644
--- a/components/camel-microprofile-fault-tolerance/src/main/java/org/apache/camel/component/microprofile/faulttolerance/FaultToleranceProcessor.java
+++ b/components/camel-microprofile-fault-tolerance/src/main/java/org/apache/camel/component/microprofile/faulttolerance/FaultToleranceProcessor.java
@@ -36,6 +36,7 @@ import org.apache.camel.AsyncCallback;
import org.apache.camel.CamelContext;
import org.apache.camel.CamelContextAware;
import org.apache.camel.Exchange;
+import org.apache.camel.ExchangePropertyKey;
import org.apache.camel.ExtendedExchange;
import org.apache.camel.Navigate;
import org.apache.camel.Processor;
@@ -203,7 +204,7 @@ public class FaultToleranceProcessor extends AsyncProcessorSupport
public boolean process(Exchange exchange, AsyncCallback callback) {
// run this as if we run inside try .. catch so there is no regular
// Camel error handler
- exchange.setProperty(Exchange.TRY_ROUTE_BLOCK, true);
+ exchange.setProperty(ExchangePropertyKey.TRY_ROUTE_BLOCK, true);
Callable<Exchange> task = new CircuitBreakerTask(processor, exchange);
@@ -243,7 +244,7 @@ public class FaultToleranceProcessor extends AsyncProcessorSupport
exchange.setException(e);
}
- exchange.removeProperty(Exchange.TRY_ROUTE_BLOCK);
+ exchange.removeProperty(ExchangePropertyKey.TRY_ROUTE_BLOCK);
callback.done(true);
return true;
}
@@ -370,12 +371,12 @@ public class FaultToleranceProcessor extends AsyncProcessorSupport
exchange.setProperty(CircuitBreakerConstants.RESPONSE_SHORT_CIRCUITED, true);
// store the last to endpoint as the failure endpoint
- if (exchange.getProperty(Exchange.FAILURE_ENDPOINT) == null) {
- exchange.setProperty(Exchange.FAILURE_ENDPOINT, exchange.getProperty(Exchange.TO_ENDPOINT));
+ if (exchange.getProperty(ExchangePropertyKey.FAILURE_ENDPOINT) == null) {
+ exchange.setProperty(ExchangePropertyKey.FAILURE_ENDPOINT, exchange.getProperty(ExchangePropertyKey.TO_ENDPOINT));
}
// give the rest of the pipeline another chance
- exchange.setProperty(Exchange.EXCEPTION_HANDLED, true);
- exchange.setProperty(Exchange.EXCEPTION_CAUGHT, exchange.getException());
+ exchange.setProperty(ExchangePropertyKey.EXCEPTION_HANDLED, true);
+ exchange.setProperty(ExchangePropertyKey.EXCEPTION_CAUGHT, exchange.getException());
exchange.setRouteStop(false);
exchange.setException(null);
// and we should not be regarded as exhausted as we are in a try ..
diff --git a/components/camel-mina/src/main/java/org/apache/camel/component/mina/MinaConsumer.java b/components/camel-mina/src/main/java/org/apache/camel/component/mina/MinaConsumer.java
index 76917e3..12a9686 100644
--- a/components/camel-mina/src/main/java/org/apache/camel/component/mina/MinaConsumer.java
+++ b/components/camel-mina/src/main/java/org/apache/camel/component/mina/MinaConsumer.java
@@ -26,6 +26,7 @@ import java.util.concurrent.ExecutorService;
import org.apache.camel.CamelException;
import org.apache.camel.Exchange;
import org.apache.camel.ExchangePattern;
+import org.apache.camel.ExchangePropertyKey;
import org.apache.camel.Processor;
import org.apache.camel.support.DefaultConsumer;
import org.apache.camel.support.ExchangeHelper;
@@ -424,7 +425,7 @@ public class MinaConsumer extends DefaultConsumer {
Exchange exchange = createExchange(session, object);
//Set the exchange charset property for converting
if (getEndpoint().getConfiguration().getCharsetName() != null) {
- exchange.setProperty(Exchange.CHARSET_NAME,
+ exchange.setProperty(ExchangePropertyKey.CHARSET_NAME,
IOHelper.normalizeCharset(getEndpoint().getConfiguration().getCharsetName()));
}
diff --git a/components/camel-mina/src/main/java/org/apache/camel/component/mina/MinaProducer.java b/components/camel-mina/src/main/java/org/apache/camel/component/mina/MinaProducer.java
index 1c796b2..f03e2df 100644
--- a/components/camel-mina/src/main/java/org/apache/camel/component/mina/MinaProducer.java
+++ b/components/camel-mina/src/main/java/org/apache/camel/component/mina/MinaProducer.java
@@ -27,6 +27,7 @@ import java.util.concurrent.TimeUnit;
import org.apache.camel.CamelExchangeException;
import org.apache.camel.Exchange;
+import org.apache.camel.ExchangePropertyKey;
import org.apache.camel.ExchangeTimedOutException;
import org.apache.camel.spi.CamelLogger;
import org.apache.camel.support.DefaultProducer;
@@ -131,7 +132,7 @@ public class MinaProducer extends DefaultProducer {
// set the exchange encoding property
if (getEndpoint().getConfiguration().getCharsetName() != null) {
- exchange.setProperty(Exchange.CHARSET_NAME,
+ exchange.setProperty(ExchangePropertyKey.CHARSET_NAME,
IOHelper.normalizeCharset(getEndpoint().getConfiguration().getCharsetName()));
}
diff --git a/components/camel-minio/src/main/java/org/apache/camel/component/minio/MinioConsumer.java b/components/camel-minio/src/main/java/org/apache/camel/component/minio/MinioConsumer.java
index b3cc1c8..2575058 100644
--- a/components/camel-minio/src/main/java/org/apache/camel/component/minio/MinioConsumer.java
+++ b/components/camel-minio/src/main/java/org/apache/camel/component/minio/MinioConsumer.java
@@ -38,6 +38,7 @@ import io.minio.Result;
import io.minio.errors.MinioException;
import io.minio.messages.Item;
import org.apache.camel.Exchange;
+import org.apache.camel.ExchangePropertyKey;
import org.apache.camel.ExtendedExchange;
import org.apache.camel.Message;
import org.apache.camel.Processor;
@@ -266,9 +267,9 @@ public class MinioConsumer extends ScheduledBatchPollingConsumer {
// only loop if we are started (allowed to run)
final Exchange exchange = cast(Exchange.class, exchanges.poll());
// add current index and total as properties
- exchange.setProperty(Exchange.BATCH_INDEX, index);
- exchange.setProperty(Exchange.BATCH_SIZE, total);
- exchange.setProperty(Exchange.BATCH_COMPLETE, index == total - 1);
+ exchange.setProperty(ExchangePropertyKey.BATCH_INDEX, index);
+ exchange.setProperty(ExchangePropertyKey.BATCH_SIZE, total);
+ exchange.setProperty(ExchangePropertyKey.BATCH_COMPLETE, index == total - 1);
// update pending number of exchanges
pendingExchanges = total - index - 1;
diff --git a/components/camel-mllp/src/main/java/org/apache/camel/component/mllp/MllpEndpoint.java b/components/camel-mllp/src/main/java/org/apache/camel/component/mllp/MllpEndpoint.java
index 35719f0..ed6477b 100644
--- a/components/camel-mllp/src/main/java/org/apache/camel/component/mllp/MllpEndpoint.java
+++ b/components/camel-mllp/src/main/java/org/apache/camel/component/mllp/MllpEndpoint.java
@@ -26,6 +26,7 @@ import org.apache.camel.Category;
import org.apache.camel.Consumer;
import org.apache.camel.Exchange;
import org.apache.camel.ExchangePattern;
+import org.apache.camel.ExchangePropertyKey;
import org.apache.camel.Processor;
import org.apache.camel.Producer;
import org.apache.camel.api.management.ManagedAttribute;
@@ -111,7 +112,7 @@ public class MllpEndpoint extends DefaultEndpoint {
void setExchangeProperties(Exchange mllpExchange) {
if (configuration.hasCharsetName()) {
- mllpExchange.setProperty(Exchange.CHARSET_NAME, configuration.getCharsetName());
+ mllpExchange.setProperty(ExchangePropertyKey.CHARSET_NAME, configuration.getCharsetName());
}
}
diff --git a/components/camel-mllp/src/main/java/org/apache/camel/component/mllp/MllpTcpClientProducer.java b/components/camel-mllp/src/main/java/org/apache/camel/component/mllp/MllpTcpClientProducer.java
index 160ee6a..e2fc479 100644
--- a/components/camel-mllp/src/main/java/org/apache/camel/component/mllp/MllpTcpClientProducer.java
+++ b/components/camel-mllp/src/main/java/org/apache/camel/component/mllp/MllpTcpClientProducer.java
@@ -30,6 +30,7 @@ import java.util.concurrent.TimeUnit;
import org.apache.camel.Exchange;
import org.apache.camel.ExchangePattern;
+import org.apache.camel.ExchangePropertyKey;
import org.apache.camel.Message;
import org.apache.camel.api.management.ManagedAttribute;
import org.apache.camel.api.management.ManagedOperation;
@@ -160,7 +161,7 @@ public class MllpTcpClientProducer extends DefaultProducer implements Runnable {
String stringBody = (String) messageBody;
hl7MessageBytes = stringBody.getBytes(getConfiguration().getCharset(exchange));
if (getConfiguration().hasCharsetName()) {
- exchange.setProperty(Exchange.CHARSET_NAME, getConfiguration().getCharsetName());
+ exchange.setProperty(ExchangePropertyKey.CHARSET_NAME, getConfiguration().getCharsetName());
}
}
diff --git a/components/camel-mllp/src/main/java/org/apache/camel/component/mllp/MllpTcpServerConsumer.java b/components/camel-mllp/src/main/java/org/apache/camel/component/mllp/MllpTcpServerConsumer.java
index 2ca75bb..21a7bdf 100644
--- a/components/camel-mllp/src/main/java/org/apache/camel/component/mllp/MllpTcpServerConsumer.java
+++ b/components/camel-mllp/src/main/java/org/apache/camel/component/mllp/MllpTcpServerConsumer.java
@@ -37,6 +37,7 @@ import java.util.regex.Pattern;
import org.apache.camel.Exchange;
import org.apache.camel.ExchangePattern;
+import org.apache.camel.ExchangePropertyKey;
import org.apache.camel.Message;
import org.apache.camel.Processor;
import org.apache.camel.api.management.ManagedAttribute;
@@ -231,7 +232,7 @@ public class MllpTcpServerConsumer extends DefaultConsumer {
Exchange exchange = createExchange(false);
exchange.setPattern(ExchangePattern.InOut);
if (getConfiguration().hasCharsetName()) {
- exchange.setProperty(Exchange.CHARSET_NAME, getConfiguration().getCharsetName());
+ exchange.setProperty(ExchangePropertyKey.CHARSET_NAME, getConfiguration().getCharsetName());
}
try {
createUoW(exchange);
diff --git a/components/camel-mybatis/src/main/java/org/apache/camel/component/mybatis/MyBatisConsumer.java b/components/camel-mybatis/src/main/java/org/apache/camel/component/mybatis/MyBatisConsumer.java
index bfc721d..da162db 100644
--- a/components/camel-mybatis/src/main/java/org/apache/camel/component/mybatis/MyBatisConsumer.java
+++ b/components/camel-mybatis/src/main/java/org/apache/camel/component/mybatis/MyBatisConsumer.java
@@ -22,6 +22,7 @@ import java.util.Queue;
import org.apache.camel.Exchange;
import org.apache.camel.ExchangePattern;
+import org.apache.camel.ExchangePropertyKey;
import org.apache.camel.Message;
import org.apache.camel.Processor;
import org.apache.camel.RollbackExchangeException;
@@ -121,9 +122,9 @@ public class MyBatisConsumer extends ScheduledBatchPollingConsumer {
Object data = holder.data;
// add current index and total as properties
- exchange.setProperty(Exchange.BATCH_INDEX, index);
- exchange.setProperty(Exchange.BATCH_SIZE, total);
- exchange.setProperty(Exchange.BATCH_COMPLETE, index == total - 1);
+ exchange.setProperty(ExchangePropertyKey.BATCH_INDEX, index);
+ exchange.setProperty(ExchangePropertyKey.BATCH_SIZE, total);
+ exchange.setProperty(ExchangePropertyKey.BATCH_COMPLETE, index == total - 1);
// update pending number of exchanges
pendingExchanges = total - index - 1;
diff --git a/components/camel-netty-http/src/main/java/org/apache/camel/component/netty/http/NettyHttpConverter.java b/components/camel-netty-http/src/main/java/org/apache/camel/component/netty/http/NettyHttpConverter.java
index 14f499e..4ee919f 100644
--- a/components/camel-netty-http/src/main/java/org/apache/camel/component/netty/http/NettyHttpConverter.java
+++ b/components/camel-netty-http/src/main/java/org/apache/camel/component/netty/http/NettyHttpConverter.java
@@ -27,6 +27,7 @@ import io.netty.handler.codec.http.HttpRequest;
import io.netty.handler.codec.http.HttpResponse;
import org.apache.camel.Converter;
import org.apache.camel.Exchange;
+import org.apache.camel.ExchangePropertyKey;
import org.apache.camel.component.netty.NettyConverter;
import org.apache.camel.spi.TypeConverterRegistry;
@@ -96,7 +97,7 @@ public final class NettyHttpConverter {
String contentType = response.headers().get(Exchange.CONTENT_TYPE);
String charset = NettyHttpHelper.getCharsetFromContentType(contentType);
if (charset == null && exchange != null) {
- charset = exchange.getProperty(Exchange.CHARSET_NAME, String.class);
+ charset = exchange.getProperty(ExchangePropertyKey.CHARSET_NAME, String.class);
}
if (charset != null) {
return response.content().toString(Charset.forName(charset));
diff --git a/components/camel-netty-http/src/main/java/org/apache/camel/component/netty/http/NettyHttpHelper.java b/components/camel-netty-http/src/main/java/org/apache/camel/component/netty/http/NettyHttpHelper.java
index 7a82272..7889208 100644
--- a/components/camel-netty-http/src/main/java/org/apache/camel/component/netty/http/NettyHttpHelper.java
+++ b/components/camel-netty-http/src/main/java/org/apache/camel/component/netty/http/NettyHttpHelper.java
@@ -28,6 +28,7 @@ import java.util.Map;
import io.netty.handler.codec.http.FullHttpResponse;
import io.netty.handler.codec.http.HttpMethod;
import org.apache.camel.Exchange;
+import org.apache.camel.ExchangePropertyKey;
import org.apache.camel.Message;
import org.apache.camel.RuntimeExchangeException;
import org.apache.camel.util.IOHelper;
@@ -47,7 +48,7 @@ public final class NettyHttpHelper {
public static void setCharsetFromContentType(String contentType, Exchange exchange) {
String charset = getCharsetFromContentType(contentType);
if (charset != null) {
- exchange.setProperty(Exchange.CHARSET_NAME, IOHelper.normalizeCharset(charset));
+ exchange.setProperty(ExchangePropertyKey.CHARSET_NAME, IOHelper.normalizeCharset(charset));
}
}
diff --git a/components/camel-netty-http/src/main/java/org/apache/camel/component/netty/http/handlers/HttpServerChannelHandler.java b/components/camel-netty-http/src/main/java/org/apache/camel/component/netty/http/handlers/HttpServerChannelHandler.java
index d6873a6..bd4bdf3 100644
--- a/components/camel-netty-http/src/main/java/org/apache/camel/component/netty/http/handlers/HttpServerChannelHandler.java
+++ b/components/camel-netty-http/src/main/java/org/apache/camel/component/netty/http/handlers/HttpServerChannelHandler.java
@@ -36,6 +36,7 @@ import io.netty.handler.codec.http.HttpRequest;
import io.netty.handler.codec.http.HttpResponse;
import io.netty.handler.codec.http.HttpUtil;
import org.apache.camel.Exchange;
+import org.apache.camel.ExchangePropertyKey;
import org.apache.camel.LoggingLevel;
import org.apache.camel.Message;
import org.apache.camel.component.netty.NettyConverter;
@@ -364,7 +365,7 @@ public class HttpServerChannelHandler extends ServerChannelHandler {
String contentType = in.getHeader(Exchange.CONTENT_TYPE, String.class);
String charset = NettyHttpHelper.getCharsetFromContentType(contentType);
if (charset != null) {
- exchange.setProperty(Exchange.CHARSET_NAME, charset);
+ exchange.setProperty(ExchangePropertyKey.CHARSET_NAME, charset);
in.setHeader(Exchange.HTTP_CHARACTER_ENCODING, charset);
}
diff --git a/components/camel-netty/src/main/java/org/apache/camel/component/netty/NettyProducer.java b/components/camel-netty/src/main/java/org/apache/camel/component/netty/NettyProducer.java
index bc26017..bf9c10e 100644
--- a/components/camel-netty/src/main/java/org/apache/camel/component/netty/NettyProducer.java
+++ b/components/camel-netty/src/main/java/org/apache/camel/component/netty/NettyProducer.java
@@ -45,6 +45,7 @@ import org.apache.camel.CamelContext;
import org.apache.camel.CamelContextAware;
import org.apache.camel.CamelExchangeException;
import org.apache.camel.Exchange;
+import org.apache.camel.ExchangePropertyKey;
import org.apache.camel.ExtendedExchange;
import org.apache.camel.spi.CamelLogger;
import org.apache.camel.support.DefaultAsyncProducer;
@@ -227,7 +228,7 @@ public class NettyProducer extends DefaultAsyncProducer {
// set the exchange encoding property
if (getConfiguration().getCharsetName() != null) {
- exchange.setProperty(Exchange.CHARSET_NAME, IOHelper.normalizeCharset(getConfiguration().getCharsetName()));
+ exchange.setProperty(ExchangePropertyKey.CHARSET_NAME, IOHelper.normalizeCharset(getConfiguration().getCharsetName()));
}
if (LOG.isTraceEnabled()) {
diff --git a/components/camel-netty/src/main/java/org/apache/camel/component/netty/handlers/ServerChannelHandler.java b/components/camel-netty/src/main/java/org/apache/camel/component/netty/handlers/ServerChannelHandler.java
index 3a6a796..f809b38 100644
--- a/components/camel-netty/src/main/java/org/apache/camel/component/netty/handlers/ServerChannelHandler.java
+++ b/components/camel-netty/src/main/java/org/apache/camel/component/netty/handlers/ServerChannelHandler.java
@@ -23,6 +23,7 @@ import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.SimpleChannelInboundHandler;
import org.apache.camel.Exchange;
import org.apache.camel.ExchangePattern;
+import org.apache.camel.ExchangePropertyKey;
import org.apache.camel.component.netty.NettyConstants;
import org.apache.camel.component.netty.NettyConsumer;
import org.apache.camel.component.netty.NettyHelper;
@@ -92,7 +93,7 @@ public class ServerChannelHandler extends SimpleChannelInboundHandler<Object> {
}
// set the exchange charset property for converting
if (consumer.getConfiguration().getCharsetName() != null) {
- exchange.setProperty(Exchange.CHARSET_NAME,
+ exchange.setProperty(ExchangePropertyKey.CHARSET_NAME,
IOHelper.normalizeCharset(consumer.getConfiguration().getCharsetName()));
}
if (consumer.getConfiguration().isReuseChannel()) {
diff --git a/components/camel-platform-http-vertx/src/main/java/org/apache/camel/component/platform/http/vertx/VertxPlatformHttpConsumer.java b/components/camel-platform-http-vertx/src/main/java/org/apache/camel/component/platform/http/vertx/VertxPlatformHttpConsumer.java
index cb0ad0f..e2264e7 100644
--- a/components/camel-platform-http-vertx/src/main/java/org/apache/camel/component/platform/http/vertx/VertxPlatformHttpConsumer.java
+++ b/components/camel-platform-http-vertx/src/main/java/org/apache/camel/component/platform/http/vertx/VertxPlatformHttpConsumer.java
@@ -36,6 +36,7 @@ import io.vertx.ext.web.Route;
import io.vertx.ext.web.RoutingContext;
import org.apache.camel.Exchange;
import org.apache.camel.ExchangePattern;
+import org.apache.camel.ExchangePropertyKey;
import org.apache.camel.Message;
import org.apache.camel.Processor;
import org.apache.camel.attachment.AttachmentMessage;
@@ -221,7 +222,7 @@ public class VertxPlatformHttpConsumer extends DefaultConsumer {
final Message in = toCamelMessage(ctx, exchange);
final String charset = ctx.parsedHeaders().contentType().parameter("charset");
if (charset != null) {
- exchange.setProperty(Exchange.CHARSET_NAME, charset);
+ exchange.setProperty(ExchangePropertyKey.CHARSET_NAME, charset);
in.setHeader(Exchange.HTTP_CHARACTER_ENCODING, charset);
}
return exchange;
diff --git a/components/camel-resilience4j/src/main/java/org/apache/camel/component/resilience4j/ResilienceProcessor.java b/components/camel-resilience4j/src/main/java/org/apache/camel/component/resilience4j/ResilienceProcessor.java
index 2d8f366..aaab074 100644
--- a/components/camel-resilience4j/src/main/java/org/apache/camel/component/resilience4j/ResilienceProcessor.java
+++ b/components/camel-resilience4j/src/main/java/org/apache/camel/component/resilience4j/ResilienceProcessor.java
@@ -37,6 +37,7 @@ import org.apache.camel.AsyncCallback;
import org.apache.camel.CamelContext;
import org.apache.camel.CamelContextAware;
import org.apache.camel.Exchange;
+import org.apache.camel.ExchangePropertyKey;
import org.apache.camel.ExtendedExchange;
import org.apache.camel.Navigate;
import org.apache.camel.Processor;
@@ -353,7 +354,7 @@ public class ResilienceProcessor extends AsyncProcessorSupport
public boolean process(Exchange exchange, AsyncCallback callback) {
// run this as if we run inside try .. catch so there is no regular
// Camel error handler
- exchange.setProperty(Exchange.TRY_ROUTE_BLOCK, true);
+ exchange.setProperty(ExchangePropertyKey.TRY_ROUTE_BLOCK, true);
Callable<Exchange> task;
@@ -481,12 +482,12 @@ public class ResilienceProcessor extends AsyncProcessorSupport
exchange.setProperty(CircuitBreakerConstants.RESPONSE_SHORT_CIRCUITED, true);
// store the last to endpoint as the failure endpoint
- if (exchange.getProperty(Exchange.FAILURE_ENDPOINT) == null) {
- exchange.setProperty(Exchange.FAILURE_ENDPOINT, exchange.getProperty(Exchange.TO_ENDPOINT));
+ if (exchange.getProperty(ExchangePropertyKey.FAILURE_ENDPOINT) == null) {
+ exchange.setProperty(ExchangePropertyKey.FAILURE_ENDPOINT, exchange.getProperty(ExchangePropertyKey.TO_ENDPOINT));
}
// give the rest of the pipeline another chance
- exchange.setProperty(Exchange.EXCEPTION_HANDLED, true);
- exchange.setProperty(Exchange.EXCEPTION_CAUGHT, exchange.getException());
+ exchange.setProperty(ExchangePropertyKey.EXCEPTION_HANDLED, true);
+ exchange.setProperty(ExchangePropertyKey.EXCEPTION_CAUGHT, exchange.getException());
exchange.setRouteStop(false);
exchange.setException(null);
// and we should not be regarded as exhausted as we are in a try ..
diff --git a/components/camel-slack/src/main/java/org/apache/camel/component/slack/SlackConsumer.java b/components/camel-slack/src/main/java/org/apache/camel/component/slack/SlackConsumer.java
index 8d97fc7..680001d 100644
--- a/components/camel-slack/src/main/java/org/apache/camel/component/slack/SlackConsumer.java
+++ b/components/camel-slack/src/main/java/org/apache/camel/component/slack/SlackConsumer.java
@@ -31,6 +31,7 @@ import com.slack.api.model.Conversation;
import com.slack.api.model.Message;
import org.apache.camel.AsyncCallback;
import org.apache.camel.Exchange;
+import org.apache.camel.ExchangePropertyKey;
import org.apache.camel.Processor;
import org.apache.camel.RuntimeCamelException;
import org.apache.camel.component.slack.helper.SlackHelper;
@@ -120,9 +121,9 @@ public class SlackConsumer extends ScheduledBatchPollingConsumer {
// only loop if we are started (allowed to run)
final Exchange exchange = ObjectHelper.cast(Exchange.class, exchanges.poll());
// add current index and total as properties
- exchange.setProperty(Exchange.BATCH_INDEX, index);
- exchange.setProperty(Exchange.BATCH_SIZE, total);
- exchange.setProperty(Exchange.BATCH_COMPLETE, index == total - 1);
+ exchange.setProperty(ExchangePropertyKey.BATCH_INDEX, index);
+ exchange.setProperty(ExchangePropertyKey.BATCH_SIZE, total);
+ exchange.setProperty(ExchangePropertyKey.BATCH_COMPLETE, index == total - 1);
// update pending number of exchanges
pendingExchanges = total - index - 1;
diff --git a/components/camel-soap/src/main/java/org/apache/camel/dataformat/soap/Soap11DataFormatAdapter.java b/components/camel-soap/src/main/java/org/apache/camel/dataformat/soap/Soap11DataFormatAdapter.java
index e11f173..164c761 100644
--- a/components/camel-soap/src/main/java/org/apache/camel/dataformat/soap/Soap11DataFormatAdapter.java
+++ b/components/camel-soap/src/main/java/org/apache/camel/dataformat/soap/Soap11DataFormatAdapter.java
@@ -33,6 +33,7 @@ import javax.xml.ws.WebFault;
import javax.xml.ws.soap.SOAPFaultException;
import org.apache.camel.Exchange;
+import org.apache.camel.ExchangePropertyKey;
import org.apache.camel.RuntimeCamelException;
import org.xmlsoap.schemas.soap.envelope.Body;
import org.xmlsoap.schemas.soap.envelope.Detail;
@@ -69,7 +70,7 @@ public class Soap11DataFormatAdapter implements SoapDataFormatAdapter {
Body body = objectFactory.createBody();
Header header = objectFactory.createHeader();
- Throwable exception = exchange.getProperty(Exchange.EXCEPTION_CAUGHT, Throwable.class);
+ Throwable exception = exchange.getProperty(ExchangePropertyKey.EXCEPTION_CAUGHT, Throwable.class);
if (exception == null) {
exception = exchange.getIn().getHeader(Exchange.EXCEPTION_CAUGHT, Throwable.class);
}
diff --git a/components/camel-soap/src/main/java/org/apache/camel/dataformat/soap/Soap12DataFormatAdapter.java b/components/camel-soap/src/main/java/org/apache/camel/dataformat/soap/Soap12DataFormatAdapter.java
index 58e7d05..417b979 100644
--- a/components/camel-soap/src/main/java/org/apache/camel/dataformat/soap/Soap12DataFormatAdapter.java
+++ b/components/camel-soap/src/main/java/org/apache/camel/dataformat/soap/Soap12DataFormatAdapter.java
@@ -33,6 +33,7 @@ import javax.xml.ws.WebFault;
import javax.xml.ws.soap.SOAPFaultException;
import org.apache.camel.Exchange;
+import org.apache.camel.ExchangePropertyKey;
import org.apache.camel.RuntimeCamelException;
import org.w3._2003._05.soap_envelope.Body;
import org.w3._2003._05.soap_envelope.Detail;
@@ -72,7 +73,7 @@ public class Soap12DataFormatAdapter implements SoapDataFormatAdapter {
Body body = objectFactory.createBody();
Header header = objectFactory.createHeader();
- Throwable exception = exchange.getProperty(Exchange.EXCEPTION_CAUGHT, Throwable.class);
+ Throwable exception = exchange.getProperty(ExchangePropertyKey.EXCEPTION_CAUGHT, Throwable.class);
if (exception == null) {
exception = exchange.getIn().getHeader(Exchange.EXCEPTION_CAUGHT, Throwable.class);
}
diff --git a/components/camel-splunk/src/main/java/org/apache/camel/component/splunk/SplunkConsumer.java b/components/camel-splunk/src/main/java/org/apache/camel/component/splunk/SplunkConsumer.java
index c7edcab..0077aab 100644
--- a/components/camel-splunk/src/main/java/org/apache/camel/component/splunk/SplunkConsumer.java
+++ b/components/camel-splunk/src/main/java/org/apache/camel/component/splunk/SplunkConsumer.java
@@ -22,6 +22,7 @@ import java.util.Queue;
import org.apache.camel.AsyncCallback;
import org.apache.camel.Exchange;
+import org.apache.camel.ExchangePropertyKey;
import org.apache.camel.Message;
import org.apache.camel.Processor;
import org.apache.camel.component.splunk.event.SplunkEvent;
@@ -107,9 +108,9 @@ public class SplunkConsumer extends ScheduledBatchPollingConsumer {
for (int index = 0; index < total && isBatchAllowed(); index++) {
Exchange exchange = ObjectHelper.cast(Exchange.class, exchanges.poll());
- exchange.setProperty(Exchange.BATCH_INDEX, index);
- exchange.setProperty(Exchange.BATCH_SIZE, total);
- exchange.setProperty(Exchange.BATCH_COMPLETE, index == total - 1);
+ exchange.setProperty(ExchangePropertyKey.BATCH_INDEX, index);
+ exchange.setProperty(ExchangePropertyKey.BATCH_SIZE, total);
+ exchange.setProperty(ExchangePropertyKey.BATCH_COMPLETE, index == total - 1);
try {
LOG.trace("Processing exchange [{}]...", exchange);
getProcessor().process(exchange);
diff --git a/components/camel-sql/src/main/java/org/apache/camel/component/sql/SqlConsumer.java b/components/camel-sql/src/main/java/org/apache/camel/component/sql/SqlConsumer.java
index 78635f4..d7e95c3 100644
--- a/components/camel-sql/src/main/java/org/apache/camel/component/sql/SqlConsumer.java
+++ b/components/camel-sql/src/main/java/org/apache/camel/component/sql/SqlConsumer.java
@@ -25,6 +25,7 @@ import java.util.List;
import java.util.Queue;
import org.apache.camel.Exchange;
+import org.apache.camel.ExchangePropertyKey;
import org.apache.camel.Message;
import org.apache.camel.Processor;
import org.apache.camel.RollbackExchangeException;
@@ -256,9 +257,9 @@ public class SqlConsumer extends ScheduledBatchPollingConsumer {
Object data = holder.data;
// add current index and total as properties
- exchange.setProperty(Exchange.BATCH_INDEX, index);
- exchange.setProperty(Exchange.BATCH_SIZE, total);
- exchange.setProperty(Exchange.BATCH_COMPLETE, index == total - 1);
+ exchange.setProperty(ExchangePropertyKey.BATCH_INDEX, index);
+ exchange.setProperty(ExchangePropertyKey.BATCH_SIZE, total);
+ exchange.setProperty(ExchangePropertyKey.BATCH_COMPLETE, index == total - 1);
// update pending number of exchanges
pendingExchanges = total - index - 1;
diff --git a/components/camel-sql/src/main/java/org/apache/camel/processor/aggregate/jdbc/JdbcCamelCodec.java b/components/camel-sql/src/main/java/org/apache/camel/processor/aggregate/jdbc/JdbcCamelCodec.java
index fd0b2d9..3af195b 100644
--- a/components/camel-sql/src/main/java/org/apache/camel/processor/aggregate/jdbc/JdbcCamelCodec.java
+++ b/components/camel-sql/src/main/java/org/apache/camel/processor/aggregate/jdbc/JdbcCamelCodec.java
@@ -27,6 +27,7 @@ import java.io.OutputStream;
import org.apache.camel.CamelContext;
import org.apache.camel.Endpoint;
import org.apache.camel.Exchange;
+import org.apache.camel.ExchangePropertyKey;
import org.apache.camel.ExtendedExchange;
import org.apache.camel.support.DefaultExchange;
import org.apache.camel.support.DefaultExchangeHolder;
@@ -51,17 +52,17 @@ public class JdbcCamelCodec {
DefaultExchangeHolder pe = DefaultExchangeHolder.marshal(exchange, false, allowSerializedHeaders);
// add the aggregated size and timeout property as the only properties we want to retain
DefaultExchangeHolder.addProperty(pe, Exchange.AGGREGATED_SIZE,
- exchange.getProperty(Exchange.AGGREGATED_SIZE, Integer.class));
+ exchange.getProperty(ExchangePropertyKey.AGGREGATED_SIZE, Integer.class));
DefaultExchangeHolder.addProperty(pe, Exchange.AGGREGATED_TIMEOUT,
- exchange.getProperty(Exchange.AGGREGATED_TIMEOUT, Long.class));
+ exchange.getProperty(ExchangePropertyKey.AGGREGATED_TIMEOUT, Long.class));
// add the aggregated completed by property to retain
DefaultExchangeHolder.addProperty(pe, Exchange.AGGREGATED_COMPLETED_BY,
- exchange.getProperty(Exchange.AGGREGATED_COMPLETED_BY, String.class));
+ exchange.getProperty(ExchangePropertyKey.AGGREGATED_COMPLETED_BY, String.class));
// add the aggregated correlation key property to retain
DefaultExchangeHolder.addProperty(pe, Exchange.AGGREGATED_CORRELATION_KEY,
- exchange.getProperty(Exchange.AGGREGATED_CORRELATION_KEY, String.class));
+ exchange.getProperty(ExchangePropertyKey.AGGREGATED_CORRELATION_KEY, String.class));
DefaultExchangeHolder.addProperty(pe, Exchange.AGGREGATED_CORRELATION_KEY,
- exchange.getProperty(Exchange.AGGREGATED_CORRELATION_KEY, String.class));
+ exchange.getProperty(ExchangePropertyKey.AGGREGATED_CORRELATION_KEY, String.class));
// and a guard property if using the flexible toolbox aggregator
DefaultExchangeHolder.addProperty(pe, Exchange.AGGREGATED_COLLECTION_GUARD,
exchange.getProperty(Exchange.AGGREGATED_COLLECTION_GUARD, String.class));
diff --git a/components/camel-stream/src/main/java/org/apache/camel/component/stream/StreamProducer.java b/components/camel-stream/src/main/java/org/apache/camel/component/stream/StreamProducer.java
index cff3298..775e5eb 100644
--- a/components/camel-stream/src/main/java/org/apache/camel/component/stream/StreamProducer.java
+++ b/components/camel-stream/src/main/java/org/apache/camel/component/stream/StreamProducer.java
@@ -30,6 +30,7 @@ import java.util.concurrent.atomic.AtomicInteger;
import org.apache.camel.CamelExchangeException;
import org.apache.camel.Exchange;
+import org.apache.camel.ExchangePropertyKey;
import org.apache.camel.support.DefaultProducer;
import org.apache.camel.util.IOHelper;
import org.apache.camel.util.StringHelper;
@@ -165,7 +166,7 @@ public class StreamProducer extends DefaultProducer {
}
private Boolean isDone(Exchange exchange) {
- return exchange != null && exchange.getProperty(Exchange.SPLIT_COMPLETE, Boolean.FALSE, Boolean.class);
+ return exchange != null && exchange.getProperty(ExchangePropertyKey.SPLIT_COMPLETE, Boolean.FALSE, Boolean.class);
}
private void closeStream(Exchange exchange, boolean force) throws Exception {
diff --git a/components/camel-undertow/src/main/java/org/apache/camel/component/undertow/UndertowConsumer.java b/components/camel-undertow/src/main/java/org/apache/camel/component/undertow/UndertowConsumer.java
index 719b8dd..0dbdcad 100644
--- a/components/camel-undertow/src/main/java/org/apache/camel/component/undertow/UndertowConsumer.java
+++ b/components/camel-undertow/src/main/java/org/apache/camel/component/undertow/UndertowConsumer.java
@@ -43,6 +43,7 @@ import io.undertow.websockets.spi.WebSocketHttpExchange;
import org.apache.camel.AsyncCallback;
import org.apache.camel.Exchange;
import org.apache.camel.ExchangePattern;
+import org.apache.camel.ExchangePropertyKey;
import org.apache.camel.Message;
import org.apache.camel.NoTypeConversionAvailableException;
import org.apache.camel.Processor;
@@ -351,7 +352,7 @@ public class UndertowConsumer extends DefaultConsumer implements HttpHandler, Su
getEndpoint().getSecurityProvider().addHeader((key, value) -> in.setHeader(key, value), httpExchange);
}
- exchange.setProperty(Exchange.CHARSET_NAME, httpExchange.getRequestCharset());
+ exchange.setProperty(ExchangePropertyKey.CHARSET_NAME, httpExchange.getRequestCharset());
in.setHeader(Exchange.HTTP_CHARACTER_ENCODING, httpExchange.getRequestCharset());
exchange.setIn(in);
diff --git a/components/camel-vertx-common/src/main/java/org/apache/camel/component/vertx/common/VertxBufferConverter.java b/components/camel-vertx-common/src/main/java/org/apache/camel/component/vertx/common/VertxBufferConverter.java
index 2e9a5a9..30559f9 100644
--- a/components/camel-vertx-common/src/main/java/org/apache/camel/component/vertx/common/VertxBufferConverter.java
+++ b/components/camel-vertx-common/src/main/java/org/apache/camel/component/vertx/common/VertxBufferConverter.java
@@ -25,6 +25,7 @@ import io.netty.buffer.ByteBuf;
import io.vertx.core.buffer.Buffer;
import org.apache.camel.Converter;
import org.apache.camel.Exchange;
+import org.apache.camel.ExchangePropertyKey;
import org.apache.camel.util.IOHelper;
import org.apache.camel.util.ObjectHelper;
@@ -98,7 +99,7 @@ public final class VertxBufferConverter {
charset = IOHelper.getCharsetNameFromContentType(contentType);
}
if (ObjectHelper.isEmpty(charset)) {
- charset = exchange.getProperty(Exchange.CHARSET_NAME, String.class);
+ charset = exchange.getProperty(ExchangePropertyKey.CHARSET_NAME, String.class);
}
}
return charset;
diff --git a/components/camel-vertx-http/src/main/java/org/apache/camel/component/vertx/http/DefaultVertxHttpBinding.java b/components/camel-vertx-http/src/main/java/org/apache/camel/component/vertx/http/DefaultVertxHttpBinding.java
index 6d237af..8731f8b 100644
--- a/components/camel-vertx-http/src/main/java/org/apache/camel/component/vertx/http/DefaultVertxHttpBinding.java
+++ b/components/camel-vertx-http/src/main/java/org/apache/camel/component/vertx/http/DefaultVertxHttpBinding.java
@@ -31,6 +31,7 @@ import io.vertx.ext.web.client.HttpRequest;
import io.vertx.ext.web.client.HttpResponse;
import io.vertx.ext.web.client.WebClient;
import org.apache.camel.Exchange;
+import org.apache.camel.ExchangePropertyKey;
import org.apache.camel.Message;
import org.apache.camel.TypeConverter;
import org.apache.camel.http.base.HttpHelper;
@@ -181,7 +182,7 @@ public class DefaultVertxHttpBinding implements VertxHttpBinding {
if (!found && name.equalsIgnoreCase("content-type")) {
found = true;
name = Exchange.CONTENT_TYPE;
- exchange.setProperty(Exchange.CHARSET_NAME, IOHelper.getCharsetNameFromContentType(value));
+ exchange.setProperty(ExchangePropertyKey.CHARSET_NAME, IOHelper.getCharsetNameFromContentType(value));
}
Object extracted = HttpHelper.extractHttpParameterValue(value);
if (strategy != null && !strategy.applyFilterToExternalHeaders(name, extracted, exchange)) {
diff --git a/components/camel-vertx-http/src/main/java/org/apache/camel/component/vertx/http/VertxHttpHelper.java b/components/camel-vertx-http/src/main/java/org/apache/camel/component/vertx/http/VertxHttpHelper.java
index ecb2f52..df0f90f 100644
--- a/components/camel-vertx-http/src/main/java/org/apache/camel/component/vertx/http/VertxHttpHelper.java
+++ b/components/camel-vertx-http/src/main/java/org/apache/camel/component/vertx/http/VertxHttpHelper.java
@@ -32,6 +32,7 @@ import io.vertx.core.Vertx;
import io.vertx.core.net.JksOptions;
import io.vertx.core.net.TCPSSLOptions;
import org.apache.camel.Exchange;
+import org.apache.camel.ExchangePropertyKey;
import org.apache.camel.Message;
import org.apache.camel.http.base.HttpHelper;
import org.apache.camel.support.jsse.KeyManagersParameters;
@@ -169,7 +170,7 @@ public final class VertxHttpHelper {
String contentType = exchange.getMessage().getHeader(Exchange.CONTENT_TYPE, String.class);
charset = HttpHelper.getCharsetFromContentType(contentType);
if (ObjectHelper.isEmpty(charset)) {
- charset = exchange.getProperty(Exchange.CHARSET_NAME, String.class);
+ charset = exchange.getProperty(ExchangePropertyKey.CHARSET_NAME, String.class);
}
}
return charset;
diff --git a/components/camel-xstream/src/main/java/org/apache/camel/dataformat/xstream/XStreamDataFormat.java b/components/camel-xstream/src/main/java/org/apache/camel/dataformat/xstream/XStreamDataFormat.java
index b13211c..93a10a4 100644
--- a/components/camel-xstream/src/main/java/org/apache/camel/dataformat/xstream/XStreamDataFormat.java
+++ b/components/camel-xstream/src/main/java/org/apache/camel/dataformat/xstream/XStreamDataFormat.java
@@ -30,6 +30,7 @@ import com.thoughtworks.xstream.io.xml.QNameMap;
import com.thoughtworks.xstream.io.xml.StaxReader;
import com.thoughtworks.xstream.io.xml.StaxWriter;
import org.apache.camel.Exchange;
+import org.apache.camel.ExchangePropertyKey;
import org.apache.camel.spi.ClassResolver;
import org.apache.camel.spi.Metadata;
import org.apache.camel.spi.annotations.Dataformat;
@@ -104,8 +105,8 @@ public class XStreamDataFormat extends AbstractXStreamWrapper {
// just make sure the exchange property can override the xmlstream encoding setting
protected void updateCharacterEncodingInfo(Exchange exchange) {
- if (exchange.getProperty(Exchange.CHARSET_NAME) == null && encoding != null) {
- exchange.setProperty(Exchange.CHARSET_NAME, IOHelper.normalizeCharset(encoding));
+ if (exchange.getProperty(ExchangePropertyKey.CHARSET_NAME) == null && encoding != null) {
+ exchange.setProperty(ExchangePropertyKey.CHARSET_NAME, IOHelper.normalizeCharset(encoding));
}
}