Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8745777
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T12:05:26+00:00 2026-06-13T12:05:26+00:00

I have a Camel application that communicates with a remote server over TCP using

  • 0

I have a Camel application that communicates with a remote server over TCP using the netty component. The server has a tendency to hang and so I want to be able to add a configurable timeout on a request so that if a response isn’t returned in X amount of time, I’d get an exception.

The mina component has this capability in the timeout parameter, but the netty component doesn’t appear to have a corresponding option.

I tried accomplishing this with a ReadTimeoutHandler and that came close… but not quite. It starts with creating a HashedWheelTimer when initializing the CamelContext:

HashedWheelTimer timer = new HashedWheelTimer();
JndiRegistry jndi = new JndiRegistry();
jndi.bind("MyClientPipelineFactory", new MyClientPipelineFactory(timer));

And then add it to my pipeline:

public class MyClientPipelineFactory extends ClientPipelineFactory
{
  private final Timer timer;

  public MyClientPipelineFactory(Timer timer) {
    this.timer = timer;
  }

  public ChannelPipeline getPipeline(NettyProducer producer) throws Exception
  {
    ChannelPipeline p = pipeline();
    p.addLast("timeout", new ReadTimeoutHandler(timer, 30));
    // more stuff
    return p;
  }
}

Finally, I catch any exceptions in my routes configuration:

onException(ReadTimeoutException.class)
   .handled(true)
   .process(new Processor() {
      public void process(Exchange exchange) throws Exception {
         Exception exception = (Exception) exchange.getProperty(Exchange.EXCEPTION_CAUGHT);
         throw new ApplicationException("Connection timed out", exception);
      }
   });

This almost works. Unfortunately, it is channel specific and not request specific. So as long as I’m communicating with the server, I’m fine. But 30 seconds after I am done, I get a ReadTimeoutException thrown. The problem is that it’s looking for any activity on the wire and not the request/response pairs that I care about.

Am I missing something here? Is there an inherent way of doing request timeouts using Camel+Netty or is there some way to make the ReadTimeoutException work?

(Camel 2.9.2/Netty 3.3.1)

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T12:05:27+00:00Added an answer on June 13, 2026 at 12:05 pm

    I’m not familiar with Camel but a quick look at the Mina and Netty components suggests that the required functionality is a feature of the Mina component, not Mina, and it’s missing from the Netty component. In camel trunk, the Mina producer has a code path for when sync is true, whereas the Netty producer doesn’t appear to have similar functionality. It might be worth taking the question to the camel mailing lists.

    A possible workaround is to create a custom Netty handler that is request / response aware, so you have a handler in your pipeline that starts a timer when the request is sent, and cancels the timer when the response is received.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a client-server application, in which the client communicates with the server using
I have a Flex application that connects to a BlazeDS server using the StreamingAMF
I have an application that requires to connect to MySQL database, I am using
We have an application that, amongst many other things, has an export to Excel
I have to develop a small application that will connect to a Linux server
I have an application that has 3 level of data depth: list of presentations
I have a simple Camel application that is tracing to a JMS endpoint. I
I have an client application that connects to the DB via the using clause.
I have an apache servicemix (camel 2.9) route which calls a bean, that in
I have given client's queue connection details to connect to it using Camel. While

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.