On Sat, Apr 21, 2012 at 4:28 PM, Edwin <edwin.rabbi...@gmail.com> wrote: > Hi Folks, > > I'm using the Load Balancer EIP in a current project with a sticky policy. > The load balancer receives messages and based on header values places the > message onto one of 5 jms queues. > > The "happy path" is: the same messages are continuously received throughout > the day and messages are enqueued on the 5 jms queues > > A situation may arise where I will no longer receive a message with header > value = "foo" for a lengthy period of time. Previously when this message was > received the sticky load balancer sent the message to jms queue "A". Since > this message is no longer been received, no messages will be sent to queue > "A" anymore. If this happened, I would like to place queue "A" back as a > candidate with the sticky load balancer to receive new messages with a > different header type and maybe employ a least recently used policy for > removing messages on queue "A" in order to receive the new incoming > messages. > > I'm wondering if there is anything out of the box with the load balancer > that could help me achieve this or something close? > > Any insights into this would be great! >
You can use a bean as the expression on the sticky load balancer. You can keep that bean statefull, and then keep track how long time since a "foo" was last seen. And if it happens to be a long time, then you can use the A queue again. When using the method call expression in Camel for the bean expression, then Camel will create the bean instance once, and thus you can store state. Mind that for concurrency the state in the bean is shared, so you need to take care for those situations. > Thanks, > Edwin. > > -- > View this message in context: > http://camel.465427.n5.nabble.com/Load-Balancer-EIP-tp5656311p5656311.html > Sent from the Camel - Users mailing list archive at Nabble.com. -- Claus Ibsen ----------------- CamelOne 2012 Conference, May 15-16, 2012: http://camelone.com FuseSource Email: cib...@fusesource.com Web: http://fusesource.com Twitter: davsclaus, fusenews Blog: http://davsclaus.blogspot.com/ Author of Camel in Action: http://www.manning.com/ibsen/