How to maintain a seperate Datastructure to choose processor in my custom load balancer

2012-10-17 Thread kishorecj
Hi Sir,

  My requirement is ,
a group of tomcats are mapped to a particular appid and route should
happen based on incoming request  with appid .

  hashmap looks like 
  tomcat1
  app1 -   tomcat2
   tomcat3

   tomcat4
   app2 -   tomcat5

so if incoming request comes with appid=app1  then my custom loadbalancer
should route to one of tomcat1-tomcat3.

adding tomcat's will happen at runtime[dynamic adding support]. 
whenever a new tomcat gets added to a particular applicationid then i am
creating a HttpEndpoint processor and adding it in into hashmap.

when i get a request trying to get the processor and calling
processor.process(exchange).
but it is retrying 3 times and failing.

Please help me in solving this problem or share some idea where i might be
wrong.



--
View this message in context: 
http://camel.465427.n5.nabble.com/How-to-maintain-a-seperate-Datastructure-to-choose-processor-in-my-custom-load-balancer-tp5721214.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: How to maintain a seperate Datastructure to choose processor in my custom load balancer

2012-10-18 Thread Willem jiang
Hi,

I'm not sure how you create the process for the new created endpoint, you may 
need to start or stop the endpoint and producer yourself.
I think it could be much easy if you use the recipient-list[1] to change the 
endpoint dynamically.

[1]http://camel.apache.org/recipient-list.html 

-- 
Willem Jiang

Red Hat, Inc.
FuseSource is now part of Red Hat
Web: http://www.fusesource.com | http://www.redhat.com
Blog: http://willemjiang.blogspot.com (http://willemjiang.blogspot.com/) 
(English)
  http://jnn.javaeye.com (http://jnn.javaeye.com/) (Chinese)
Twitter: willemjiang 
Weibo: willemjiang





On Thursday, October 18, 2012 at 1:38 PM, kishorecj wrote:

> Hi Sir,
> 
> My requirement is ,
> a group of tomcats are mapped to a particular appid and route should
> happen based on incoming request with appid .
> 
> hashmap looks like 
> tomcat1
> app1 - tomcat2
> tomcat3
> 
> tomcat4
> app2 - tomcat5
> 
> so if incoming request comes with appid=app1 then my custom loadbalancer
> should route to one of tomcat1-tomcat3.
> 
> adding tomcat's will happen at runtime[dynamic adding support]. 
> whenever a new tomcat gets added to a particular applicationid then i am
> creating a HttpEndpoint processor and adding it in into hashmap.
> 
> when i get a request trying to get the processor and calling
> processor.process(exchange).
> but it is retrying 3 times and failing.
> 
> Please help me in solving this problem or share some idea where i might be
> wrong.
> 
> 
> 
> --
> View this message in context: 
> http://camel.465427.n5.nabble.com/How-to-maintain-a-seperate-Datastructure-to-choose-processor-in-my-custom-load-balancer-tp5721214.html
> Sent from the Camel - Users mailing list archive at Nabble.com 
> (http://Nabble.com).





Re: How to maintain a seperate Datastructure to choose processor in my custom load balancer

2012-10-18 Thread Claus Ibsen
On Thu, Oct 18, 2012 at 7:38 AM, kishorecj  wrote:
> Hi Sir,
>
>   My requirement is ,
> a group of tomcats are mapped to a particular appid and route should
> happen based on incoming request  with appid .
>
>   hashmap looks like
>   tomcat1
>   app1 -   tomcat2
>tomcat3
>
>tomcat4
>app2 -   tomcat5
>
> so if incoming request comes with appid=app1  then my custom loadbalancer
> should route to one of tomcat1-tomcat3.
>
> adding tomcat's will happen at runtime[dynamic adding support].
> whenever a new tomcat gets added to a particular applicationid then i am
> creating a HttpEndpoint processor and adding it in into hashmap.
>
> when i get a request trying to get the processor and calling
> processor.process(exchange).
> but it is retrying 3 times and failing.
>
> Please help me in solving this problem or share some idea where i might be
> wrong.
>

You can do this with a custom load balancer. And when a new tomcat is
added, then as you say create the endpoint, and then the producer, and
remember to start the producer.

And when you invoke process on the chosen producer, you may want to
have retry logic in case it fails. And maybe pickup another of the
tomcats within that group.

Some of that logic you can use the Camel error handler, where you can
let it retry the load balancer X number of times etc.

And btw when a tomcat is taking out, then you need to stop the
associated producer.

>
>
> --
> View this message in context: 
> http://camel.465427.n5.nabble.com/How-to-maintain-a-seperate-Datastructure-to-choose-processor-in-my-custom-load-balancer-tp5721214.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-
Red Hat, Inc.
FuseSource is now part of Red Hat
Email: cib...@redhat.com
Web: http://fusesource.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen


Re: How to maintain a seperate Datastructure to choose processor in my custom load balancer

2012-10-18 Thread Claus Ibsen
Another alternative is to use a dynamic router, or recipient list.
Instead of the load balancer.


On Thu, Oct 18, 2012 at 7:38 AM, kishorecj  wrote:
> Hi Sir,
>
>   My requirement is ,
> a group of tomcats are mapped to a particular appid and route should
> happen based on incoming request  with appid .
>
>   hashmap looks like
>   tomcat1
>   app1 -   tomcat2
>tomcat3
>
>tomcat4
>app2 -   tomcat5
>
> so if incoming request comes with appid=app1  then my custom loadbalancer
> should route to one of tomcat1-tomcat3.
>
> adding tomcat's will happen at runtime[dynamic adding support].
> whenever a new tomcat gets added to a particular applicationid then i am
> creating a HttpEndpoint processor and adding it in into hashmap.
>
> when i get a request trying to get the processor and calling
> processor.process(exchange).
> but it is retrying 3 times and failing.
>
> Please help me in solving this problem or share some idea where i might be
> wrong.
>
>
>
> --
> View this message in context: 
> http://camel.465427.n5.nabble.com/How-to-maintain-a-seperate-Datastructure-to-choose-processor-in-my-custom-load-balancer-tp5721214.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-
Red Hat, Inc.
FuseSource is now part of Red Hat
Email: cib...@redhat.com
Web: http://fusesource.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen