You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by re...@apache.org on 2016/07/16 15:53:34 UTC

[10/20] cxf git commit: Updating the demo to use a curcuit breaker feature

Updating the demo to use a curcuit breaker feature


Project: http://git-wip-us.apache.org/repos/asf/cxf/repo
Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/e2efd038
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/e2efd038
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/e2efd038

Branch: refs/heads/master-jaxrs-2.1
Commit: e2efd0386e210d162c7646f4a4f2aa15e9752924
Parents: df3854c
Author: Sergey Beryozkin <sb...@gmail.com>
Authored: Fri Jul 15 18:01:44 2016 +0300
Committer: Sergey Beryozkin <sb...@gmail.com>
Committed: Fri Jul 15 18:01:44 2016 +0300

----------------------------------------------------------------------
 .../samples/jax_rs/spring_boot_scan/application/pom.xml        | 6 ++++++
 .../java/sample/rs/client/SampleRestClientApplication.java     | 4 ++--
 .../circuitbreaker/CircuitBreakerFailoverFeature.java          | 6 ++++++
 3 files changed, 14 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/e2efd038/distribution/src/main/release/samples/jax_rs/spring_boot_scan/application/pom.xml
----------------------------------------------------------------------
diff --git a/distribution/src/main/release/samples/jax_rs/spring_boot_scan/application/pom.xml b/distribution/src/main/release/samples/jax_rs/spring_boot_scan/application/pom.xml
index 4473bbd..50c3f98 100644
--- a/distribution/src/main/release/samples/jax_rs/spring_boot_scan/application/pom.xml
+++ b/distribution/src/main/release/samples/jax_rs/spring_boot_scan/application/pom.xml
@@ -14,6 +14,7 @@
     
     <properties>
         <cxf.version>3.2.0-SNAPSHOT</cxf.version>
+        <cxf.zest.version>2.1</cxf.zest.version> 
         <spring.boot.version>1.3.6.RELEASE</spring.boot.version>
         <spring.cloud.eureka.version>1.1.3.RELEASE</spring.cloud.eureka.version>
     </properties>
@@ -45,6 +46,11 @@
             <artifactId>spring-boot-actuator</artifactId>
             <version>${spring.boot.version}</version>
         </dependency>
+        <dependency>
+            <groupId>org.qi4j.library</groupId>
+            <artifactId>org.qi4j.library.circuitbreaker</artifactId>
+            <version>${cxf.zest.version}</version>
+        </dependency>
     </dependencies>
     <profiles>
        <profile>

http://git-wip-us.apache.org/repos/asf/cxf/blob/e2efd038/distribution/src/main/release/samples/jax_rs/spring_boot_scan/application/src/main/java/sample/rs/client/SampleRestClientApplication.java
----------------------------------------------------------------------
diff --git a/distribution/src/main/release/samples/jax_rs/spring_boot_scan/application/src/main/java/sample/rs/client/SampleRestClientApplication.java b/distribution/src/main/release/samples/jax_rs/spring_boot_scan/application/src/main/java/sample/rs/client/SampleRestClientApplication.java
index 4ec4e60..660cec9 100644
--- a/distribution/src/main/release/samples/jax_rs/spring_boot_scan/application/src/main/java/sample/rs/client/SampleRestClientApplication.java
+++ b/distribution/src/main/release/samples/jax_rs/spring_boot_scan/application/src/main/java/sample/rs/client/SampleRestClientApplication.java
@@ -25,9 +25,9 @@ import javax.ws.rs.core.UriBuilder;
 
 import org.apache.cxf.annotations.Provider;
 import org.apache.cxf.annotations.Provider.Type;
-import org.apache.cxf.clustering.FailoverFeature;
 import org.apache.cxf.clustering.FailoverStrategy;
 import org.apache.cxf.clustering.RandomStrategy;
+import org.apache.cxf.clustering.circuitbreaker.CircuitBreakerFailoverFeature;
 import org.apache.cxf.jaxrs.client.spring.EnableJaxRsProxyClient;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.boot.CommandLineRunner;
@@ -69,7 +69,7 @@ public class SampleRestClientApplication {
      */
     @Component
     @Provider(Type.Feature)
-    static class EurekaFailoverFeature extends FailoverFeature {
+    static class EurekaFailoverFeature extends CircuitBreakerFailoverFeature {
         @Autowired
         DiscoveryClient discoveryClient;
         List<String> addresses = new LinkedList<String>();

http://git-wip-us.apache.org/repos/asf/cxf/blob/e2efd038/rt/features/clustering/src/main/java/org/apache/cxf/clustering/circuitbreaker/CircuitBreakerFailoverFeature.java
----------------------------------------------------------------------
diff --git a/rt/features/clustering/src/main/java/org/apache/cxf/clustering/circuitbreaker/CircuitBreakerFailoverFeature.java b/rt/features/clustering/src/main/java/org/apache/cxf/clustering/circuitbreaker/CircuitBreakerFailoverFeature.java
index 3a1b73c..bc37632 100644
--- a/rt/features/clustering/src/main/java/org/apache/cxf/clustering/circuitbreaker/CircuitBreakerFailoverFeature.java
+++ b/rt/features/clustering/src/main/java/org/apache/cxf/clustering/circuitbreaker/CircuitBreakerFailoverFeature.java
@@ -34,6 +34,12 @@ public class CircuitBreakerFailoverFeature extends FailoverFeature {
              CircuitBreakerTargetSelector.DEFAULT_TIMEOUT);
     }
     
+    public CircuitBreakerFailoverFeature(String clientBootstrapAddress) {
+        this(CircuitBreakerTargetSelector.DEFAULT_THESHOLD, 
+             CircuitBreakerTargetSelector.DEFAULT_TIMEOUT,
+             clientBootstrapAddress);
+    }
+    
     public CircuitBreakerFailoverFeature(int threshold, long timeout) {
         this.threshold = threshold;
         this.timeout = timeout;