camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Claus Ibsen" ...@silverbullet.dk>
Subject RE: How to route a message based on a criteria??
Date Thu, 17 Jul 2008 14:15:35 GMT
You also need to enable the session support on the jetty componet
http://activemq.apache.org/camel/jetty.html

sessionSupport=true

See this unit test:
http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpRouteTest.java?view=markup

The session stuff was reported in CAMEL-666

Then you need to process this in java code and get the HttpSession where you can get the session
id. Then you can store the session id on the exchange.in as a header with your own key.

process(Exchange exchange) {
.. get the http session and get the session id
exchange.getIn().setHeader("mysessionid", sessionId);
}

Then its *only* the loadbalancer part that is needed left ;)


Med venlig hilsen
 
Claus Ibsen
......................................
Silverbullet
Skovsgårdsvænget 21
8362 Hørning
Tlf. +45 2962 7576
Web: www.silverbullet.dk
-----Original Message-----
From: James Strachan [mailto:james.strachan@gmail.com] 
Sent: 17. juli 2008 14:25
To: camel-user@activemq.apache.org
Subject: Re: How to route a message based on a criteria??

Use an expression to define the sticky load balancer. Though the only
downside is there's no easy way to do that in XML :)

Ideally we'd have some XML like

<stickyLoadBalancer
id="foo"><xpath>/foo/bar</xpath></stickyLoadBalancer> but we've not go
that yet I'm afraid, so you'd have to write your own Factory Bean for
now to configure the Expression instance.


2008/7/17 buchnerm <markus.buchner@gmx.at>:
>
> Hi thanks for the reply but i think i need an sticky load balancer - so how
> can i define this one in xml to listen to the sessionid ??
>
> http://activemq.apache.org/camel/maven/camel-core/apidocs/org/apache/camel/processor/loadbalancer/StickyLoadBalancer.html
>
> greetings max
>
>
>
> buchnerm wrote:
>>
>> Hi I am trying to implement a small load balancer based on the session id
>>
>> so if sessionid % 3 = 0 --> send it to seda0
>> if sessionid % 3 = 1 --> send it to seda1
>> if sessionid % 3 = 2 --> send it to seda2
>>
>> is that possible?
>>
>> how to cnfigure this in spring xml??
>>
>> something like this but???
>> *********
>> <route>
>>             <from
>> uri="jetty:http://localhost:9090/GreeterContext/GreeterPort"/>
>>             <loadBalance ref="roundRobinRef">
>>               <to uri="direct:EndpointA"/>
>>               <to uri="direct:EndpointB"/>
>>             </loadBalance>
>>         </route>
>> *********
>>
>>
>>
>
> --
> View this message in context: http://www.nabble.com/How-to-route-a-message-based-on-a-criteria---tp18506590s22882p18506985.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>
>



-- 
James
-------
http://macstrac.blogspot.com/

Open Source Integration
http://open.iona.com

Mime
View raw message