You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by lb...@apache.org on 2017/04/13 06:54:49 UTC
camel git commit: Fix camel-ribbon documentation
Repository: camel
Updated Branches:
refs/heads/master 8a9a098f1 -> c4b3722a4
Fix camel-ribbon documentation
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/c4b3722a
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/c4b3722a
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/c4b3722a
Branch: refs/heads/master
Commit: c4b3722a49de7982faa5f9aa30bfe9aeb9cbcad9
Parents: 8a9a098
Author: lburgazzoli <lb...@gmail.com>
Authored: Thu Apr 13 08:54:12 2017 +0200
Committer: lburgazzoli <lb...@gmail.com>
Committed: Thu Apr 13 08:54:12 2017 +0200
----------------------------------------------------------------------
.../src/main/docs/ribbon-component.adoc | 64 +++++++++++++++-----
1 file changed, 48 insertions(+), 16 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/c4b3722a/components/camel-ribbon/src/main/docs/ribbon-component.adoc
----------------------------------------------------------------------
diff --git a/components/camel-ribbon/src/main/docs/ribbon-component.adoc b/components/camel-ribbon/src/main/docs/ribbon-component.adoc
index 9a189f4..c4b968d 100644
--- a/components/camel-ribbon/src/main/docs/ribbon-component.adoc
+++ b/components/camel-ribbon/src/main/docs/ribbon-component.adoc
@@ -8,40 +8,72 @@ Maven users will need to add the following dependency to their `pom.xml`
for this component:
[source,xml]
-------------------------------------------------------------
+----
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-ribbon</artifactId>
<version>x.x.x</version>
<!-- use the same version as your Camel core version -->
</dependency>
-------------------------------------------------------------
+----
-This component helps applying load balancing feature at the client side
-when using ServiceCall EIP.
+This component helps applying load balancing feature at the client side when using http://camel.apache.org/servicecall-eip.html[ServiceCall EIP].
-As you can see [ServiceCall EIP](http://camel.apache.org/servicecall-eip.html), ribbon
-makes use of http component for calling the remote service. The details of different protocols
-are outlined in the EIP page.
+#### Configuration
+* *Programmatic*
++
[source,java]
----------------------------------------
-StaticServiceDiscovery servers = new StaticServiceDiscovery();
-servers.addServer("localhost", 9090);
-servers.addServer("localhost", 9091);
-
+----
RibbonConfiguration configuration = new RibbonConfiguration();
+configuration.setClientConfig(Collections.singletonMap("ServerListRefreshInterval", "250"));
+
RibbonLoadBalancer loadBalancer = new RibbonLoadBalancer(configuration);
from("direct:start")
.serviceCall()
.name("myService")
.loadBalancer(loadBalancer)
- .serviceDiscovery(servers)
+ .consulServiceDiscovery()
.end()
.to("mock:result");
----------------------------------------
+----
+
+* *Spring Boot*
++
+[source,properties]
+.application.properties
+----
+camel.cloud.ribbon.client-config[ServerListRefreshInterval] = 250
+----
++
+[source,java]
+.routes
+----
+from("direct:start")
+ .serviceCall()
+ .name("myService")
+ .ribbonLoadBalancer()
+ .consulServiceDiscovery()
+ .end()
+ .to("mock:result");
+----
+
+* *XML*
++
+[source,xml]
+----
+<route>
+ <from uri="direct:start"/>
+ <serviceCall name="myService">
+ <!-- enable ribbon load balancer -->
+ <ribbonLoadBalancer>
+ <properties key="ServerListRefreshInterval" value="250"/>
+ </ribbonLoadBalancer>
+ </serviceCall>
+</route>
+----
-### See Also
+#### See Also
-* link:http://camel.apache.org/servicecall-eip.html[ServiceCall EIP]
\ No newline at end of file
+* link:http://camel.apache.org/servicecall-eip.html[ServiceCall EIP]