camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From SteveR <>
Subject Camel Load Balancer EIP with TCP Endpoints
Date Tue, 29 Sep 2015 14:48:20 GMT
I have a stand-alone Java application using Camel 2.15 and camel-netty4 which
is running on Linux RHEL6. I see that Camel supports a Load Balancer EIP and
I'm wondering if it would a good fit based on the following requirements for
my application:


- Accept various incoming TCP connections (each TCP feed consists of
messages that start with <MSG> and end with </MSG>). So I'll be using a
DelimiterBasedFrameDecoder in my TcpServerPipelineFactory.
- No policing/rejection of incoming TCP connection requests is required,
just accept each one that attempts to connect to the well-known listen port
for this application.

- Filter out uninteresting messages. I'll be using a filter bean for this.

- Uniformly distribute, via TCP, the interesting messages to a set of 4 TCP
  while failing over in round-robin fashion if a particular server is
unreachable for any reason.

- Maintain the TCP connections to the reachable servers (i.e. don't
  establish/tear-down a TCP connection for each transmitted message).

I was thinking that the Camel Load Balancer EIP with a failover policy and
the roundRobin option would be a good choice.  I'm hoping that the 4 routes
to the TCP listeners will be established by netty4 and stay connected!

Below is my Java DSL psuedo-code for the routes that I've initially come up

Any thoughts about whether or not this approach would work is greatly
I know there are lots of URI parameters to consider and I want to be sure
I'm not missing
any important ones. Also any ideas for making this application more robust,
fault tolerant,
and better-performing would be great!

    Thanks, SteveR


	.threads(threadPoolSize /*poolSize*/, threadPoolSize * 2 /*maxPoolSize*/)
		.method(filterBeanName, "isInterestingMessage")

		.failover(-1,    /* Never give up (i.e. continuously try to failover) */,
				  false, /* Do not inherit route's ErrorHandler */,
				  true   /* Operate in round-robin mode */)
		.to("seda:TCP_LISTENER1", "seda:TCP_LISTENER2", "seda:TCP_LISTENER3",

	.threads(threadPoolSize /*poolSize*/, threadPoolSize * 2 /*maxPoolSize*/)
	.to("netty4:tcp://host:port&options ...");

	.threads(threadPoolSize /*poolSize*/, threadPoolSize * 2 /*maxPoolSize*/)
	.to("netty4:tcp://host:port&options ...");

	.threads(threadPoolSize /*poolSize*/, threadPoolSize * 2 /*maxPoolSize*/)
	.to("netty4:tcp://host:port&options ...");

	.threads(threadPoolSize /*poolSize*/, threadPoolSize * 2 /*maxPoolSize*/)
	.to("netty4:tcp://host:port&options ...");

View this message in context:
Sent from the Camel - Users mailing list archive at

View raw message