camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From SteveR <srichard...@vonage.com>
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:

*REQUIREMENTS:*

- 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
listeners
  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
with.

Any thoughts about whether or not this approach would work is greatly
appreciated.
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



from("netty4:tcp://host:port?serverInitializerFactory=#TCP_SERVER_PIPELINE_FACTORY")
	.to("seda:FILTER_QUEUE");


from("seda:FILTER_QUEUE?size=100000&concurrentConsumers=10&waitForTaskToComplete=Never&failIfNoConsumers=true&timeout=10000)
	.threads(threadPoolSize /*poolSize*/, threadPoolSize * 2 /*maxPoolSize*/)
	.filter()
		.method(filterBeanName, "isInterestingMessage")
		.to("seda:BALANCER_QUEUE");
	.end();


from("seda:BALANCER_QUEUE?size=100000&concurrentConsumers=10&waitForTaskToComplete=IfReplyExpected&failIfNoConsumers=true&timeout=10000)
	.loadBalance()
		.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",
"seda:TCP_LISTENER4")
	.end();


from("seda:TCP_LISTENER1?size=100000&concurrentConsumers=10&waitForTaskToComplete=Never&failIfNoConsumers=true&timeout=10000")
	.threads(threadPoolSize /*poolSize*/, threadPoolSize * 2 /*maxPoolSize*/)
	.to("netty4:tcp://host:port&options ...");


from("seda:TCP_LISTENER2?size=100000&concurrentConsumers=10&waitForTaskToComplete=Never&failIfNoConsumers=true&timeout=10000")
	.threads(threadPoolSize /*poolSize*/, threadPoolSize * 2 /*maxPoolSize*/)
	.to("netty4:tcp://host:port&options ...");


from("seda:TCP_LISTENER3?size=100000&concurrentConsumers=10&waitForTaskToComplete=Never&failIfNoConsumers=true&timeout=10000")
	.threads(threadPoolSize /*poolSize*/, threadPoolSize * 2 /*maxPoolSize*/)
	.to("netty4:tcp://host:port&options ...");


from("seda:TCP_LISTENER4?size=100000&concurrentConsumers=10&waitForTaskToComplete=Never&failIfNoConsumers=true&timeout=10000")
	.threads(threadPoolSize /*poolSize*/, threadPoolSize * 2 /*maxPoolSize*/)
	.to("netty4:tcp://host:port&options ...");



--
View this message in context: http://camel.465427.n5.nabble.com/Camel-Load-Balancer-EIP-with-TCP-Endpoints-tp5772104.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Mime
View raw message