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 2013/09/11 16:37:07 UTC
[1/3] git commit: CAMEL-6730: Fixed requestTimeout on camel-netty.
Updated Branches:
refs/heads/camel-2.11.x 2fd7c90cc -> 3e23e7f58
refs/heads/camel-2.12.x 281f3e893 -> c47953b01
refs/heads/master f7787731e -> 99f7a66ba
CAMEL-6730: Fixed requestTimeout on camel-netty.
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/99f7a66b
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/99f7a66b
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/99f7a66b
Branch: refs/heads/master
Commit: 99f7a66ba3dbc0dc9dc32b089cae05e73a3d4bd5
Parents: f778773
Author: Claus Ibsen <da...@apache.org>
Authored: Wed Sep 11 16:36:19 2013 +0200
Committer: Claus Ibsen <da...@apache.org>
Committed: Wed Sep 11 16:36:19 2013 +0200
----------------------------------------------------------------------
.../netty/handlers/ClientChannelHandler.java | 9 ++++
.../netty/NettyRequestTimeoutIssueTest.java | 50 ++++++++++++++++++++
2 files changed, 59 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/99f7a66b/components/camel-netty/src/main/java/org/apache/camel/component/netty/handlers/ClientChannelHandler.java
----------------------------------------------------------------------
diff --git a/components/camel-netty/src/main/java/org/apache/camel/component/netty/handlers/ClientChannelHandler.java b/components/camel-netty/src/main/java/org/apache/camel/component/netty/handlers/ClientChannelHandler.java
index a79c5bb..b55f4b7 100644
--- a/components/camel-netty/src/main/java/org/apache/camel/component/netty/handlers/ClientChannelHandler.java
+++ b/components/camel-netty/src/main/java/org/apache/camel/component/netty/handlers/ClientChannelHandler.java
@@ -120,6 +120,15 @@ public class ClientChannelHandler extends SimpleChannelUpstreamHandler {
@Override
public void messageReceived(ChannelHandlerContext ctx, MessageEvent messageEvent) throws Exception {
+ if (LOG.isTraceEnabled()) {
+ LOG.trace("Message received: {}", messageEvent);
+ }
+
+ if (producer.getConfiguration().getRequestTimeout() > 0) {
+ LOG.trace("Removing timeout channel as we received message");
+ ctx.getPipeline().remove("timeout");
+ }
+
messageReceived = true;
Exchange exchange = getExchange(ctx);
http://git-wip-us.apache.org/repos/asf/camel/blob/99f7a66b/components/camel-netty/src/test/java/org/apache/camel/component/netty/NettyRequestTimeoutIssueTest.java
----------------------------------------------------------------------
diff --git a/components/camel-netty/src/test/java/org/apache/camel/component/netty/NettyRequestTimeoutIssueTest.java b/components/camel-netty/src/test/java/org/apache/camel/component/netty/NettyRequestTimeoutIssueTest.java
new file mode 100644
index 0000000..9b16148
--- /dev/null
+++ b/components/camel-netty/src/test/java/org/apache/camel/component/netty/NettyRequestTimeoutIssueTest.java
@@ -0,0 +1,50 @@
+/**
+ * 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.component.netty;
+
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.test.junit4.CamelTestSupport;
+import org.junit.Assert;
+import org.junit.Ignore;
+import org.junit.Test;
+
+@Ignore("This test can be run manually")
+public class NettyRequestTimeoutIssueTest extends CamelTestSupport {
+
+ @Override
+ protected RouteBuilder createRouteBuilder() throws Exception {
+ return new RouteBuilder() {
+ @Override
+ public void configure() throws Exception {
+ from("direct:out")
+ .to("netty:tcp://localhost:8080?requestTimeout=5000");
+
+ from("netty:tcp://localhost:8080")
+ .to("log:nettyCase?showAll=true&multiline=true");
+ }
+ };
+ }
+
+ @Test
+ public void test() throws Exception {
+ String result = template.requestBody("direct:out", "hello", String.class);
+ Assert.assertEquals("hello", result);
+
+ log.info("Sleeping for 20 seconds, and no Netty exception should occur");
+ Thread.sleep(20000);
+ }
+}
[3/3] git commit: CAMEL-6730: Fixed requestTimeout on camel-netty.
Posted by da...@apache.org.
CAMEL-6730: Fixed requestTimeout on camel-netty.
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/3e23e7f5
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/3e23e7f5
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/3e23e7f5
Branch: refs/heads/camel-2.11.x
Commit: 3e23e7f583c9d2358bec33aef414f110ff4c149a
Parents: 2fd7c90
Author: Claus Ibsen <da...@apache.org>
Authored: Wed Sep 11 16:36:19 2013 +0200
Committer: Claus Ibsen <da...@apache.org>
Committed: Wed Sep 11 16:36:47 2013 +0200
----------------------------------------------------------------------
.../netty/handlers/ClientChannelHandler.java | 9 ++++
.../netty/NettyRequestTimeoutIssueTest.java | 50 ++++++++++++++++++++
2 files changed, 59 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/3e23e7f5/components/camel-netty/src/main/java/org/apache/camel/component/netty/handlers/ClientChannelHandler.java
----------------------------------------------------------------------
diff --git a/components/camel-netty/src/main/java/org/apache/camel/component/netty/handlers/ClientChannelHandler.java b/components/camel-netty/src/main/java/org/apache/camel/component/netty/handlers/ClientChannelHandler.java
index 88b4754..cd2f272 100644
--- a/components/camel-netty/src/main/java/org/apache/camel/component/netty/handlers/ClientChannelHandler.java
+++ b/components/camel-netty/src/main/java/org/apache/camel/component/netty/handlers/ClientChannelHandler.java
@@ -120,6 +120,15 @@ public class ClientChannelHandler extends SimpleChannelUpstreamHandler {
@Override
public void messageReceived(ChannelHandlerContext ctx, MessageEvent messageEvent) throws Exception {
+ if (LOG.isTraceEnabled()) {
+ LOG.trace("Message received: {}", messageEvent);
+ }
+
+ if (producer.getConfiguration().getRequestTimeout() > 0) {
+ LOG.trace("Removing timeout channel as we received message");
+ ctx.getPipeline().remove("timeout");
+ }
+
messageReceived = true;
Exchange exchange = getExchange(ctx);
http://git-wip-us.apache.org/repos/asf/camel/blob/3e23e7f5/components/camel-netty/src/test/java/org/apache/camel/component/netty/NettyRequestTimeoutIssueTest.java
----------------------------------------------------------------------
diff --git a/components/camel-netty/src/test/java/org/apache/camel/component/netty/NettyRequestTimeoutIssueTest.java b/components/camel-netty/src/test/java/org/apache/camel/component/netty/NettyRequestTimeoutIssueTest.java
new file mode 100644
index 0000000..9b16148
--- /dev/null
+++ b/components/camel-netty/src/test/java/org/apache/camel/component/netty/NettyRequestTimeoutIssueTest.java
@@ -0,0 +1,50 @@
+/**
+ * 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.component.netty;
+
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.test.junit4.CamelTestSupport;
+import org.junit.Assert;
+import org.junit.Ignore;
+import org.junit.Test;
+
+@Ignore("This test can be run manually")
+public class NettyRequestTimeoutIssueTest extends CamelTestSupport {
+
+ @Override
+ protected RouteBuilder createRouteBuilder() throws Exception {
+ return new RouteBuilder() {
+ @Override
+ public void configure() throws Exception {
+ from("direct:out")
+ .to("netty:tcp://localhost:8080?requestTimeout=5000");
+
+ from("netty:tcp://localhost:8080")
+ .to("log:nettyCase?showAll=true&multiline=true");
+ }
+ };
+ }
+
+ @Test
+ public void test() throws Exception {
+ String result = template.requestBody("direct:out", "hello", String.class);
+ Assert.assertEquals("hello", result);
+
+ log.info("Sleeping for 20 seconds, and no Netty exception should occur");
+ Thread.sleep(20000);
+ }
+}
[2/3] git commit: CAMEL-6730: Fixed requestTimeout on camel-netty.
Posted by da...@apache.org.
CAMEL-6730: Fixed requestTimeout on camel-netty.
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/c47953b0
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/c47953b0
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/c47953b0
Branch: refs/heads/camel-2.12.x
Commit: c47953b01d0cea4363ca129087cd2db5ef6079f3
Parents: 281f3e8
Author: Claus Ibsen <da...@apache.org>
Authored: Wed Sep 11 16:36:19 2013 +0200
Committer: Claus Ibsen <da...@apache.org>
Committed: Wed Sep 11 16:36:33 2013 +0200
----------------------------------------------------------------------
.../netty/handlers/ClientChannelHandler.java | 9 ++++
.../netty/NettyRequestTimeoutIssueTest.java | 50 ++++++++++++++++++++
2 files changed, 59 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/c47953b0/components/camel-netty/src/main/java/org/apache/camel/component/netty/handlers/ClientChannelHandler.java
----------------------------------------------------------------------
diff --git a/components/camel-netty/src/main/java/org/apache/camel/component/netty/handlers/ClientChannelHandler.java b/components/camel-netty/src/main/java/org/apache/camel/component/netty/handlers/ClientChannelHandler.java
index a79c5bb..b55f4b7 100644
--- a/components/camel-netty/src/main/java/org/apache/camel/component/netty/handlers/ClientChannelHandler.java
+++ b/components/camel-netty/src/main/java/org/apache/camel/component/netty/handlers/ClientChannelHandler.java
@@ -120,6 +120,15 @@ public class ClientChannelHandler extends SimpleChannelUpstreamHandler {
@Override
public void messageReceived(ChannelHandlerContext ctx, MessageEvent messageEvent) throws Exception {
+ if (LOG.isTraceEnabled()) {
+ LOG.trace("Message received: {}", messageEvent);
+ }
+
+ if (producer.getConfiguration().getRequestTimeout() > 0) {
+ LOG.trace("Removing timeout channel as we received message");
+ ctx.getPipeline().remove("timeout");
+ }
+
messageReceived = true;
Exchange exchange = getExchange(ctx);
http://git-wip-us.apache.org/repos/asf/camel/blob/c47953b0/components/camel-netty/src/test/java/org/apache/camel/component/netty/NettyRequestTimeoutIssueTest.java
----------------------------------------------------------------------
diff --git a/components/camel-netty/src/test/java/org/apache/camel/component/netty/NettyRequestTimeoutIssueTest.java b/components/camel-netty/src/test/java/org/apache/camel/component/netty/NettyRequestTimeoutIssueTest.java
new file mode 100644
index 0000000..9b16148
--- /dev/null
+++ b/components/camel-netty/src/test/java/org/apache/camel/component/netty/NettyRequestTimeoutIssueTest.java
@@ -0,0 +1,50 @@
+/**
+ * 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.component.netty;
+
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.test.junit4.CamelTestSupport;
+import org.junit.Assert;
+import org.junit.Ignore;
+import org.junit.Test;
+
+@Ignore("This test can be run manually")
+public class NettyRequestTimeoutIssueTest extends CamelTestSupport {
+
+ @Override
+ protected RouteBuilder createRouteBuilder() throws Exception {
+ return new RouteBuilder() {
+ @Override
+ public void configure() throws Exception {
+ from("direct:out")
+ .to("netty:tcp://localhost:8080?requestTimeout=5000");
+
+ from("netty:tcp://localhost:8080")
+ .to("log:nettyCase?showAll=true&multiline=true");
+ }
+ };
+ }
+
+ @Test
+ public void test() throws Exception {
+ String result = template.requestBody("direct:out", "hello", String.class);
+ Assert.assertEquals("hello", result);
+
+ log.info("Sleeping for 20 seconds, and no Netty exception should occur");
+ Thread.sleep(20000);
+ }
+}