You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by bob_sheknowdas <bo...@googlemail.com> on 2017/01/16 20:17:49 UTC

Load Balancing Fluent Builders vs Spring

Hi,

im trying to set up a load balancer using Apache Camel.

Everything works fine, if I use the spring configuration:

    <route id="route2">
      <from uri="servlet:///api2/data/?matchOnUriPrefix=true"/>
	  <loadBalance>
		<failover roundRobin="true" maximumFailoverAttempts="3"/>
		<to
uri="http://localhost:8080/api2/data/?bridgeEndpoint=true&amp;throwExceptionOnFailure=false"/>
	  </loadBalance>
    </route>

But if I try to use the RouteBuilder class i get Errors:

   
from("servlet:///api2/data/?matchOnUriPrefix=true").loadBalance().failover(3,
false, true)
       
.to("http://localhost:8080/api2/data/?bridgeEndpoint=true&amp;throwExceptionOnFailure=false");

The Error is an Http 500, so not really specific.
Has anyone an Idea, why that is?


Possible workaround:
I wanted to use the RouteBuilder class since I want to read in possible
target servers from a properties file. If anyone knows a way to do that via
spring I would be most happy to learn from you : )



--
View this message in context: http://camel.465427.n5.nabble.com/Load-Balancing-Fluent-Builders-vs-Spring-tp5792636.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Load Balancing Fluent Builders vs Spring

Posted by Minh Tran <da...@gmail.com>.
To use properties in spring xml, you can use BridgePropertyPlaceholderConfigurer documented here
http://camel.apache.org/using-propertyplaceholder.html <http://camel.apache.org/using-propertyplaceholder.html>
 
> On 17 Jan 2017, at 7:17 am, bob_sheknowdas <bo...@googlemail.com> wrote:
> 
> Hi,
> 
> im trying to set up a load balancer using Apache Camel.
> 
> Everything works fine, if I use the spring configuration:
> 
>    <route id="route2">
>      <from uri="servlet:///api2/data/?matchOnUriPrefix=true"/>
> 	  <loadBalance>
> 		<failover roundRobin="true" maximumFailoverAttempts="3"/>
> 		<to
> uri="http://localhost:8080/api2/data/?bridgeEndpoint=true&amp;throwExceptionOnFailure=false"/>
> 	  </loadBalance>
>    </route>
> 
> But if I try to use the RouteBuilder class i get Errors:
> 
> 
> from("servlet:///api2/data/?matchOnUriPrefix=true").loadBalance().failover(3,
> false, true)
> 
> .to("http://localhost:8080/api2/data/?bridgeEndpoint=true&amp;throwExceptionOnFailure=false");
> 
> The Error is an Http 500, so not really specific.
> Has anyone an Idea, why that is?
> 
> 
> Possible workaround:
> I wanted to use the RouteBuilder class since I want to read in possible
> target servers from a properties file. If anyone knows a way to do that via
> spring I would be most happy to learn from you : )
> 
> 
> 
> --
> View this message in context: http://camel.465427.n5.nabble.com/Load-Balancing-Fluent-Builders-vs-Spring-tp5792636.html
> Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Load Balancing Fluent Builders vs Spring

Posted by bob_sheknowdas <bo...@googlemail.com>.
Yep
Claus Ibsen-2 wrote
> In Java you need to use & and not &amp; for separate in query
> parameters. So check your to endpoint.
> 
> 
> -- 
> Claus Ibsen
> -----------------
> http://davsclaus.com @davsclaus
> Camel in Action 2: https://www.manning.com/ibsen2

Yes, that seems to have been the problem.
Thank you very much 


Minh Tran-2 wrote
> To use properties in spring xml, you can use
> BridgePropertyPlaceholderConfigurer documented here
> http://camel.apache.org/using-propertyplaceholder.html
> &lt;http://camel.apache.org/using-propertyplaceholder.html&gt;
>  

Very helpful aswell.
Thank you, too 



--
View this message in context: http://camel.465427.n5.nabble.com/Load-Balancing-Fluent-Builders-vs-Spring-tp5792636p5792669.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Load Balancing Fluent Builders vs Spring

Posted by Claus Ibsen <cl...@gmail.com>.
In Java you need to use & and not &amp; for separate in query
parameters. So check your to endpoint.

On Mon, Jan 16, 2017 at 9:17 PM, bob_sheknowdas <bo...@googlemail.com> wrote:
> Hi,
>
> im trying to set up a load balancer using Apache Camel.
>
> Everything works fine, if I use the spring configuration:
>
>     <route id="route2">
>       <from uri="servlet:///api2/data/?matchOnUriPrefix=true"/>
>           <loadBalance>
>                 <failover roundRobin="true" maximumFailoverAttempts="3"/>
>                 <to
> uri="http://localhost:8080/api2/data/?bridgeEndpoint=true&amp;throwExceptionOnFailure=false"/>
>           </loadBalance>
>     </route>
>
> But if I try to use the RouteBuilder class i get Errors:
>
>
> from("servlet:///api2/data/?matchOnUriPrefix=true").loadBalance().failover(3,
> false, true)
>
> .to("http://localhost:8080/api2/data/?bridgeEndpoint=true&amp;throwExceptionOnFailure=false");
>
> The Error is an Http 500, so not really specific.
> Has anyone an Idea, why that is?
>
>
> Possible workaround:
> I wanted to use the RouteBuilder class since I want to read in possible
> target servers from a properties file. If anyone knows a way to do that via
> spring I would be most happy to learn from you : )
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Load-Balancing-Fluent-Builders-vs-Spring-tp5792636.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-----------------
http://davsclaus.com @davsclaus
Camel in Action 2: https://www.manning.com/ibsen2