You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by fbarbat <fb...@gmail.com> on 2013/09/02 20:13:08 UTC

Re: Netty and requestTimeout

Hi,

This test reproduces the exception. The System.in.read() at the end is just
to wait for the exception to appear. Any ideas?

Thanks.

package camel.test;

import java.io.IOException;

import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.test.junit4.CamelTestSupport;
import org.junit.Assert;
import org.junit.Test;

public class CamelNettyTest 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 IOException {
		String result = template.requestBody("direct:out", "hello",
				String.class);
		Assert.assertEquals("hello", result);
		System.in.read();
	}
}





--
View this message in context: http://camel.465427.n5.nabble.com/Netty-and-requestTimeout-tp5738341p5738533.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Netty and requestTimeout

Posted by Claus Ibsen <cl...@gmail.com>.
Hi

Logged a ticket to fix this
https://issues.apache.org/jira/browse/CAMEL-6730

On Tue, Sep 3, 2013 at 9:22 AM, Claus Ibsen <cl...@gmail.com> wrote:
> Hi
>
> Yeah removing the timeout handler is a good idea. And we love
> contributions, so feel free to log a JIRA and attach a patch.
> http://camel.apache.org/contributing.html
>
> On Mon, Sep 2, 2013 at 10:05 PM, fbarbat <fb...@gmail.com> wrote:
>> As a workaround, I implemented a handler which modifies the pipeline on every
>> request so the ReadTimeoutHandler is removed once the response is read.
>> Specifically, a CamelRequestTimeoutHandler is inserted before Camel's
>> ClientChannelHandler. My handler inserts a ReadTimeoutHandler on write and
>> removes it on read.
>> This has no problems with Camel use of Netty because of the pool of
>> channels. If the access to a single channel had been concurrent, this
>> workaround wouldn't have worked. I can send you a patch if you are
>> interested.
>>
>>
>>
>>
>>
>> --
>> View this message in context: http://camel.465427.n5.nabble.com/Netty-and-requestTimeout-tp5738341p5738536.html
>> Sent from the Camel - Users mailing list archive at Nabble.com.
>
>
>
> --
> Claus Ibsen
> -----------------
> Red Hat, Inc.
> Email: cibsen@redhat.com
> Twitter: davsclaus
> Blog: http://davsclaus.com
> Author of Camel in Action: http://www.manning.com/ibsen



-- 
Claus Ibsen
-----------------
Red Hat, Inc.
Email: cibsen@redhat.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen

Re: Netty and requestTimeout

Posted by Claus Ibsen <cl...@gmail.com>.
Hi

Yeah removing the timeout handler is a good idea. And we love
contributions, so feel free to log a JIRA and attach a patch.
http://camel.apache.org/contributing.html

On Mon, Sep 2, 2013 at 10:05 PM, fbarbat <fb...@gmail.com> wrote:
> As a workaround, I implemented a handler which modifies the pipeline on every
> request so the ReadTimeoutHandler is removed once the response is read.
> Specifically, a CamelRequestTimeoutHandler is inserted before Camel's
> ClientChannelHandler. My handler inserts a ReadTimeoutHandler on write and
> removes it on read.
> This has no problems with Camel use of Netty because of the pool of
> channels. If the access to a single channel had been concurrent, this
> workaround wouldn't have worked. I can send you a patch if you are
> interested.
>
>
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Netty-and-requestTimeout-tp5738341p5738536.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-----------------
Red Hat, Inc.
Email: cibsen@redhat.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen

Re: Netty and requestTimeout

Posted by fbarbat <fb...@gmail.com>.
As a workaround, I implemented a handler which modifies the pipeline on every
request so the ReadTimeoutHandler is removed once the response is read.
Specifically, a CamelRequestTimeoutHandler is inserted before Camel's
ClientChannelHandler. My handler inserts a ReadTimeoutHandler on write and
removes it on read. 
This has no problems with Camel use of Netty because of the pool of
channels. If the access to a single channel had been concurrent, this
workaround wouldn't have worked. I can send you a patch if you are
interested.





--
View this message in context: http://camel.465427.n5.nabble.com/Netty-and-requestTimeout-tp5738341p5738536.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Netty and requestTimeout

Posted by fbarbat <fb...@gmail.com>.
Sorry, I forgot to mention I'm using 2.11.1



--
View this message in context: http://camel.465427.n5.nabble.com/Netty-and-requestTimeout-tp5738341p5738534.html
Sent from the Camel - Users mailing list archive at Nabble.com.