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 2015/02/22 16:12:19 UTC
[1/4] camel git commit: JAXB needs both core and impl to work on Java8
Repository: camel
Updated Branches:
refs/heads/master 050e22d94 -> d5b596403
JAXB needs both core and impl to work on Java8
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/56db9c0b
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/56db9c0b
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/56db9c0b
Branch: refs/heads/master
Commit: 56db9c0bb0602b62ea4b5b8581abbb23ebdf26ff
Parents: 050e22d
Author: Claus Ibsen <da...@apache.org>
Authored: Sun Feb 22 13:31:44 2015 +0100
Committer: Claus Ibsen <da...@apache.org>
Committed: Sun Feb 22 13:36:50 2015 +0100
----------------------------------------------------------------------
parent/pom.xml | 24 ++++++++++++++++++++++++
pom.xml | 6 ++++++
2 files changed, 30 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/56db9c0b/parent/pom.xml
----------------------------------------------------------------------
diff --git a/parent/pom.xml b/parent/pom.xml
index 21b9019..1f77e5e 100644
--- a/parent/pom.xml
+++ b/parent/pom.xml
@@ -3054,6 +3054,30 @@
<jdk>1.7</jdk>
</activation>
+ <!-- Update JAXB version here -->
+ <properties>
+ <jaxb-version>2.2.11</jaxb-version>
+ </properties>
+
+ <dependencies>
+ <dependency>
+ <groupId>com.sun.xml.bind</groupId>
+ <artifactId>jaxb-core</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>com.sun.xml.bind</groupId>
+ <artifactId>jaxb-impl</artifactId>
+ </dependency>
+ </dependencies>
+ </profile>
+
+ <profile>
+ <id>jdk1.8</id>
+ <activation>
+ <jdk>1.8</jdk>
+ </activation>
+
+ <!-- Update JAXB version here -->
<properties>
<jaxb-version>2.2.11</jaxb-version>
</properties>
http://git-wip-us.apache.org/repos/asf/camel/blob/56db9c0b/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 49c4ffa..55de237 100755
--- a/pom.xml
+++ b/pom.xml
@@ -54,6 +54,7 @@
<maven-compiler-plugin-version>2.5.1</maven-compiler-plugin-version>
<!-- eclipse plugin need the jaxb in this pom.xml file -->
+ <!-- Make sure to keep JAXB version up to date in parent/pom.xml in the bottom of the file -->
<jaxb-version>2.2.11</jaxb-version>
</properties>
@@ -422,6 +423,11 @@
<dependencies>
<dependency>
<groupId>com.sun.xml.bind</groupId>
+ <artifactId>jaxb-core</artifactId>
+ <version>${jaxb-version}</version>
+ </dependency>
+ <dependency>
+ <groupId>com.sun.xml.bind</groupId>
<artifactId>jaxb-impl</artifactId>
<version>${jaxb-version}</version>
</dependency>
[3/4] camel git commit: CAMEL-8386: WireTap should copy the body if
the body is a stream cache.
Posted by da...@apache.org.
CAMEL-8386: WireTap should copy the body if the body is a stream cache.
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/4661cbb9
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/4661cbb9
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/4661cbb9
Branch: refs/heads/master
Commit: 4661cbb94513d6047e58581b23dcd4a6fad166f7
Parents: 686bb35
Author: Claus Ibsen <da...@apache.org>
Authored: Sun Feb 22 16:11:41 2015 +0100
Committer: Claus Ibsen <da...@apache.org>
Committed: Sun Feb 22 16:11:41 2015 +0100
----------------------------------------------------------------------
.../camel/processor/WireTapProcessor.java | 27 +++++-
.../processor/MulticastStreamCachingTest.java | 2 +-
.../processor/WireTapStreamCachingTest.java | 91 ++++++++++++++++++++
3 files changed, 117 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/4661cbb9/camel-core/src/main/java/org/apache/camel/processor/WireTapProcessor.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/processor/WireTapProcessor.java b/camel-core/src/main/java/org/apache/camel/processor/WireTapProcessor.java
index ab9ca15..3f71226 100644
--- a/camel-core/src/main/java/org/apache/camel/processor/WireTapProcessor.java
+++ b/camel-core/src/main/java/org/apache/camel/processor/WireTapProcessor.java
@@ -16,6 +16,7 @@
*/
package org.apache.camel.processor;
+import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.Callable;
@@ -28,7 +29,9 @@ import org.apache.camel.EndpointAware;
import org.apache.camel.Exchange;
import org.apache.camel.ExchangePattern;
import org.apache.camel.Expression;
+import org.apache.camel.Message;
import org.apache.camel.Processor;
+import org.apache.camel.StreamCache;
import org.apache.camel.Traceable;
import org.apache.camel.impl.DefaultExchange;
import org.apache.camel.support.ServiceSupport;
@@ -93,7 +96,16 @@ public class WireTapProcessor extends ServiceSupport implements AsyncProcessor,
}
// must configure the wire tap beforehand
- final Exchange wireTapExchange = configureExchange(exchange, exchangePattern);
+ Exchange target;
+ try {
+ target = configureExchange(exchange, exchangePattern);
+ } catch (Exception e) {
+ exchange.setException(e);
+ callback.done(true);
+ return true;
+ }
+
+ final Exchange wireTapExchange = target;
// send the exchange to the destination using an executor service
executorService.submit(new Callable<Exchange>() {
@@ -114,7 +126,7 @@ public class WireTapProcessor extends ServiceSupport implements AsyncProcessor,
}
- protected Exchange configureExchange(Exchange exchange, ExchangePattern pattern) {
+ protected Exchange configureExchange(Exchange exchange, ExchangePattern pattern) throws IOException {
Exchange answer;
if (copy) {
// use a copy of the original exchange
@@ -145,6 +157,17 @@ public class WireTapProcessor extends ServiceSupport implements AsyncProcessor,
}
}
+ // if the body is a stream cache we must use a copy of the stream in the wire tapped exchange
+ Message msg = answer.hasOut() ? answer.getOut() : answer.getIn();
+ if (msg.getBody() instanceof StreamCache) {
+ // in parallel processing case, the stream must be copied, therefore get the stream
+ StreamCache cache = (StreamCache) msg.getBody();
+ StreamCache copied = cache.copy();
+ if (copied != null) {
+ msg.setBody(copied);
+ }
+ }
+
// invoke on prepare on the exchange if specified
if (onPrepare != null) {
try {
http://git-wip-us.apache.org/repos/asf/camel/blob/4661cbb9/camel-core/src/test/java/org/apache/camel/processor/MulticastStreamCachingTest.java
----------------------------------------------------------------------
diff --git a/camel-core/src/test/java/org/apache/camel/processor/MulticastStreamCachingTest.java b/camel-core/src/test/java/org/apache/camel/processor/MulticastStreamCachingTest.java
index 281b87c..8efa5a1 100644
--- a/camel-core/src/test/java/org/apache/camel/processor/MulticastStreamCachingTest.java
+++ b/camel-core/src/test/java/org/apache/camel/processor/MulticastStreamCachingTest.java
@@ -80,7 +80,7 @@ public class MulticastStreamCachingTest extends ContextTestSupport {
errorHandler(deadLetterChannel("mock:error").redeliveryDelay(0).maximumRedeliveries(3));
- //stream caching should fix re-readability issues when multicasting messags
+ //stream caching should fix re-readability issues when multicasting messages
from("direct:a").multicast().to("direct:x", "direct:y", "direct:z");
from("direct:x").process(processor).to("mock:x");
http://git-wip-us.apache.org/repos/asf/camel/blob/4661cbb9/camel-core/src/test/java/org/apache/camel/processor/WireTapStreamCachingTest.java
----------------------------------------------------------------------
diff --git a/camel-core/src/test/java/org/apache/camel/processor/WireTapStreamCachingTest.java b/camel-core/src/test/java/org/apache/camel/processor/WireTapStreamCachingTest.java
new file mode 100644
index 0000000..0a87c13
--- /dev/null
+++ b/camel-core/src/test/java/org/apache/camel/processor/WireTapStreamCachingTest.java
@@ -0,0 +1,91 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.processor;
+
+import java.io.StringReader;
+import javax.xml.transform.stream.StreamSource;
+
+import org.apache.camel.ContextTestSupport;
+import org.apache.camel.Endpoint;
+import org.apache.camel.Exchange;
+import org.apache.camel.Message;
+import org.apache.camel.Processor;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.mock.MockEndpoint;
+
+/**
+ * @version
+ */
+public class WireTapStreamCachingTest extends ContextTestSupport {
+ protected Endpoint startEndpoint;
+ protected MockEndpoint x;
+ protected MockEndpoint y;
+ protected MockEndpoint z;
+
+ public void testSendingAMessageUsingWiretapConvertsToReReadable() throws Exception {
+ x.expectedBodiesReceived("<input/>+output");
+ y.expectedBodiesReceived("<input/>+output");
+ z.expectedBodiesReceived("<input/>+output");
+
+ template.send("direct:a", new Processor() {
+ public void process(Exchange exchange) {
+ Message in = exchange.getIn();
+ in.setBody(new StreamSource(new StringReader("<input/>")));
+ in.setHeader("foo", "bar");
+ }
+ });
+
+ assertMockEndpointsSatisfied();
+ }
+
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+
+ x = getMockEndpoint("mock:x");
+ y = getMockEndpoint("mock:y");
+ z = getMockEndpoint("mock:z");
+ }
+
+ protected RouteBuilder createRouteBuilder() {
+ final Processor processor = new Processor() {
+ public void process(Exchange exchange) {
+ // lets transform the IN message
+ Message in = exchange.getIn();
+ String body = in.getBody(String.class);
+ in.setBody(body + "+output");
+ }
+ };
+
+ return new RouteBuilder() {
+ public void configure() {
+ // enable stream caching
+ context.setStreamCaching(true);
+
+ errorHandler(deadLetterChannel("mock:error").redeliveryDelay(0).maximumRedeliveries(3));
+
+ //stream caching should fix re-readability issues when wire tapping messages
+ from("direct:a").wireTap("direct:x").wireTap("direct:y").wireTap("direct:z");
+
+ from("direct:x").process(processor).to("mock:x");
+ from("direct:y").process(processor).to("mock:y");
+ from("direct:z").process(processor).to("mock:z");
+ }
+ };
+ }
+}
[4/4] camel git commit: CAMEL-8387: File endpoint should validate the
read lock timeout/interval options is configured correctly.
Posted by da...@apache.org.
CAMEL-8387: File endpoint should validate the read lock timeout/interval options is configured correctly.
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/d5b59640
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/d5b59640
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/d5b59640
Branch: refs/heads/master
Commit: d5b596403347bd65523e30e1a9fe65b6fefb38b1
Parents: 4661cbb
Author: Claus Ibsen <da...@apache.org>
Authored: Sun Feb 22 16:13:07 2015 +0100
Committer: Claus Ibsen <da...@apache.org>
Committed: Sun Feb 22 16:13:07 2015 +0100
----------------------------------------------------------------------
.../org/apache/camel/component/file/GenericFileEndpoint.java | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/d5b59640/camel-core/src/main/java/org/apache/camel/component/file/GenericFileEndpoint.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/component/file/GenericFileEndpoint.java b/camel-core/src/main/java/org/apache/camel/component/file/GenericFileEndpoint.java
index 7cc8cd2..3eb1b53 100644
--- a/camel-core/src/main/java/org/apache/camel/component/file/GenericFileEndpoint.java
+++ b/camel-core/src/main/java/org/apache/camel/component/file/GenericFileEndpoint.java
@@ -1285,8 +1285,8 @@ public abstract class GenericFileEndpoint<T> extends ScheduledPollEndpoint imple
if (readLockTimeout > 0 && readLockTimeout <= readLockCheckInterval) {
throw new IllegalArgumentException("The option readLockTimeout must be higher than readLockCheckInterval"
+ ", was readLockTimeout=" + readLockTimeout + ", readLockCheckInterval=" + readLockCheckInterval
- + ". A good practice is to let the readLockTimeout be at least 3 or more times higher than the readLockCheckInterval" +
- ", to ensure the read lock procedure has amble times to run several times checks during acquiring the lock.");
+ + ". A good practice is to let the readLockTimeout be at least 3 or more times higher than the readLockCheckInterval"
+ + ", to ensure the read lock procedure has amble times to run several times checks during acquiring the lock.");
}
}
[2/4] camel git commit: CAMEL-8387: File endpoint should validate the
read lock timeout/interval options is configured correctly.
Posted by da...@apache.org.
CAMEL-8387: File endpoint should validate the read lock timeout/interval options is configured correctly.
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/686bb356
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/686bb356
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/686bb356
Branch: refs/heads/master
Commit: 686bb35674f8ac19d71f03cf2786f60f52bfb913
Parents: 56db9c0
Author: Claus Ibsen <da...@apache.org>
Authored: Sun Feb 22 15:55:49 2015 +0100
Committer: Claus Ibsen <da...@apache.org>
Committed: Sun Feb 22 15:55:49 2015 +0100
----------------------------------------------------------------------
.../camel/component/file/GenericFileEndpoint.java | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/686bb356/camel-core/src/main/java/org/apache/camel/component/file/GenericFileEndpoint.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/component/file/GenericFileEndpoint.java b/camel-core/src/main/java/org/apache/camel/component/file/GenericFileEndpoint.java
index e2aa419..7cc8cd2 100644
--- a/camel-core/src/main/java/org/apache/camel/component/file/GenericFileEndpoint.java
+++ b/camel-core/src/main/java/org/apache/camel/component/file/GenericFileEndpoint.java
@@ -817,7 +817,12 @@ public abstract class GenericFileEndpoint<T> extends ScheduledPollEndpoint imple
* This interval is used for sleeping between attempts to acquire the read lock.
* For example when using the changed read lock, you can set a higher interval period to cater for slow writes.
* The default of 1 sec. may be too fast if the producer is very slow writing the file.
- * For FTP the default readLockCheckInterval is 5000.
+ * <p/>
+ * Notice: For FTP the default readLockCheckInterval is 5000.
+ * <p/>
+ * The readLockTimeout value must be higher than readLockCheckInterval, but a rule of thumb is to have a timeout
+ * that is at least 2 or more times higher than the readLockCheckInterval. This is needed to ensure that amble
+ * time is allowed for the read lock process to try to grab the lock before the timeout was hit.
*/
public void setReadLockCheckInterval(long readLockCheckInterval) {
this.readLockCheckInterval = readLockCheckInterval;
@@ -832,7 +837,12 @@ public abstract class GenericFileEndpoint<T> extends ScheduledPollEndpoint imple
* If the read-lock could not be granted and the timeout triggered, then Camel will skip the file.
* At next poll Camel, will try the file again, and this time maybe the read-lock could be granted.
* Use a value of 0 or lower to indicate forever. Currently fileLock, changed and rename support the timeout.
+ * <p/>
* Notice: For FTP the default readLockTimeout value is 20000 instead of 10000.
+ * <p/>
+ * The readLockTimeout value must be higher than readLockCheckInterval, but a rule of thumb is to have a timeout
+ * that is at least 2 or more times higher than the readLockCheckInterval. This is needed to ensure that amble
+ * time is allowed for the read lock process to try to grab the lock before the timeout was hit.
*/
public void setReadLockTimeout(long readLockTimeout) {
this.readLockTimeout = readLockTimeout;