You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@dubbo.apache.org by vi...@apache.org on 2018/12/26 10:40:56 UTC

[incubator-dubbo-samples] branch samples-for-2.7.0-SNAPSHOT updated (e21930b -> 158bd22)

This is an automated email from the ASF dual-hosted git repository.

victory pushed a change to branch samples-for-2.7.0-SNAPSHOT
in repository https://gitbox.apache.org/repos/asf/incubator-dubbo-samples.git.


    from e21930b  update license
     new c8ab454  fix sample issue
     new 4cc7029  init resilience4j project
     new 560b787  Merge branch 'samples-for-2.7.0-SNAPSHOT' of github.com:dubbo/dubbo-samples into samples-for-2.7.0-SNAPSHOT
     new 158bd22  fix hystrix sample issue; add resilience sample

The 4 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 dubbo-samples-annotation/pom.xml                   |   7 +-
 .../samples/annotation/EmbeddedZooKeeper.java      | 255 ---------------------
 .../annotation/AnnotationConsumer.java             |   0
 .../hystrix}/annotation/AnnotationProvider.java    |   0
 .../hystrix}/annotation/EmbeddedZooKeeper.java     |   0
 .../annotation/action/AnnotationAction.java        |   0
 .../annotation/api/AnnotationService.java          |   0
 .../annotation/impl/AnnotationServiceImpl.java     |   0
 .../annotation/AnnotationConsumer.java             |   0
 .../hystrix}/annotation/AnnotationProvider.java    |   0
 .../annotation/EmbeddedZooKeeper.java              |   0
 .../samples/{ => hystrix}/annotation/ZKTools.java  |   0
 .../annotation/action/AnnotationAction.java        |   0
 .../hystrix}/annotation/api/AnnotationService.java |   0
 .../annotation/impl/AnnotationServiceImpl.java     |   0
 .../annotation/AnnotationConsumer.java             |   0
 .../annotation/AnnotationProvider.java             |   0
 .../annotation/EmbeddedZooKeeper.java              |   0
 .../samples/{ => hystrix}/annotation/ZKTools.java  |   0
 .../annotation/action/AnnotationAction.java        |   0
 .../annotation/api/AnnotationService.java          |   0
 .../annotation/impl/AnnotationServiceImpl.java     |   0
 .../src/main/resources/spring/merge-consumer.xml   |   4 +-
 .../README.md                                      |   0
 .../dubbo-samples-resilience4j-filter}/README.md   |   0
 .../dubbo-samples-resilience4j-filter}/pom.xml     |  39 ++--
 .../samples/resilience4j}/EmbeddedZooKeeper.java   |  12 +-
 .../Resilience4jAnnotationConsumer.java            |  20 +-
 .../Resilience4jAnnotationProvider.java            |  15 +-
 .../resilience4j}/action/AnnotationAction.java     |   8 +-
 .../resilience4j}/api/AnnotationService.java       |   2 +-
 .../resilience4j/api/CircuitBreakerService.java    |   7 +
 .../resilience4j/api/RateLimiterService.java       |   7 +
 .../filter/Resilience4jCircuitBreakerFilter.java   |  42 ++++
 .../filter/Resilience4jRateLimiterFilter.java      |  42 ++++
 .../resilience4j}/impl/AnnotationServiceImpl.java  |  10 +-
 .../impl/CircuitBreakerServiceImpl.java            |   7 +
 .../resilience4j/impl/RateLimiterServiceImpl.java  |   7 +
 .../META-INF/dubbo/org.apache.dubbo.rpc.Filter     |   0
 .../src/main/resources/log4j.properties            |   0
 .../resources/spring/dubbo-consumer.properties     |   0
 .../resources/spring/dubbo-provider.properties     |   0
 .../README.md                                      |   0
 .../pom.xml                                        |  39 ++--
 .../samples/resilience4j}/EmbeddedZooKeeper.java   |  12 +-
 .../Resilience4jBootAnnotationConsumer.java        |  20 +-
 .../Resilience4jBootAnnotationProvider.java        |  13 +-
 .../resilience4j}/action/AnnotationAction.java     |   8 +-
 .../resilience4j}/api/AnnotationService.java       |   2 +-
 .../resilience4j}/impl/AnnotationServiceImpl.java  |  10 +-
 .../src/main/resources/log4j.properties            |   0
 .../resources/spring/dubbo-consumer.properties     |   0
 .../resources/spring/dubbo-provider.properties     |   0
 .../pom.xml                                        |  11 +-
 dubbo-samples-spring-hystrix/README.md             |   4 +-
 .../hystrix/annotation}/EmbeddedZooKeeper.java     |  12 +-
 .../annotation/HystrixAnnotationConsumer.java}     |  15 +-
 .../annotation/HystrixAnnotationProvider.java}     |  13 +-
 .../annotation/action/AnnotationAction.java        |   4 +-
 .../hystrix}/annotation/api/AnnotationService.java |   2 +-
 .../annotation/impl/AnnotationServiceImpl.java     |   6 +-
 .../spring/hystrix-dubbo-consumer.properties       |  10 +-
 .../spring/hystrix-dubbo-provider.properties       |  10 +-
 pom.xml                                            |   1 +
 64 files changed, 279 insertions(+), 397 deletions(-)
 delete mode 100644 dubbo-samples-annotation/src/main/java/org/apache/dubbo/samples/annotation/EmbeddedZooKeeper.java
 rename dubbo-samples-annotation/src/main/java/org/apache/dubbo/samples/{ => hystrix}/annotation/AnnotationConsumer.java (100%)
 rename {dubbo-samples-configcenter/dubbo-samples-configcenter-annotation/src/main/java/org/apache/dubbo/samples => dubbo-samples-annotation/src/main/java/org/apache/dubbo/samples/hystrix}/annotation/AnnotationProvider.java (100%)
 rename {dubbo-samples-spring-hystrix/src/main/java/org/apache/dubbo/samples => dubbo-samples-annotation/src/main/java/org/apache/dubbo/samples/hystrix}/annotation/EmbeddedZooKeeper.java (100%)
 rename dubbo-samples-annotation/src/main/java/org/apache/dubbo/samples/{ => hystrix}/annotation/action/AnnotationAction.java (100%)
 copy dubbo-samples-annotation/src/main/java/org/apache/dubbo/samples/{ => hystrix}/annotation/api/AnnotationService.java (100%)
 rename dubbo-samples-annotation/src/main/java/org/apache/dubbo/samples/{ => hystrix}/annotation/impl/AnnotationServiceImpl.java (100%)
 rename dubbo-samples-configcenter/dubbo-samples-configcenter-annotation/src/main/java/org/apache/dubbo/samples/{ => hystrix}/annotation/AnnotationConsumer.java (100%)
 rename {dubbo-samples-annotation/src/main/java/org/apache/dubbo/samples => dubbo-samples-configcenter/dubbo-samples-configcenter-annotation/src/main/java/org/apache/dubbo/samples/hystrix}/annotation/AnnotationProvider.java (100%)
 rename dubbo-samples-configcenter/dubbo-samples-configcenter-annotation/src/main/java/org/apache/dubbo/samples/{ => hystrix}/annotation/EmbeddedZooKeeper.java (100%)
 rename dubbo-samples-configcenter/dubbo-samples-configcenter-annotation/src/main/java/org/apache/dubbo/samples/{ => hystrix}/annotation/ZKTools.java (100%)
 rename dubbo-samples-configcenter/dubbo-samples-configcenter-annotation/src/main/java/org/apache/dubbo/samples/{ => hystrix}/annotation/action/AnnotationAction.java (100%)
 rename {dubbo-samples-spring-hystrix/src/main/java/org/apache/dubbo/samples => dubbo-samples-configcenter/dubbo-samples-configcenter-annotation/src/main/java/org/apache/dubbo/samples/hystrix}/annotation/api/AnnotationService.java (100%)
 rename dubbo-samples-configcenter/dubbo-samples-configcenter-annotation/src/main/java/org/apache/dubbo/samples/{ => hystrix}/annotation/impl/AnnotationServiceImpl.java (100%)
 rename dubbo-samples-configcenter/dubbo-samples-configcenter-multi-registries/src/main/java/org/apache/dubbo/samples/{ => hystrix}/annotation/AnnotationConsumer.java (100%)
 rename dubbo-samples-configcenter/dubbo-samples-configcenter-multi-registries/src/main/java/org/apache/dubbo/samples/{ => hystrix}/annotation/AnnotationProvider.java (100%)
 rename dubbo-samples-configcenter/dubbo-samples-configcenter-multi-registries/src/main/java/org/apache/dubbo/samples/{ => hystrix}/annotation/EmbeddedZooKeeper.java (100%)
 rename dubbo-samples-configcenter/dubbo-samples-configcenter-multi-registries/src/main/java/org/apache/dubbo/samples/{ => hystrix}/annotation/ZKTools.java (100%)
 rename dubbo-samples-configcenter/dubbo-samples-configcenter-multi-registries/src/main/java/org/apache/dubbo/samples/{ => hystrix}/annotation/action/AnnotationAction.java (100%)
 rename dubbo-samples-configcenter/dubbo-samples-configcenter-multi-registries/src/main/java/org/apache/dubbo/samples/{ => hystrix}/annotation/api/AnnotationService.java (100%)
 rename dubbo-samples-configcenter/dubbo-samples-configcenter-multi-registries/src/main/java/org/apache/dubbo/samples/{ => hystrix}/annotation/impl/AnnotationServiceImpl.java (100%)
 copy {dubbo-samples-spring-hystrix => dubbo-samples-resilience4j}/README.md (100%)
 copy {dubbo-samples-spring-hystrix => dubbo-samples-resilience4j/dubbo-samples-resilience4j-filter}/README.md (100%)
 copy {dubbo-samples-spring-hystrix => dubbo-samples-resilience4j/dubbo-samples-resilience4j-filter}/pom.xml (57%)
 copy {dubbo-samples-generic-call/src/main/java/org/apache/dubbo/samples/generic/call => dubbo-samples-resilience4j/dubbo-samples-resilience4j-filter/src/main/java/org/apache/dubbo/samples/resilience4j}/EmbeddedZooKeeper.java (99%)
 copy dubbo-samples-spring-hystrix/src/main/java/org/apache/dubbo/samples/annotation/AnnotationConsumer.java => dubbo-samples-resilience4j/dubbo-samples-resilience4j-filter/src/main/java/org/apache/dubbo/samples/resilience4j/Resilience4jAnnotationConsumer.java (78%)
 copy dubbo-samples-spring-hystrix/src/main/java/org/apache/dubbo/samples/annotation/AnnotationProvider.java => dubbo-samples-resilience4j/dubbo-samples-resilience4j-filter/src/main/java/org/apache/dubbo/samples/resilience4j/Resilience4jAnnotationProvider.java (84%)
 copy {dubbo-samples-spring-hystrix/src/main/java/org/apache/dubbo/samples/annotation => dubbo-samples-resilience4j/dubbo-samples-resilience4j-filter/src/main/java/org/apache/dubbo/samples/resilience4j}/action/AnnotationAction.java (83%)
 rename {dubbo-samples-configcenter/dubbo-samples-configcenter-annotation/src/main/java/org/apache/dubbo/samples/annotation => dubbo-samples-resilience4j/dubbo-samples-resilience4j-filter/src/main/java/org/apache/dubbo/samples/resilience4j}/api/AnnotationService.java (93%)
 create mode 100644 dubbo-samples-resilience4j/dubbo-samples-resilience4j-filter/src/main/java/org/apache/dubbo/samples/resilience4j/api/CircuitBreakerService.java
 create mode 100644 dubbo-samples-resilience4j/dubbo-samples-resilience4j-filter/src/main/java/org/apache/dubbo/samples/resilience4j/api/RateLimiterService.java
 create mode 100644 dubbo-samples-resilience4j/dubbo-samples-resilience4j-filter/src/main/java/org/apache/dubbo/samples/resilience4j/filter/Resilience4jCircuitBreakerFilter.java
 create mode 100644 dubbo-samples-resilience4j/dubbo-samples-resilience4j-filter/src/main/java/org/apache/dubbo/samples/resilience4j/filter/Resilience4jRateLimiterFilter.java
 copy {dubbo-samples-spring-hystrix/src/main/java/org/apache/dubbo/samples/annotation => dubbo-samples-resilience4j/dubbo-samples-resilience4j-filter/src/main/java/org/apache/dubbo/samples/resilience4j}/impl/AnnotationServiceImpl.java (70%)
 create mode 100644 dubbo-samples-resilience4j/dubbo-samples-resilience4j-filter/src/main/java/org/apache/dubbo/samples/resilience4j/impl/CircuitBreakerServiceImpl.java
 create mode 100644 dubbo-samples-resilience4j/dubbo-samples-resilience4j-filter/src/main/java/org/apache/dubbo/samples/resilience4j/impl/RateLimiterServiceImpl.java
 copy dubbo-samples-docker/src/main/resources/application.properties => dubbo-samples-resilience4j/dubbo-samples-resilience4j-filter/src/main/resources/META-INF/dubbo/org.apache.dubbo.rpc.Filter (100%)
 copy {dubbo-samples-stub => dubbo-samples-resilience4j/dubbo-samples-resilience4j-filter}/src/main/resources/log4j.properties (100%)
 copy {dubbo-samples-spring-hystrix => dubbo-samples-resilience4j/dubbo-samples-resilience4j-filter}/src/main/resources/spring/dubbo-consumer.properties (100%)
 copy {dubbo-samples-spring-hystrix => dubbo-samples-resilience4j/dubbo-samples-resilience4j-filter}/src/main/resources/spring/dubbo-provider.properties (100%)
 copy {dubbo-samples-spring-hystrix => dubbo-samples-resilience4j/dubbo-samples-resilience4j-springboot2}/README.md (100%)
 copy {dubbo-samples-spring-hystrix => dubbo-samples-resilience4j/dubbo-samples-resilience4j-springboot2}/pom.xml (57%)
 copy {dubbo-samples-generic-call/src/main/java/org/apache/dubbo/samples/generic/call => dubbo-samples-resilience4j/dubbo-samples-resilience4j-springboot2/src/main/java/org/apache/dubbo/samples/resilience4j}/EmbeddedZooKeeper.java (99%)
 copy dubbo-samples-spring-hystrix/src/main/java/org/apache/dubbo/samples/annotation/AnnotationConsumer.java => dubbo-samples-resilience4j/dubbo-samples-resilience4j-springboot2/src/main/java/org/apache/dubbo/samples/resilience4j/Resilience4jBootAnnotationConsumer.java (78%)
 copy dubbo-samples-spring-hystrix/src/main/java/org/apache/dubbo/samples/annotation/AnnotationProvider.java => dubbo-samples-resilience4j/dubbo-samples-resilience4j-springboot2/src/main/java/org/apache/dubbo/samples/resilience4j/Resilience4jBootAnnotationProvider.java (85%)
 copy {dubbo-samples-spring-hystrix/src/main/java/org/apache/dubbo/samples/annotation => dubbo-samples-resilience4j/dubbo-samples-resilience4j-springboot2/src/main/java/org/apache/dubbo/samples/resilience4j}/action/AnnotationAction.java (83%)
 copy {dubbo-samples-annotation/src/main/java/org/apache/dubbo/samples/annotation => dubbo-samples-resilience4j/dubbo-samples-resilience4j-springboot2/src/main/java/org/apache/dubbo/samples/resilience4j}/api/AnnotationService.java (94%)
 copy {dubbo-samples-spring-hystrix/src/main/java/org/apache/dubbo/samples/annotation => dubbo-samples-resilience4j/dubbo-samples-resilience4j-springboot2/src/main/java/org/apache/dubbo/samples/resilience4j}/impl/AnnotationServiceImpl.java (70%)
 copy {dubbo-samples-stub => dubbo-samples-resilience4j/dubbo-samples-resilience4j-springboot2}/src/main/resources/log4j.properties (100%)
 rename {dubbo-samples-spring-hystrix => dubbo-samples-resilience4j/dubbo-samples-resilience4j-springboot2}/src/main/resources/spring/dubbo-consumer.properties (100%)
 rename {dubbo-samples-spring-hystrix => dubbo-samples-resilience4j/dubbo-samples-resilience4j-springboot2}/src/main/resources/spring/dubbo-provider.properties (100%)
 copy {dubbo-samples-generic-call => dubbo-samples-resilience4j}/pom.xml (79%)
 copy {dubbo-samples-generic-call/src/main/java/org/apache/dubbo/samples/generic/call => dubbo-samples-spring-hystrix/src/main/java/org/apache/dubbo/samples/hystrix/annotation}/EmbeddedZooKeeper.java (99%)
 rename dubbo-samples-spring-hystrix/src/main/java/org/apache/dubbo/samples/{annotation/AnnotationConsumer.java => hystrix/annotation/HystrixAnnotationConsumer.java} (83%)
 rename dubbo-samples-spring-hystrix/src/main/java/org/apache/dubbo/samples/{annotation/AnnotationProvider.java => hystrix/annotation/HystrixAnnotationProvider.java} (84%)
 rename dubbo-samples-spring-hystrix/src/main/java/org/apache/dubbo/samples/{ => hystrix}/annotation/action/AnnotationAction.java (91%)
 rename {dubbo-samples-annotation/src/main/java/org/apache/dubbo/samples => dubbo-samples-spring-hystrix/src/main/java/org/apache/dubbo/samples/hystrix}/annotation/api/AnnotationService.java (94%)
 rename dubbo-samples-spring-hystrix/src/main/java/org/apache/dubbo/samples/{ => hystrix}/annotation/impl/AnnotationServiceImpl.java (89%)
 copy dubbo-samples-annotation/src/main/resources/spring/dubbo-consumer.properties => dubbo-samples-spring-hystrix/src/main/resources/spring/hystrix-dubbo-consumer.properties (90%)
 copy dubbo-samples-annotation/src/main/resources/spring/dubbo-provider.properties => dubbo-samples-spring-hystrix/src/main/resources/spring/hystrix-dubbo-provider.properties (91%)


[incubator-dubbo-samples] 04/04: fix hystrix sample issue; add resilience sample

Posted by vi...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

victory pushed a commit to branch samples-for-2.7.0-SNAPSHOT
in repository https://gitbox.apache.org/repos/asf/incubator-dubbo-samples.git

commit 158bd22d42fa92c4b073c50820246c9d463e8729
Author: cvictory <sh...@gmail.com>
AuthorDate: Wed Dec 26 18:36:40 2018 +0800

    fix hystrix sample issue; add resilience sample
---
 .../samples/annotation/EmbeddedZooKeeper.java      | 255 ---------------------
 .../annotation/AnnotationConsumer.java             |   0
 .../hystrix}/annotation/AnnotationProvider.java    |   0
 .../hystrix}/annotation/EmbeddedZooKeeper.java     |   0
 .../annotation/action/AnnotationAction.java        |   0
 .../annotation/api/AnnotationService.java          |   0
 .../annotation/impl/AnnotationServiceImpl.java     |   0
 .../samples/annotation/api/AnnotationService.java  |  29 ---
 .../annotation/AnnotationConsumer.java             |   0
 .../hystrix}/annotation/AnnotationProvider.java    |   0
 .../annotation/EmbeddedZooKeeper.java              |   0
 .../samples/{ => hystrix}/annotation/ZKTools.java  |   0
 .../annotation/action/AnnotationAction.java        |   0
 .../hystrix}/annotation/api/AnnotationService.java |   0
 .../annotation/impl/AnnotationServiceImpl.java     |   0
 .../annotation/AnnotationConsumer.java             |   0
 .../annotation/AnnotationProvider.java             |   0
 .../annotation/EmbeddedZooKeeper.java              |   0
 .../samples/{ => hystrix}/annotation/ZKTools.java  |   0
 .../annotation/action/AnnotationAction.java        |   0
 .../annotation/api/AnnotationService.java          |   0
 .../annotation/impl/AnnotationServiceImpl.java     |   0
 .../samples/resilience4j/AnnotationConsumer.java   |  63 -----
 .../samples/resilience4j/AnnotationProvider.java   |  61 -----
 .../Resilience4jAnnotationConsumer.java}           |   5 -
 .../Resilience4jAnnotationProvider.java}           |   2 +-
 .../resilience4j/api/CircuitBreakerService.java    |   7 +
 .../resilience4j/api/RateLimiterService.java       |   7 +
 .../filter/Resilience4jRateLimiterFilter.java}     |   0
 .../impl/CircuitBreakerServiceImpl.java            |   7 +
 .../resilience4j/impl/RateLimiterServiceImpl.java  |   7 +
 .../META-INF/dubbo/org.apache.dubbo.rpc.Filter     |   0
 ...ava => Resilience4jBootAnnotationConsumer.java} |   5 -
 .../Resilience4jBootAnnotationProvider.java}       |   0
 .../filter/Resilience4jCircuitBreakerFilter.java   |  42 ----
 .../resilience4j/action/AnnotationAction.java      |  46 ----
 .../resilience4j/impl/AnnotationServiceImpl.java   |  40 ----
 .../src/main/resources/log4j.properties            |  26 ---
 .../resources/spring/dubbo-consumer.properties     |  22 --
 .../resources/spring/dubbo-provider.properties     |  23 --
 dubbo-samples-spring-hystrix/README.md             |   4 +-
 .../hystrix/annotation}/EmbeddedZooKeeper.java     |   2 +-
 .../annotation/HystrixAnnotationConsumer.java}     |  15 +-
 .../annotation/HystrixAnnotationProvider.java}     |  13 +-
 .../annotation/action/AnnotationAction.java        |   4 +-
 .../hystrix/annotation}/api/AnnotationService.java |   2 +-
 .../annotation/impl/AnnotationServiceImpl.java     |   6 +-
 ...roperties => hystrix-dubbo-consumer.properties} |  10 +-
 ...roperties => hystrix-dubbo-provider.properties} |  10 +-
 49 files changed, 61 insertions(+), 652 deletions(-)

diff --git a/dubbo-samples-annotation/src/main/java/org/apache/dubbo/samples/annotation/EmbeddedZooKeeper.java b/dubbo-samples-annotation/src/main/java/org/apache/dubbo/samples/annotation/EmbeddedZooKeeper.java
deleted file mode 100644
index 3d83b5b..0000000
--- a/dubbo-samples-annotation/src/main/java/org/apache/dubbo/samples/annotation/EmbeddedZooKeeper.java
+++ /dev/null
@@ -1,255 +0,0 @@
-/*
- * Copyright 2014 the original author or authors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.dubbo.samples.annotation;
-
-import java.io.File;
-import java.lang.reflect.Method;
-import java.util.Properties;
-import java.util.UUID;
-
-import org.apache.zookeeper.server.ServerConfig;
-import org.apache.zookeeper.server.ZooKeeperServerMain;
-import org.apache.zookeeper.server.quorum.QuorumPeerConfig;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.context.SmartLifecycle;
-import org.springframework.util.ErrorHandler;
-import org.springframework.util.SocketUtils;
-
-/**
- * from: https://github.com/spring-projects/spring-xd/blob/v1.3.1.RELEASE/spring-xd-dirt/src/main/java/org/springframework/xd/dirt/zookeeper/ZooKeeperUtils.java
- *
- * Helper class to start an embedded instance of standalone (non clustered) ZooKeeper.
- *
- * NOTE: at least an external standalone server (if not an ensemble) are recommended, even for
- * {@link org.springframework.xd.dirt.server.singlenode.SingleNodeApplication}
- *
- * @author Patrick Peralta
- * @author Mark Fisher
- * @author David Turanski
- */
-public class EmbeddedZooKeeper implements SmartLifecycle {
-
-    /**
-     * Logger.
-     */
-    private static final Logger logger = LoggerFactory.getLogger(EmbeddedZooKeeper.class);
-
-    /**
-     * ZooKeeper client port. This will be determined dynamically upon startup.
-     */
-    private final int clientPort;
-
-    /**
-     * Whether to auto-start. Default is true.
-     */
-    private boolean autoStartup = true;
-
-    /**
-     * Lifecycle phase. Default is 0.
-     */
-    private int phase = 0;
-
-    /**
-     * Thread for running the ZooKeeper server.
-     */
-    private volatile Thread zkServerThread;
-
-    /**
-     * ZooKeeper server.
-     */
-    private volatile ZooKeeperServerMain zkServer;
-
-    /**
-     * {@link ErrorHandler} to be invoked if an Exception is thrown from the ZooKeeper server thread.
-     */
-    private ErrorHandler errorHandler;
-
-    private boolean daemon = true;
-
-    /**
-     * Construct an EmbeddedZooKeeper with a random port.
-     */
-    public EmbeddedZooKeeper() {
-        clientPort = SocketUtils.findAvailableTcpPort();
-    }
-
-    /**
-     * Construct an EmbeddedZooKeeper with the provided port.
-     *
-     * @param clientPort  port for ZooKeeper server to bind to
-     */
-    public EmbeddedZooKeeper(int clientPort, boolean daemon) {
-        this.clientPort = clientPort;
-        this.daemon = daemon;
-    }
-
-    /**
-     * Returns the port that clients should use to connect to this embedded server.
-     *
-     * @return dynamically determined client port
-     */
-    public int getClientPort() {
-        return this.clientPort;
-    }
-
-    /**
-     * Specify whether to start automatically. Default is true.
-     *
-     * @param autoStartup whether to start automatically
-     */
-    public void setAutoStartup(boolean autoStartup) {
-        this.autoStartup = autoStartup;
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public boolean isAutoStartup() {
-        return this.autoStartup;
-    }
-
-    /**
-     * Specify the lifecycle phase for the embedded server.
-     *
-     * @param phase the lifecycle phase
-     */
-    public void setPhase(int phase) {
-        this.phase = phase;
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public int getPhase() {
-        return this.phase;
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public boolean isRunning() {
-        return (zkServerThread != null);
-    }
-
-    /**
-     * Start the ZooKeeper server in a background thread.
-     * <p>
-     * Register an error handler via {@link #setErrorHandler} in order to handle
-     * any exceptions thrown during startup or execution.
-     */
-    @Override
-    public synchronized void start() {
-        if (zkServerThread == null) {
-            zkServerThread = new Thread(new ServerRunnable(), "ZooKeeper Server Starter");
-            zkServerThread.setDaemon(daemon);
-            zkServerThread.start();
-        }
-    }
-
-    /**
-     * Shutdown the ZooKeeper server.
-     */
-    @Override
-    public synchronized void stop() {
-        if (zkServerThread != null) {
-            // The shutdown method is protected...thus this hack to invoke it.
-            // This will log an exception on shutdown; see
-            // https://issues.apache.org/jira/browse/ZOOKEEPER-1873 for details.
-            try {
-                Method shutdown = ZooKeeperServerMain.class.getDeclaredMethod("shutdown");
-                shutdown.setAccessible(true);
-                shutdown.invoke(zkServer);
-            }
-
-            catch (Exception e) {
-                throw new RuntimeException(e);
-            }
-
-            // It is expected that the thread will exit after
-            // the server is shutdown; this will block until
-            // the shutdown is complete.
-            try {
-                zkServerThread.join(5000);
-                zkServerThread = null;
-            }
-            catch (InterruptedException e) {
-                Thread.currentThread().interrupt();
-                logger.warn("Interrupted while waiting for embedded ZooKeeper to exit");
-                // abandoning zk thread
-                zkServerThread = null;
-            }
-        }
-    }
-
-    /**
-     * Stop the server if running and invoke the callback when complete.
-     */
-    @Override
-    public void stop(Runnable callback) {
-        stop();
-        callback.run();
-    }
-
-    /**
-     * Provide an {@link ErrorHandler} to be invoked if an Exception is thrown from the ZooKeeper server thread. If none
-     * is provided, only error-level logging will occur.
-     *
-     * @param errorHandler the {@link ErrorHandler} to be invoked
-     */
-    public void setErrorHandler(ErrorHandler errorHandler) {
-        this.errorHandler = errorHandler;
-    }
-
-    /**
-     * Runnable implementation that starts the ZooKeeper server.
-     */
-    private class ServerRunnable implements Runnable {
-
-        @Override
-        public void run() {
-            try {
-                Properties properties = new Properties();
-                File file = new File(System.getProperty("java.io.tmpdir")
-                    + File.separator + UUID.randomUUID());
-                file.deleteOnExit();
-                properties.setProperty("dataDir", file.getAbsolutePath());
-                properties.setProperty("clientPort", String.valueOf(clientPort));
-
-                QuorumPeerConfig quorumPeerConfig = new QuorumPeerConfig();
-                quorumPeerConfig.parseProperties(properties);
-
-                zkServer = new ZooKeeperServerMain();
-                ServerConfig configuration = new ServerConfig();
-                configuration.readFrom(quorumPeerConfig);
-
-                zkServer.runFromConfig(configuration);
-            }
-            catch (Exception e) {
-                if (errorHandler != null) {
-                    errorHandler.handleError(e);
-                }
-                else {
-                    logger.error("Exception running embedded ZooKeeper", e);
-                }
-            }
-        }
-    }
-
-}
\ No newline at end of file
diff --git a/dubbo-samples-annotation/src/main/java/org/apache/dubbo/samples/annotation/AnnotationConsumer.java b/dubbo-samples-annotation/src/main/java/org/apache/dubbo/samples/hystrix/annotation/AnnotationConsumer.java
similarity index 100%
rename from dubbo-samples-annotation/src/main/java/org/apache/dubbo/samples/annotation/AnnotationConsumer.java
rename to dubbo-samples-annotation/src/main/java/org/apache/dubbo/samples/hystrix/annotation/AnnotationConsumer.java
diff --git a/dubbo-samples-configcenter/dubbo-samples-configcenter-annotation/src/main/java/org/apache/dubbo/samples/annotation/AnnotationProvider.java b/dubbo-samples-annotation/src/main/java/org/apache/dubbo/samples/hystrix/annotation/AnnotationProvider.java
similarity index 100%
rename from dubbo-samples-configcenter/dubbo-samples-configcenter-annotation/src/main/java/org/apache/dubbo/samples/annotation/AnnotationProvider.java
rename to dubbo-samples-annotation/src/main/java/org/apache/dubbo/samples/hystrix/annotation/AnnotationProvider.java
diff --git a/dubbo-samples-spring-hystrix/src/main/java/org/apache/dubbo/samples/annotation/EmbeddedZooKeeper.java b/dubbo-samples-annotation/src/main/java/org/apache/dubbo/samples/hystrix/annotation/EmbeddedZooKeeper.java
similarity index 100%
rename from dubbo-samples-spring-hystrix/src/main/java/org/apache/dubbo/samples/annotation/EmbeddedZooKeeper.java
rename to dubbo-samples-annotation/src/main/java/org/apache/dubbo/samples/hystrix/annotation/EmbeddedZooKeeper.java
diff --git a/dubbo-samples-annotation/src/main/java/org/apache/dubbo/samples/annotation/action/AnnotationAction.java b/dubbo-samples-annotation/src/main/java/org/apache/dubbo/samples/hystrix/annotation/action/AnnotationAction.java
similarity index 100%
rename from dubbo-samples-annotation/src/main/java/org/apache/dubbo/samples/annotation/action/AnnotationAction.java
rename to dubbo-samples-annotation/src/main/java/org/apache/dubbo/samples/hystrix/annotation/action/AnnotationAction.java
diff --git a/dubbo-samples-annotation/src/main/java/org/apache/dubbo/samples/annotation/api/AnnotationService.java b/dubbo-samples-annotation/src/main/java/org/apache/dubbo/samples/hystrix/annotation/api/AnnotationService.java
similarity index 100%
rename from dubbo-samples-annotation/src/main/java/org/apache/dubbo/samples/annotation/api/AnnotationService.java
rename to dubbo-samples-annotation/src/main/java/org/apache/dubbo/samples/hystrix/annotation/api/AnnotationService.java
diff --git a/dubbo-samples-annotation/src/main/java/org/apache/dubbo/samples/annotation/impl/AnnotationServiceImpl.java b/dubbo-samples-annotation/src/main/java/org/apache/dubbo/samples/hystrix/annotation/impl/AnnotationServiceImpl.java
similarity index 100%
rename from dubbo-samples-annotation/src/main/java/org/apache/dubbo/samples/annotation/impl/AnnotationServiceImpl.java
rename to dubbo-samples-annotation/src/main/java/org/apache/dubbo/samples/hystrix/annotation/impl/AnnotationServiceImpl.java
diff --git a/dubbo-samples-configcenter/dubbo-samples-configcenter-annotation/src/main/java/org/apache/dubbo/samples/annotation/api/AnnotationService.java b/dubbo-samples-configcenter/dubbo-samples-configcenter-annotation/src/main/java/org/apache/dubbo/samples/annotation/api/AnnotationService.java
deleted file mode 100644
index 8378798..0000000
--- a/dubbo-samples-configcenter/dubbo-samples-configcenter-annotation/src/main/java/org/apache/dubbo/samples/annotation/api/AnnotationService.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- *
- *   Licensed to the Apache Software Foundation (ASF) under one or more
- *   contributor license agreements.  See the NOTICE file distributed with
- *   this work for additional information regarding copyright ownership.
- *   The ASF licenses this file to You under the Apache License, Version 2.0
- *   (the "License"); you may not use this file except in compliance with
- *   the License.  You may obtain a copy of the License at
- *
- *       http://www.apache.org/licenses/LICENSE-2.0
- *
- *   Unless required by applicable law or agreed to in writing, software
- *   distributed under the License is distributed on an "AS IS" BASIS,
- *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *   See the License for the specific language governing permissions and
- *   limitations under the License.
- *
- */
-
-package org.apache.dubbo.samples.externalconfiguration.api;
-
-/**
- * AsyncService
- */
-public interface AnnotationService {
-
-    String sayHello(String name);
-
-}
diff --git a/dubbo-samples-configcenter/dubbo-samples-configcenter-annotation/src/main/java/org/apache/dubbo/samples/annotation/AnnotationConsumer.java b/dubbo-samples-configcenter/dubbo-samples-configcenter-annotation/src/main/java/org/apache/dubbo/samples/hystrix/annotation/AnnotationConsumer.java
similarity index 100%
rename from dubbo-samples-configcenter/dubbo-samples-configcenter-annotation/src/main/java/org/apache/dubbo/samples/annotation/AnnotationConsumer.java
rename to dubbo-samples-configcenter/dubbo-samples-configcenter-annotation/src/main/java/org/apache/dubbo/samples/hystrix/annotation/AnnotationConsumer.java
diff --git a/dubbo-samples-annotation/src/main/java/org/apache/dubbo/samples/annotation/AnnotationProvider.java b/dubbo-samples-configcenter/dubbo-samples-configcenter-annotation/src/main/java/org/apache/dubbo/samples/hystrix/annotation/AnnotationProvider.java
similarity index 100%
rename from dubbo-samples-annotation/src/main/java/org/apache/dubbo/samples/annotation/AnnotationProvider.java
rename to dubbo-samples-configcenter/dubbo-samples-configcenter-annotation/src/main/java/org/apache/dubbo/samples/hystrix/annotation/AnnotationProvider.java
diff --git a/dubbo-samples-configcenter/dubbo-samples-configcenter-annotation/src/main/java/org/apache/dubbo/samples/annotation/EmbeddedZooKeeper.java b/dubbo-samples-configcenter/dubbo-samples-configcenter-annotation/src/main/java/org/apache/dubbo/samples/hystrix/annotation/EmbeddedZooKeeper.java
similarity index 100%
rename from dubbo-samples-configcenter/dubbo-samples-configcenter-annotation/src/main/java/org/apache/dubbo/samples/annotation/EmbeddedZooKeeper.java
rename to dubbo-samples-configcenter/dubbo-samples-configcenter-annotation/src/main/java/org/apache/dubbo/samples/hystrix/annotation/EmbeddedZooKeeper.java
diff --git a/dubbo-samples-configcenter/dubbo-samples-configcenter-annotation/src/main/java/org/apache/dubbo/samples/annotation/ZKTools.java b/dubbo-samples-configcenter/dubbo-samples-configcenter-annotation/src/main/java/org/apache/dubbo/samples/hystrix/annotation/ZKTools.java
similarity index 100%
rename from dubbo-samples-configcenter/dubbo-samples-configcenter-annotation/src/main/java/org/apache/dubbo/samples/annotation/ZKTools.java
rename to dubbo-samples-configcenter/dubbo-samples-configcenter-annotation/src/main/java/org/apache/dubbo/samples/hystrix/annotation/ZKTools.java
diff --git a/dubbo-samples-configcenter/dubbo-samples-configcenter-annotation/src/main/java/org/apache/dubbo/samples/annotation/action/AnnotationAction.java b/dubbo-samples-configcenter/dubbo-samples-configcenter-annotation/src/main/java/org/apache/dubbo/samples/hystrix/annotation/action/AnnotationAction.java
similarity index 100%
rename from dubbo-samples-configcenter/dubbo-samples-configcenter-annotation/src/main/java/org/apache/dubbo/samples/annotation/action/AnnotationAction.java
rename to dubbo-samples-configcenter/dubbo-samples-configcenter-annotation/src/main/java/org/apache/dubbo/samples/hystrix/annotation/action/AnnotationAction.java
diff --git a/dubbo-samples-spring-hystrix/src/main/java/org/apache/dubbo/samples/annotation/api/AnnotationService.java b/dubbo-samples-configcenter/dubbo-samples-configcenter-annotation/src/main/java/org/apache/dubbo/samples/hystrix/annotation/api/AnnotationService.java
similarity index 100%
rename from dubbo-samples-spring-hystrix/src/main/java/org/apache/dubbo/samples/annotation/api/AnnotationService.java
rename to dubbo-samples-configcenter/dubbo-samples-configcenter-annotation/src/main/java/org/apache/dubbo/samples/hystrix/annotation/api/AnnotationService.java
diff --git a/dubbo-samples-configcenter/dubbo-samples-configcenter-annotation/src/main/java/org/apache/dubbo/samples/annotation/impl/AnnotationServiceImpl.java b/dubbo-samples-configcenter/dubbo-samples-configcenter-annotation/src/main/java/org/apache/dubbo/samples/hystrix/annotation/impl/AnnotationServiceImpl.java
similarity index 100%
rename from dubbo-samples-configcenter/dubbo-samples-configcenter-annotation/src/main/java/org/apache/dubbo/samples/annotation/impl/AnnotationServiceImpl.java
rename to dubbo-samples-configcenter/dubbo-samples-configcenter-annotation/src/main/java/org/apache/dubbo/samples/hystrix/annotation/impl/AnnotationServiceImpl.java
diff --git a/dubbo-samples-configcenter/dubbo-samples-configcenter-multi-registries/src/main/java/org/apache/dubbo/samples/annotation/AnnotationConsumer.java b/dubbo-samples-configcenter/dubbo-samples-configcenter-multi-registries/src/main/java/org/apache/dubbo/samples/hystrix/annotation/AnnotationConsumer.java
similarity index 100%
rename from dubbo-samples-configcenter/dubbo-samples-configcenter-multi-registries/src/main/java/org/apache/dubbo/samples/annotation/AnnotationConsumer.java
rename to dubbo-samples-configcenter/dubbo-samples-configcenter-multi-registries/src/main/java/org/apache/dubbo/samples/hystrix/annotation/AnnotationConsumer.java
diff --git a/dubbo-samples-configcenter/dubbo-samples-configcenter-multi-registries/src/main/java/org/apache/dubbo/samples/annotation/AnnotationProvider.java b/dubbo-samples-configcenter/dubbo-samples-configcenter-multi-registries/src/main/java/org/apache/dubbo/samples/hystrix/annotation/AnnotationProvider.java
similarity index 100%
rename from dubbo-samples-configcenter/dubbo-samples-configcenter-multi-registries/src/main/java/org/apache/dubbo/samples/annotation/AnnotationProvider.java
rename to dubbo-samples-configcenter/dubbo-samples-configcenter-multi-registries/src/main/java/org/apache/dubbo/samples/hystrix/annotation/AnnotationProvider.java
diff --git a/dubbo-samples-configcenter/dubbo-samples-configcenter-multi-registries/src/main/java/org/apache/dubbo/samples/annotation/EmbeddedZooKeeper.java b/dubbo-samples-configcenter/dubbo-samples-configcenter-multi-registries/src/main/java/org/apache/dubbo/samples/hystrix/annotation/EmbeddedZooKeeper.java
similarity index 100%
rename from dubbo-samples-configcenter/dubbo-samples-configcenter-multi-registries/src/main/java/org/apache/dubbo/samples/annotation/EmbeddedZooKeeper.java
rename to dubbo-samples-configcenter/dubbo-samples-configcenter-multi-registries/src/main/java/org/apache/dubbo/samples/hystrix/annotation/EmbeddedZooKeeper.java
diff --git a/dubbo-samples-configcenter/dubbo-samples-configcenter-multi-registries/src/main/java/org/apache/dubbo/samples/annotation/ZKTools.java b/dubbo-samples-configcenter/dubbo-samples-configcenter-multi-registries/src/main/java/org/apache/dubbo/samples/hystrix/annotation/ZKTools.java
similarity index 100%
rename from dubbo-samples-configcenter/dubbo-samples-configcenter-multi-registries/src/main/java/org/apache/dubbo/samples/annotation/ZKTools.java
rename to dubbo-samples-configcenter/dubbo-samples-configcenter-multi-registries/src/main/java/org/apache/dubbo/samples/hystrix/annotation/ZKTools.java
diff --git a/dubbo-samples-configcenter/dubbo-samples-configcenter-multi-registries/src/main/java/org/apache/dubbo/samples/annotation/action/AnnotationAction.java b/dubbo-samples-configcenter/dubbo-samples-configcenter-multi-registries/src/main/java/org/apache/dubbo/samples/hystrix/annotation/action/AnnotationAction.java
similarity index 100%
rename from dubbo-samples-configcenter/dubbo-samples-configcenter-multi-registries/src/main/java/org/apache/dubbo/samples/annotation/action/AnnotationAction.java
rename to dubbo-samples-configcenter/dubbo-samples-configcenter-multi-registries/src/main/java/org/apache/dubbo/samples/hystrix/annotation/action/AnnotationAction.java
diff --git a/dubbo-samples-configcenter/dubbo-samples-configcenter-multi-registries/src/main/java/org/apache/dubbo/samples/annotation/api/AnnotationService.java b/dubbo-samples-configcenter/dubbo-samples-configcenter-multi-registries/src/main/java/org/apache/dubbo/samples/hystrix/annotation/api/AnnotationService.java
similarity index 100%
rename from dubbo-samples-configcenter/dubbo-samples-configcenter-multi-registries/src/main/java/org/apache/dubbo/samples/annotation/api/AnnotationService.java
rename to dubbo-samples-configcenter/dubbo-samples-configcenter-multi-registries/src/main/java/org/apache/dubbo/samples/hystrix/annotation/api/AnnotationService.java
diff --git a/dubbo-samples-configcenter/dubbo-samples-configcenter-multi-registries/src/main/java/org/apache/dubbo/samples/annotation/impl/AnnotationServiceImpl.java b/dubbo-samples-configcenter/dubbo-samples-configcenter-multi-registries/src/main/java/org/apache/dubbo/samples/hystrix/annotation/impl/AnnotationServiceImpl.java
similarity index 100%
rename from dubbo-samples-configcenter/dubbo-samples-configcenter-multi-registries/src/main/java/org/apache/dubbo/samples/annotation/impl/AnnotationServiceImpl.java
rename to dubbo-samples-configcenter/dubbo-samples-configcenter-multi-registries/src/main/java/org/apache/dubbo/samples/hystrix/annotation/impl/AnnotationServiceImpl.java
diff --git a/dubbo-samples-resilience4j/dubbo-samples-resilience4j-filter/src/main/java/org/apache/dubbo/samples/resilience4j/AnnotationConsumer.java b/dubbo-samples-resilience4j/dubbo-samples-resilience4j-filter/src/main/java/org/apache/dubbo/samples/resilience4j/AnnotationConsumer.java
deleted file mode 100644
index d74b20a..0000000
--- a/dubbo-samples-resilience4j/dubbo-samples-resilience4j-filter/src/main/java/org/apache/dubbo/samples/resilience4j/AnnotationConsumer.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- *
- *   Licensed to the Apache Software Foundation (ASF) under one or more
- *   contributor license agreements.  See the NOTICE file distributed with
- *   this work for additional information regarding copyright ownership.
- *   The ASF licenses this file to You under the Apache License, Version 2.0
- *   (the "License"); you may not use this file except in compliance with
- *   the License.  You may obtain a copy of the License at
- *
- *       http://www.apache.org/licenses/LICENSE-2.0
- *
- *   Unless required by applicable law or agreed to in writing, software
- *   distributed under the License is distributed on an "AS IS" BASIS,
- *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *   See the License for the specific language governing permissions and
- *   limitations under the License.
- *
- */
-
-package org.apache.dubbo.samples.resilience4j;
-
-import io.github.resilience4j.circuitbreaker.CircuitBreaker;
-import io.github.resilience4j.circuitbreaker.CircuitBreakerConfig;
-import io.github.resilience4j.circuitbreaker.CircuitBreakerRegistry;
-import io.github.resilience4j.circuitbreaker.utils.CircuitBreakerUtils;
-import org.apache.dubbo.config.spring.context.annotation.EnableDubbo;
-import org.apache.dubbo.samples.resilience4j.action.AnnotationAction;
-import org.springframework.context.annotation.AnnotationConfigApplicationContext;
-import org.springframework.context.annotation.Bean;
-import org.springframework.context.annotation.ComponentScan;
-import org.springframework.context.annotation.Configuration;
-import org.springframework.context.annotation.EnableAspectJAutoProxy;
-import org.springframework.context.annotation.PropertySource;
-
-/**
- * CallbackConsumer
- */
-public class AnnotationConsumer {
-
-    public static void main(String[] args) throws Exception {
-        AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(ConsumerConfiguration.class);
-        context.start();
-        final AnnotationAction annotationAction = (AnnotationAction) context.getBean("annotationAction");
-        String hello = annotationAction.doSayHello("world");
-        System.err.println("result :" + hello);
-        System.in.read();
-    }
-
-    @Configuration
-    @EnableDubbo(scanBasePackages = "com.alibaba.dubbo.samples.resilience4j.action")
-    @PropertySource("classpath:/spring/dubbo-consumer.properties")
-    @ComponentScan(value = {"org.apache.dubbo.samples.resilience4j.action"})
-    @EnableAspectJAutoProxy
-    static public class ConsumerConfiguration {
-
-//        @Bean
-//        public HystrixCommandAspect hystrixCommandAspect() {
-//            return new HystrixCommandAspect();
-//        }
-
-    }
-
-}
diff --git a/dubbo-samples-resilience4j/dubbo-samples-resilience4j-filter/src/main/java/org/apache/dubbo/samples/resilience4j/AnnotationProvider.java b/dubbo-samples-resilience4j/dubbo-samples-resilience4j-filter/src/main/java/org/apache/dubbo/samples/resilience4j/AnnotationProvider.java
deleted file mode 100644
index be7715d..0000000
--- a/dubbo-samples-resilience4j/dubbo-samples-resilience4j-filter/src/main/java/org/apache/dubbo/samples/resilience4j/AnnotationProvider.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- *
- *   Licensed to the Apache Software Foundation (ASF) under one or more
- *   contributor license agreements.  See the NOTICE file distributed with
- *   this work for additional information regarding copyright ownership.
- *   The ASF licenses this file to You under the Apache License, Version 2.0
- *   (the "License"); you may not use this file except in compliance with
- *   the License.  You may obtain a copy of the License at
- *
- *       http://www.apache.org/licenses/LICENSE-2.0
- *
- *   Unless required by applicable law or agreed to in writing, software
- *   distributed under the License is distributed on an "AS IS" BASIS,
- *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *   See the License for the specific language governing permissions and
- *   limitations under the License.
- *
- */
-
-package org.apache.dubbo.samples.resilience4j;
-
-
-import org.apache.dubbo.config.ProviderConfig;
-import org.apache.dubbo.config.spring.context.annotation.EnableDubbo;
-import org.springframework.context.annotation.AnnotationConfigApplicationContext;
-import org.springframework.context.annotation.Bean;
-import org.springframework.context.annotation.Configuration;
-import org.springframework.context.annotation.EnableAspectJAutoProxy;
-import org.springframework.context.annotation.PropertySource;
-
-/**
- * MergeProvider
- */
-public class AnnotationProvider {
-
-    public static void main(String[] args) throws Exception {
-        new EmbeddedZooKeeper(2181, false).start();
-        AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(ProviderConfiguration.class);
-        context.start();
-        System.in.read();
-    }
-
-    @Configuration
-    @EnableDubbo(scanBasePackages = "com.alibaba.dubbo.samples.resilience4j.impl")
-    @PropertySource("classpath:/spring/dubbo-provider.properties")
-    @EnableAspectJAutoProxy
-    static public class ProviderConfiguration {
-        @Bean
-        public ProviderConfig providerConfig() {
-            ProviderConfig providerConfig = new ProviderConfig();
-            providerConfig.setTimeout(1000);
-            return providerConfig;
-        }
-
-//        @Bean
-//        public HystrixCommandAspect hystrixCommandAspect() {
-//            return new HystrixCommandAspect();
-//        }
-    }
-
-}
diff --git a/dubbo-samples-resilience4j/src/main/java/org/apache/dubbo/samples/resilience4j/AnnotationConsumer.java b/dubbo-samples-resilience4j/dubbo-samples-resilience4j-filter/src/main/java/org/apache/dubbo/samples/resilience4j/Resilience4jAnnotationConsumer.java
similarity index 87%
rename from dubbo-samples-resilience4j/src/main/java/org/apache/dubbo/samples/resilience4j/AnnotationConsumer.java
rename to dubbo-samples-resilience4j/dubbo-samples-resilience4j-filter/src/main/java/org/apache/dubbo/samples/resilience4j/Resilience4jAnnotationConsumer.java
index d74b20a..78e63e9 100644
--- a/dubbo-samples-resilience4j/src/main/java/org/apache/dubbo/samples/resilience4j/AnnotationConsumer.java
+++ b/dubbo-samples-resilience4j/dubbo-samples-resilience4j-filter/src/main/java/org/apache/dubbo/samples/resilience4j/Resilience4jAnnotationConsumer.java
@@ -19,14 +19,9 @@
 
 package org.apache.dubbo.samples.resilience4j;
 
-import io.github.resilience4j.circuitbreaker.CircuitBreaker;
-import io.github.resilience4j.circuitbreaker.CircuitBreakerConfig;
-import io.github.resilience4j.circuitbreaker.CircuitBreakerRegistry;
-import io.github.resilience4j.circuitbreaker.utils.CircuitBreakerUtils;
 import org.apache.dubbo.config.spring.context.annotation.EnableDubbo;
 import org.apache.dubbo.samples.resilience4j.action.AnnotationAction;
 import org.springframework.context.annotation.AnnotationConfigApplicationContext;
-import org.springframework.context.annotation.Bean;
 import org.springframework.context.annotation.ComponentScan;
 import org.springframework.context.annotation.Configuration;
 import org.springframework.context.annotation.EnableAspectJAutoProxy;
diff --git a/dubbo-samples-resilience4j/dubbo-samples-resilience4j-springboot2/src/main/java/org/apache/dubbo/samples/resilience4j/AnnotationProvider.java b/dubbo-samples-resilience4j/dubbo-samples-resilience4j-filter/src/main/java/org/apache/dubbo/samples/resilience4j/Resilience4jAnnotationProvider.java
similarity index 98%
rename from dubbo-samples-resilience4j/dubbo-samples-resilience4j-springboot2/src/main/java/org/apache/dubbo/samples/resilience4j/AnnotationProvider.java
rename to dubbo-samples-resilience4j/dubbo-samples-resilience4j-filter/src/main/java/org/apache/dubbo/samples/resilience4j/Resilience4jAnnotationProvider.java
index be7715d..8f5311a 100644
--- a/dubbo-samples-resilience4j/dubbo-samples-resilience4j-springboot2/src/main/java/org/apache/dubbo/samples/resilience4j/AnnotationProvider.java
+++ b/dubbo-samples-resilience4j/dubbo-samples-resilience4j-filter/src/main/java/org/apache/dubbo/samples/resilience4j/Resilience4jAnnotationProvider.java
@@ -43,7 +43,7 @@ public class AnnotationProvider {
     @Configuration
     @EnableDubbo(scanBasePackages = "com.alibaba.dubbo.samples.resilience4j.impl")
     @PropertySource("classpath:/spring/dubbo-provider.properties")
-    @EnableAspectJAutoProxy
+//    @EnableAspectJAutoProxy
     static public class ProviderConfiguration {
         @Bean
         public ProviderConfig providerConfig() {
diff --git a/dubbo-samples-resilience4j/dubbo-samples-resilience4j-filter/src/main/java/org/apache/dubbo/samples/resilience4j/api/CircuitBreakerService.java b/dubbo-samples-resilience4j/dubbo-samples-resilience4j-filter/src/main/java/org/apache/dubbo/samples/resilience4j/api/CircuitBreakerService.java
new file mode 100644
index 0000000..8c824ff
--- /dev/null
+++ b/dubbo-samples-resilience4j/dubbo-samples-resilience4j-filter/src/main/java/org/apache/dubbo/samples/resilience4j/api/CircuitBreakerService.java
@@ -0,0 +1,7 @@
+package org.apache.dubbo.samples.resilience4j.api;
+
+/**
+ * @author cvictory ON 2018/12/26
+ */
+public interface CircuitBreakerService {
+}
diff --git a/dubbo-samples-resilience4j/dubbo-samples-resilience4j-filter/src/main/java/org/apache/dubbo/samples/resilience4j/api/RateLimiterService.java b/dubbo-samples-resilience4j/dubbo-samples-resilience4j-filter/src/main/java/org/apache/dubbo/samples/resilience4j/api/RateLimiterService.java
new file mode 100644
index 0000000..3383625
--- /dev/null
+++ b/dubbo-samples-resilience4j/dubbo-samples-resilience4j-filter/src/main/java/org/apache/dubbo/samples/resilience4j/api/RateLimiterService.java
@@ -0,0 +1,7 @@
+package org.apache.dubbo.samples.resilience4j.api;
+
+/**
+ * @author cvictory ON 2018/12/26
+ */
+public interface RateLimiterService {
+}
diff --git a/dubbo-samples-resilience4j/src/main/java/org/apache/dubbo/samples/resilience4j/filter/Resilience4jCircuitBreakerFilter.java b/dubbo-samples-resilience4j/dubbo-samples-resilience4j-filter/src/main/java/org/apache/dubbo/samples/resilience4j/filter/Resilience4jRateLimiterFilter.java
similarity index 100%
rename from dubbo-samples-resilience4j/src/main/java/org/apache/dubbo/samples/resilience4j/filter/Resilience4jCircuitBreakerFilter.java
rename to dubbo-samples-resilience4j/dubbo-samples-resilience4j-filter/src/main/java/org/apache/dubbo/samples/resilience4j/filter/Resilience4jRateLimiterFilter.java
diff --git a/dubbo-samples-resilience4j/dubbo-samples-resilience4j-filter/src/main/java/org/apache/dubbo/samples/resilience4j/impl/CircuitBreakerServiceImpl.java b/dubbo-samples-resilience4j/dubbo-samples-resilience4j-filter/src/main/java/org/apache/dubbo/samples/resilience4j/impl/CircuitBreakerServiceImpl.java
new file mode 100644
index 0000000..29ec47f
--- /dev/null
+++ b/dubbo-samples-resilience4j/dubbo-samples-resilience4j-filter/src/main/java/org/apache/dubbo/samples/resilience4j/impl/CircuitBreakerServiceImpl.java
@@ -0,0 +1,7 @@
+package org.apache.dubbo.samples.resilience4j.impl;
+
+/**
+ * @author cvictory ON 2018/12/26
+ */
+public class CircuitBreakerServiceImpl {
+}
diff --git a/dubbo-samples-resilience4j/dubbo-samples-resilience4j-filter/src/main/java/org/apache/dubbo/samples/resilience4j/impl/RateLimiterServiceImpl.java b/dubbo-samples-resilience4j/dubbo-samples-resilience4j-filter/src/main/java/org/apache/dubbo/samples/resilience4j/impl/RateLimiterServiceImpl.java
new file mode 100644
index 0000000..32bea46
--- /dev/null
+++ b/dubbo-samples-resilience4j/dubbo-samples-resilience4j-filter/src/main/java/org/apache/dubbo/samples/resilience4j/impl/RateLimiterServiceImpl.java
@@ -0,0 +1,7 @@
+package org.apache.dubbo.samples.resilience4j.impl;
+
+/**
+ * @author cvictory ON 2018/12/26
+ */
+public class RateLimiterServiceImpl {
+}
diff --git a/dubbo-samples-resilience4j/dubbo-samples-resilience4j-filter/src/main/resources/META-INF/dubbo/org.apache.dubbo.rpc.Filter b/dubbo-samples-resilience4j/dubbo-samples-resilience4j-filter/src/main/resources/META-INF/dubbo/org.apache.dubbo.rpc.Filter
new file mode 100644
index 0000000..e69de29
diff --git a/dubbo-samples-resilience4j/dubbo-samples-resilience4j-springboot2/src/main/java/org/apache/dubbo/samples/resilience4j/AnnotationConsumer.java b/dubbo-samples-resilience4j/dubbo-samples-resilience4j-springboot2/src/main/java/org/apache/dubbo/samples/resilience4j/Resilience4jBootAnnotationConsumer.java
similarity index 87%
rename from dubbo-samples-resilience4j/dubbo-samples-resilience4j-springboot2/src/main/java/org/apache/dubbo/samples/resilience4j/AnnotationConsumer.java
rename to dubbo-samples-resilience4j/dubbo-samples-resilience4j-springboot2/src/main/java/org/apache/dubbo/samples/resilience4j/Resilience4jBootAnnotationConsumer.java
index d74b20a..78e63e9 100644
--- a/dubbo-samples-resilience4j/dubbo-samples-resilience4j-springboot2/src/main/java/org/apache/dubbo/samples/resilience4j/AnnotationConsumer.java
+++ b/dubbo-samples-resilience4j/dubbo-samples-resilience4j-springboot2/src/main/java/org/apache/dubbo/samples/resilience4j/Resilience4jBootAnnotationConsumer.java
@@ -19,14 +19,9 @@
 
 package org.apache.dubbo.samples.resilience4j;
 
-import io.github.resilience4j.circuitbreaker.CircuitBreaker;
-import io.github.resilience4j.circuitbreaker.CircuitBreakerConfig;
-import io.github.resilience4j.circuitbreaker.CircuitBreakerRegistry;
-import io.github.resilience4j.circuitbreaker.utils.CircuitBreakerUtils;
 import org.apache.dubbo.config.spring.context.annotation.EnableDubbo;
 import org.apache.dubbo.samples.resilience4j.action.AnnotationAction;
 import org.springframework.context.annotation.AnnotationConfigApplicationContext;
-import org.springframework.context.annotation.Bean;
 import org.springframework.context.annotation.ComponentScan;
 import org.springframework.context.annotation.Configuration;
 import org.springframework.context.annotation.EnableAspectJAutoProxy;
diff --git a/dubbo-samples-resilience4j/src/main/java/org/apache/dubbo/samples/resilience4j/AnnotationProvider.java b/dubbo-samples-resilience4j/dubbo-samples-resilience4j-springboot2/src/main/java/org/apache/dubbo/samples/resilience4j/Resilience4jBootAnnotationProvider.java
similarity index 100%
rename from dubbo-samples-resilience4j/src/main/java/org/apache/dubbo/samples/resilience4j/AnnotationProvider.java
rename to dubbo-samples-resilience4j/dubbo-samples-resilience4j-springboot2/src/main/java/org/apache/dubbo/samples/resilience4j/Resilience4jBootAnnotationProvider.java
diff --git a/dubbo-samples-resilience4j/dubbo-samples-resilience4j-springboot2/src/main/java/org/apache/dubbo/samples/resilience4j/filter/Resilience4jCircuitBreakerFilter.java b/dubbo-samples-resilience4j/dubbo-samples-resilience4j-springboot2/src/main/java/org/apache/dubbo/samples/resilience4j/filter/Resilience4jCircuitBreakerFilter.java
deleted file mode 100644
index 7b795cf..0000000
--- a/dubbo-samples-resilience4j/dubbo-samples-resilience4j-springboot2/src/main/java/org/apache/dubbo/samples/resilience4j/filter/Resilience4jCircuitBreakerFilter.java
+++ /dev/null
@@ -1,42 +0,0 @@
-package org.apache.dubbo.samples.resilience4j.filter;
-
-import io.github.resilience4j.circuitbreaker.CircuitBreaker;
-import io.github.resilience4j.circuitbreaker.CircuitBreakerConfig;
-import io.github.resilience4j.circuitbreaker.CircuitBreakerRegistry;
-import org.apache.dubbo.rpc.Filter;
-import org.apache.dubbo.rpc.Invocation;
-import org.apache.dubbo.rpc.Invoker;
-import org.apache.dubbo.rpc.Result;
-import org.apache.dubbo.rpc.RpcException;
-
-/**
- * @author cvictory ON 2018/12/25
- */
-public class Resilience4jCircuitBreakerFilter implements Filter {
-
-    static CircuitBreaker circuitBreaker;
-
-    static {
-        CircuitBreakerConfig config = CircuitBreakerConfig.custom()
-                .failureRateThreshold(20)
-                .ringBufferSizeInClosedState(5)
-                .build();
-        CircuitBreakerRegistry registry = CircuitBreakerRegistry.of(config);
-        circuitBreaker = registry.circuitBreaker("my");
-    }
-
-    @Override
-    public Result invoke(Invoker<?> invoker, Invocation invocation) throws RpcException {
-        long start = System.nanoTime();
-        try {
-            Result result = invoker.invoke(invocation);
-            long durationInNanos = System.nanoTime() - start;
-            circuitBreaker.onSuccess(durationInNanos);
-            return result;
-        } catch (Throwable throwable) {
-            long durationInNanos = System.nanoTime() - start;
-            circuitBreaker.onError(durationInNanos, throwable);
-            throw throwable;
-        }
-    }
-}
diff --git a/dubbo-samples-resilience4j/src/main/java/org/apache/dubbo/samples/resilience4j/action/AnnotationAction.java b/dubbo-samples-resilience4j/src/main/java/org/apache/dubbo/samples/resilience4j/action/AnnotationAction.java
deleted file mode 100644
index 785c9eb..0000000
--- a/dubbo-samples-resilience4j/src/main/java/org/apache/dubbo/samples/resilience4j/action/AnnotationAction.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- *
- *   Licensed to the Apache Software Foundation (ASF) under one or more
- *   contributor license agreements.  See the NOTICE file distributed with
- *   this work for additional information regarding copyright ownership.
- *   The ASF licenses this file to You under the Apache License, Version 2.0
- *   (the "License"); you may not use this file except in compliance with
- *   the License.  You may obtain a copy of the License at
- *
- *       http://www.apache.org/licenses/LICENSE-2.0
- *
- *   Unless required by applicable law or agreed to in writing, software
- *   distributed under the License is distributed on an "AS IS" BASIS,
- *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *   See the License for the specific language governing permissions and
- *   limitations under the License.
- *
- */
-
-package org.apache.dubbo.samples.resilience4j.action;
-
-import org.apache.dubbo.config.annotation.Reference;
-
-
-import org.apache.dubbo.samples.resilience4j.api.AnnotationService;
-import org.springframework.stereotype.Component;
-
-/**
- * AnnotationAction
- */
-@Component("annotationAction")
-public class AnnotationAction {
-
-    @Reference
-    private AnnotationService annotationService;
-
-//    @HystrixCommand(fallbackMethod = "reliable")
-    public String doSayHello(String name) {
-        return annotationService.sayHello(name);
-    }
-
-    public String reliable(String name) {
-        return "hystrix fallback value";
-    }
-
-}
diff --git a/dubbo-samples-resilience4j/src/main/java/org/apache/dubbo/samples/resilience4j/impl/AnnotationServiceImpl.java b/dubbo-samples-resilience4j/src/main/java/org/apache/dubbo/samples/resilience4j/impl/AnnotationServiceImpl.java
deleted file mode 100644
index cc2e9f7..0000000
--- a/dubbo-samples-resilience4j/src/main/java/org/apache/dubbo/samples/resilience4j/impl/AnnotationServiceImpl.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- *
- *   Licensed to the Apache Software Foundation (ASF) under one or more
- *   contributor license agreements.  See the NOTICE file distributed with
- *   this work for additional information regarding copyright ownership.
- *   The ASF licenses this file to You under the Apache License, Version 2.0
- *   (the "License"); you may not use this file except in compliance with
- *   the License.  You may obtain a copy of the License at
- *
- *       http://www.apache.org/licenses/LICENSE-2.0
- *
- *   Unless required by applicable law or agreed to in writing, software
- *   distributed under the License is distributed on an "AS IS" BASIS,
- *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *   See the License for the specific language governing permissions and
- *   limitations under the License.
- *
- */
-
-package org.apache.dubbo.samples.resilience4j.impl;
-
-import org.apache.dubbo.config.annotation.Service;
-import org.apache.dubbo.samples.resilience4j.api.AnnotationService;
-
-/**
- * AsyncServiceImpl
- */
-@Service
-public class AnnotationServiceImpl implements AnnotationService {
-
-//    @HystrixCommand(commandProperties = { @HystrixProperty(name = "circuitBreaker.requestVolumeThreshold", value = "10"),
-//                    @HystrixProperty(name = "execution.isolation.thread.timeoutInMilliseconds", value = "2000") })
-    @Override
-    public String sayHello(String name) {
-//        System.out.println("async provider received: " + name);
-//        return "annotation: hello, " + name;
-        throw new RuntimeException("Exception to show hystrix enabled.");
-    }
-
-}
diff --git a/dubbo-samples-resilience4j/src/main/resources/log4j.properties b/dubbo-samples-resilience4j/src/main/resources/log4j.properties
deleted file mode 100644
index d6ecd5c..0000000
--- a/dubbo-samples-resilience4j/src/main/resources/log4j.properties
+++ /dev/null
@@ -1,26 +0,0 @@
-#
-#
-#   Licensed to the Apache Software Foundation (ASF) under one or more
-#   contributor license agreements.  See the NOTICE file distributed with
-#   this work for additional information regarding copyright ownership.
-#   The ASF licenses this file to You under the Apache License, Version 2.0
-#   (the "License"); you may not use this file except in compliance with
-#   the License.  You may obtain a copy of the License at
-#
-#       http://www.apache.org/licenses/LICENSE-2.0
-#
-#   Unless required by applicable law or agreed to in writing, software
-#   distributed under the License is distributed on an "AS IS" BASIS,
-#   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-#   See the License for the specific language governing permissions and
-#   limitations under the License.
-#
-#
-
-###set log levels###
-log4j.rootLogger=info, stdout
-###output to the console###
-log4j.appender.stdout=org.apache.log4j.ConsoleAppender
-log4j.appender.stdout.Target=System.out
-log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
-log4j.appender.stdout.layout.ConversionPattern=[%d{dd/MM/yy hh:mm:ss:sss z}] %t %5p %c{2}: %m%n
\ No newline at end of file
diff --git a/dubbo-samples-resilience4j/src/main/resources/spring/dubbo-consumer.properties b/dubbo-samples-resilience4j/src/main/resources/spring/dubbo-consumer.properties
deleted file mode 100644
index 96ab667..0000000
--- a/dubbo-samples-resilience4j/src/main/resources/spring/dubbo-consumer.properties
+++ /dev/null
@@ -1,22 +0,0 @@
-#
-#
-#   Licensed to the Apache Software Foundation (ASF) under one or more
-#   contributor license agreements.  See the NOTICE file distributed with
-#   this work for additional information regarding copyright ownership.
-#   The ASF licenses this file to You under the Apache License, Version 2.0
-#   (the "License"); you may not use this file except in compliance with
-#   the License.  You may obtain a copy of the License at
-#  
-#       http://www.apache.org/licenses/LICENSE-2.0
-#  
-#   Unless required by applicable law or agreed to in writing, software
-#   distributed under the License is distributed on an "AS IS" BASIS,
-#   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-#   See the License for the specific language governing permissions and
-#   limitations under the License.
-#  
-#
-
-dubbo.application.name=annotation-consumer
-dubbo.registry.address=zookeeper://127.0.0.1:2181
-dubbo.consumer.timeout=3000
\ No newline at end of file
diff --git a/dubbo-samples-resilience4j/src/main/resources/spring/dubbo-provider.properties b/dubbo-samples-resilience4j/src/main/resources/spring/dubbo-provider.properties
deleted file mode 100644
index 51fccca..0000000
--- a/dubbo-samples-resilience4j/src/main/resources/spring/dubbo-provider.properties
+++ /dev/null
@@ -1,23 +0,0 @@
-#
-#
-#   Licensed to the Apache Software Foundation (ASF) under one or more
-#   contributor license agreements.  See the NOTICE file distributed with
-#   this work for additional information regarding copyright ownership.
-#   The ASF licenses this file to You under the Apache License, Version 2.0
-#   (the "License"); you may not use this file except in compliance with
-#   the License.  You may obtain a copy of the License at
-#  
-#       http://www.apache.org/licenses/LICENSE-2.0
-#  
-#   Unless required by applicable law or agreed to in writing, software
-#   distributed under the License is distributed on an "AS IS" BASIS,
-#   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-#   See the License for the specific language governing permissions and
-#   limitations under the License.
-#  
-#
-
-dubbo.application.name=annotation-provider
-dubbo.registry.address=zookeeper://127.0.0.1:2181
-dubbo.protocol.name=dubbo
-dubbo.protocol.port=20880
\ No newline at end of file
diff --git a/dubbo-samples-spring-hystrix/README.md b/dubbo-samples-spring-hystrix/README.md
index 12c735e..e938b7b 100644
--- a/dubbo-samples-spring-hystrix/README.md
+++ b/dubbo-samples-spring-hystrix/README.md
@@ -2,12 +2,12 @@
 
 ### Start Provider
 
-Run `org.apache.dubbo.samples.annotation.AnnotationProvider`
+Run `AnnotationProvider`
 
 
 ### Start Consumer
 
-Run `org.apache.dubbo.samples.annotation.AnnotationConsumer`
+Run `AnnotationConsumer`
 
 ### Result
 
diff --git a/dubbo-samples-resilience4j/src/main/java/org/apache/dubbo/samples/resilience4j/EmbeddedZooKeeper.java b/dubbo-samples-spring-hystrix/src/main/java/org/apache/dubbo/samples/hystrix/annotation/EmbeddedZooKeeper.java
similarity index 99%
rename from dubbo-samples-resilience4j/src/main/java/org/apache/dubbo/samples/resilience4j/EmbeddedZooKeeper.java
rename to dubbo-samples-spring-hystrix/src/main/java/org/apache/dubbo/samples/hystrix/annotation/EmbeddedZooKeeper.java
index 9c8ae8a..a3b702b 100644
--- a/dubbo-samples-resilience4j/src/main/java/org/apache/dubbo/samples/resilience4j/EmbeddedZooKeeper.java
+++ b/dubbo-samples-spring-hystrix/src/main/java/org/apache/dubbo/samples/hystrix/annotation/EmbeddedZooKeeper.java
@@ -13,7 +13,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.dubbo.samples.resilience4j;
+package org.apache.dubbo.samples.hystrix.annotation;
 
 import java.io.File;
 import java.lang.reflect.Method;
diff --git a/dubbo-samples-spring-hystrix/src/main/java/org/apache/dubbo/samples/annotation/AnnotationConsumer.java b/dubbo-samples-spring-hystrix/src/main/java/org/apache/dubbo/samples/hystrix/annotation/HystrixAnnotationConsumer.java
similarity index 83%
rename from dubbo-samples-spring-hystrix/src/main/java/org/apache/dubbo/samples/annotation/AnnotationConsumer.java
rename to dubbo-samples-spring-hystrix/src/main/java/org/apache/dubbo/samples/hystrix/annotation/HystrixAnnotationConsumer.java
index fc129fc..16d9010 100644
--- a/dubbo-samples-spring-hystrix/src/main/java/org/apache/dubbo/samples/annotation/AnnotationConsumer.java
+++ b/dubbo-samples-spring-hystrix/src/main/java/org/apache/dubbo/samples/hystrix/annotation/HystrixAnnotationConsumer.java
@@ -17,12 +17,11 @@
  *
  */
 
-package org.apache.dubbo.samples.annotation;
+package org.apache.dubbo.samples.hystrix.annotation;
 
-import org.apache.dubbo.config.spring.context.annotation.EnableDubbo;
-import org.apache.dubbo.samples.annotation.action.AnnotationAction;
 import com.netflix.hystrix.contrib.javanica.aop.aspectj.HystrixCommandAspect;
-
+import org.apache.dubbo.config.spring.context.annotation.EnableDubbo;
+import org.apache.dubbo.samples.hystrix.annotation.action.AnnotationAction;
 import org.springframework.context.annotation.AnnotationConfigApplicationContext;
 import org.springframework.context.annotation.Bean;
 import org.springframework.context.annotation.ComponentScan;
@@ -33,7 +32,7 @@ import org.springframework.context.annotation.PropertySource;
 /**
  * CallbackConsumer
  */
-public class AnnotationConsumer {
+public class HystrixAnnotationConsumer {
 
     public static void main(String[] args) throws Exception {
         AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(ConsumerConfiguration.class);
@@ -45,9 +44,9 @@ public class AnnotationConsumer {
     }
 
     @Configuration
-    @EnableDubbo(scanBasePackages = "com.alibaba.dubbo.samples.annotation.action")
-    @PropertySource("classpath:/spring/dubbo-consumer.properties")
-    @ComponentScan(value = {"org.apache.dubbo.samples.annotation.action"})
+    @EnableDubbo(scanBasePackages = "org.apache.dubbo.samples.hystrix.annotation.action")
+    @PropertySource("classpath:/spring/hystrix-dubbo-consumer.properties")
+    @ComponentScan(value = {"org.apache.dubbo.samples.hystrix.annotation.action"})
     @EnableAspectJAutoProxy
     static public class ConsumerConfiguration {
 
diff --git a/dubbo-samples-spring-hystrix/src/main/java/org/apache/dubbo/samples/annotation/AnnotationProvider.java b/dubbo-samples-spring-hystrix/src/main/java/org/apache/dubbo/samples/hystrix/annotation/HystrixAnnotationProvider.java
similarity index 84%
rename from dubbo-samples-spring-hystrix/src/main/java/org/apache/dubbo/samples/annotation/AnnotationProvider.java
rename to dubbo-samples-spring-hystrix/src/main/java/org/apache/dubbo/samples/hystrix/annotation/HystrixAnnotationProvider.java
index 18554c1..df7f411 100644
--- a/dubbo-samples-spring-hystrix/src/main/java/org/apache/dubbo/samples/annotation/AnnotationProvider.java
+++ b/dubbo-samples-spring-hystrix/src/main/java/org/apache/dubbo/samples/hystrix/annotation/HystrixAnnotationProvider.java
@@ -17,22 +17,20 @@
  *
  */
 
-package org.apache.dubbo.samples.annotation;
+package org.apache.dubbo.samples.hystrix.annotation;
 
 import com.netflix.hystrix.contrib.javanica.aop.aspectj.HystrixCommandAspect;
-
 import org.apache.dubbo.config.ProviderConfig;
 import org.apache.dubbo.config.spring.context.annotation.EnableDubbo;
 import org.springframework.context.annotation.AnnotationConfigApplicationContext;
 import org.springframework.context.annotation.Bean;
 import org.springframework.context.annotation.Configuration;
-import org.springframework.context.annotation.EnableAspectJAutoProxy;
 import org.springframework.context.annotation.PropertySource;
 
 /**
  * MergeProvider
  */
-public class AnnotationProvider {
+public class HystrixAnnotationProvider {
 
     public static void main(String[] args) throws Exception {
         new EmbeddedZooKeeper(2181, false).start();
@@ -42,9 +40,10 @@ public class AnnotationProvider {
     }
 
     @Configuration
-    @EnableDubbo(scanBasePackages = "com.alibaba.dubbo.samples.annotation.impl")
-    @PropertySource("classpath:/spring/dubbo-provider.properties")
-    @EnableAspectJAutoProxy
+    @EnableDubbo(scanBasePackages = "org.apache.dubbo.samples.hystrix.annotation.impl")
+    @PropertySource("classpath:/spring/hystrix-dubbo-provider.properties")
+//    @ComponentScan(value = {"org.apache.dubbo.samples.hystrix.annotation.impl"})
+//    @EnableAspectJAutoProxy
     static public class ProviderConfiguration {
         @Bean
         public ProviderConfig providerConfig() {
diff --git a/dubbo-samples-spring-hystrix/src/main/java/org/apache/dubbo/samples/annotation/action/AnnotationAction.java b/dubbo-samples-spring-hystrix/src/main/java/org/apache/dubbo/samples/hystrix/annotation/action/AnnotationAction.java
similarity index 91%
rename from dubbo-samples-spring-hystrix/src/main/java/org/apache/dubbo/samples/annotation/action/AnnotationAction.java
rename to dubbo-samples-spring-hystrix/src/main/java/org/apache/dubbo/samples/hystrix/annotation/action/AnnotationAction.java
index 5871502..6bfc2e5 100644
--- a/dubbo-samples-spring-hystrix/src/main/java/org/apache/dubbo/samples/annotation/action/AnnotationAction.java
+++ b/dubbo-samples-spring-hystrix/src/main/java/org/apache/dubbo/samples/hystrix/annotation/action/AnnotationAction.java
@@ -17,10 +17,10 @@
  *
  */
 
-package org.apache.dubbo.samples.annotation.action;
+package org.apache.dubbo.samples.hystrix.annotation.action;
 
 import org.apache.dubbo.config.annotation.Reference;
-import org.apache.dubbo.samples.externalconfiguration.api.AnnotationService;
+import org.apache.dubbo.samples.hystrix.annotation.api.AnnotationService;
 import com.netflix.hystrix.contrib.javanica.annotation.HystrixCommand;
 
 import org.springframework.stereotype.Component;
diff --git a/dubbo-samples-resilience4j/src/main/java/org/apache/dubbo/samples/resilience4j/api/AnnotationService.java b/dubbo-samples-spring-hystrix/src/main/java/org/apache/dubbo/samples/hystrix/annotation/api/AnnotationService.java
similarity index 94%
rename from dubbo-samples-resilience4j/src/main/java/org/apache/dubbo/samples/resilience4j/api/AnnotationService.java
rename to dubbo-samples-spring-hystrix/src/main/java/org/apache/dubbo/samples/hystrix/annotation/api/AnnotationService.java
index 74b849a..ebaeae5 100644
--- a/dubbo-samples-resilience4j/src/main/java/org/apache/dubbo/samples/resilience4j/api/AnnotationService.java
+++ b/dubbo-samples-spring-hystrix/src/main/java/org/apache/dubbo/samples/hystrix/annotation/api/AnnotationService.java
@@ -17,7 +17,7 @@
  *
  */
 
-package org.apache.dubbo.samples.resilience4j.api;
+package org.apache.dubbo.samples.hystrix.annotation.api;
 
 /**
  * AsyncService
diff --git a/dubbo-samples-spring-hystrix/src/main/java/org/apache/dubbo/samples/annotation/impl/AnnotationServiceImpl.java b/dubbo-samples-spring-hystrix/src/main/java/org/apache/dubbo/samples/hystrix/annotation/impl/AnnotationServiceImpl.java
similarity index 89%
rename from dubbo-samples-spring-hystrix/src/main/java/org/apache/dubbo/samples/annotation/impl/AnnotationServiceImpl.java
rename to dubbo-samples-spring-hystrix/src/main/java/org/apache/dubbo/samples/hystrix/annotation/impl/AnnotationServiceImpl.java
index 1098acd..b49c36e 100644
--- a/dubbo-samples-spring-hystrix/src/main/java/org/apache/dubbo/samples/annotation/impl/AnnotationServiceImpl.java
+++ b/dubbo-samples-spring-hystrix/src/main/java/org/apache/dubbo/samples/hystrix/annotation/impl/AnnotationServiceImpl.java
@@ -17,17 +17,17 @@
  *
  */
 
-package org.apache.dubbo.samples.externalconfiguration.impl;
+package org.apache.dubbo.samples.hystrix.annotation.impl;
 
 import org.apache.dubbo.config.annotation.Service;
-import org.apache.dubbo.samples.externalconfiguration.api.AnnotationService;
+import org.apache.dubbo.samples.hystrix.annotation.api.AnnotationService;
 import com.netflix.hystrix.contrib.javanica.annotation.HystrixCommand;
 import com.netflix.hystrix.contrib.javanica.annotation.HystrixProperty;
 
 /**
  * AsyncServiceImpl
  */
-@Service
+@Service(interfaceClass = AnnotationService.class)
 public class AnnotationServiceImpl implements AnnotationService {
 
     @HystrixCommand(commandProperties = { @HystrixProperty(name = "circuitBreaker.requestVolumeThreshold", value = "10"),
diff --git a/dubbo-samples-spring-hystrix/src/main/resources/spring/dubbo-consumer.properties b/dubbo-samples-spring-hystrix/src/main/resources/spring/hystrix-dubbo-consumer.properties
similarity index 90%
rename from dubbo-samples-spring-hystrix/src/main/resources/spring/dubbo-consumer.properties
rename to dubbo-samples-spring-hystrix/src/main/resources/spring/hystrix-dubbo-consumer.properties
index 96ab667..bf0c068 100644
--- a/dubbo-samples-spring-hystrix/src/main/resources/spring/dubbo-consumer.properties
+++ b/dubbo-samples-spring-hystrix/src/main/resources/spring/hystrix-dubbo-consumer.properties
@@ -6,17 +6,17 @@
 #   The ASF licenses this file to You under the Apache License, Version 2.0
 #   (the "License"); you may not use this file except in compliance with
 #   the License.  You may obtain a copy of the License at
-#  
+#
 #       http://www.apache.org/licenses/LICENSE-2.0
-#  
+#
 #   Unless required by applicable law or agreed to in writing, software
 #   distributed under the License is distributed on an "AS IS" BASIS,
 #   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 #   See the License for the specific language governing permissions and
 #   limitations under the License.
-#  
+#
 #
 
-dubbo.application.name=annotation-consumer
+dubbo.application.name=hystrix-annotation-consumer
 dubbo.registry.address=zookeeper://127.0.0.1:2181
-dubbo.consumer.timeout=3000
\ No newline at end of file
+dubbo.consumer.timeout=3000
diff --git a/dubbo-samples-spring-hystrix/src/main/resources/spring/dubbo-provider.properties b/dubbo-samples-spring-hystrix/src/main/resources/spring/hystrix-dubbo-provider.properties
similarity index 91%
rename from dubbo-samples-spring-hystrix/src/main/resources/spring/dubbo-provider.properties
rename to dubbo-samples-spring-hystrix/src/main/resources/spring/hystrix-dubbo-provider.properties
index 51fccca..a52b2e5 100644
--- a/dubbo-samples-spring-hystrix/src/main/resources/spring/dubbo-provider.properties
+++ b/dubbo-samples-spring-hystrix/src/main/resources/spring/hystrix-dubbo-provider.properties
@@ -6,18 +6,18 @@
 #   The ASF licenses this file to You under the Apache License, Version 2.0
 #   (the "License"); you may not use this file except in compliance with
 #   the License.  You may obtain a copy of the License at
-#  
+#
 #       http://www.apache.org/licenses/LICENSE-2.0
-#  
+#
 #   Unless required by applicable law or agreed to in writing, software
 #   distributed under the License is distributed on an "AS IS" BASIS,
 #   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 #   See the License for the specific language governing permissions and
 #   limitations under the License.
-#  
+#
 #
 
-dubbo.application.name=annotation-provider
+dubbo.application.name=hystrix-annotation-provider
 dubbo.registry.address=zookeeper://127.0.0.1:2181
 dubbo.protocol.name=dubbo
-dubbo.protocol.port=20880
\ No newline at end of file
+dubbo.protocol.port=20885


[incubator-dubbo-samples] 03/04: Merge branch 'samples-for-2.7.0-SNAPSHOT' of github.com:dubbo/dubbo-samples into samples-for-2.7.0-SNAPSHOT

Posted by vi...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

victory pushed a commit to branch samples-for-2.7.0-SNAPSHOT
in repository https://gitbox.apache.org/repos/asf/incubator-dubbo-samples.git

commit 560b7873ec9917bc0110a4fb55fe44eea170cf3c
Merge: 4cc7029 e21930b
Author: cvictory <sh...@gmail.com>
AuthorDate: Wed Dec 26 14:18:17 2018 +0800

    Merge branch 'samples-for-2.7.0-SNAPSHOT' of github.com:dubbo/dubbo-samples into samples-for-2.7.0-SNAPSHOT

 dubbo-samples-generic-call/pom.xml | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)


[incubator-dubbo-samples] 02/04: init resilience4j project

Posted by vi...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

victory pushed a commit to branch samples-for-2.7.0-SNAPSHOT
in repository https://gitbox.apache.org/repos/asf/incubator-dubbo-samples.git

commit 4cc70290677c1789fdf6222f2a0e967cc8197f2f
Author: cvictory <sh...@gmail.com>
AuthorDate: Wed Dec 26 14:18:04 2018 +0800

    init resilience4j project
---
 dubbo-samples-resilience4j/README.md               |  17 ++
 .../dubbo-samples-resilience4j-filter/README.md    |  17 ++
 .../dubbo-samples-resilience4j-filter/pom.xml      |  75 ++++++
 .../samples/resilience4j/AnnotationConsumer.java   |  63 +++++
 .../samples/resilience4j/AnnotationProvider.java   |  61 +++++
 .../samples/resilience4j/EmbeddedZooKeeper.java    | 255 +++++++++++++++++++++
 .../resilience4j/action/AnnotationAction.java      |  46 ++++
 .../resilience4j/api/AnnotationService.java        |  29 +++
 .../filter/Resilience4jCircuitBreakerFilter.java   |  42 ++++
 .../resilience4j/impl/AnnotationServiceImpl.java   |  40 ++++
 .../src/main/resources/log4j.properties            |  26 +++
 .../resources/spring/dubbo-consumer.properties     |  22 ++
 .../resources/spring/dubbo-provider.properties     |  23 ++
 .../README.md                                      |  17 ++
 .../dubbo-samples-resilience4j-springboot2/pom.xml |  75 ++++++
 .../samples/resilience4j/AnnotationConsumer.java   |  63 +++++
 .../samples/resilience4j/AnnotationProvider.java   |  61 +++++
 .../samples/resilience4j/EmbeddedZooKeeper.java    | 255 +++++++++++++++++++++
 .../resilience4j/action/AnnotationAction.java      |  46 ++++
 .../resilience4j/api/AnnotationService.java        |  29 +++
 .../filter/Resilience4jCircuitBreakerFilter.java   |  42 ++++
 .../resilience4j/impl/AnnotationServiceImpl.java   |  40 ++++
 .../src/main/resources/log4j.properties            |  26 +++
 .../resources/spring/dubbo-consumer.properties     |  22 ++
 .../resources/spring/dubbo-provider.properties     |  23 ++
 dubbo-samples-resilience4j/pom.xml                 |  43 ++++
 .../samples/resilience4j/AnnotationConsumer.java   |  63 +++++
 .../samples/resilience4j/AnnotationProvider.java   |  61 +++++
 .../samples/resilience4j/EmbeddedZooKeeper.java    | 255 +++++++++++++++++++++
 .../resilience4j/action/AnnotationAction.java      |  46 ++++
 .../resilience4j/api/AnnotationService.java        |  29 +++
 .../filter/Resilience4jCircuitBreakerFilter.java   |  42 ++++
 .../resilience4j/impl/AnnotationServiceImpl.java   |  40 ++++
 .../src/main/resources/log4j.properties            |  26 +++
 .../resources/spring/dubbo-consumer.properties     |  22 ++
 .../resources/spring/dubbo-provider.properties     |  23 ++
 pom.xml                                            |   1 +
 37 files changed, 2066 insertions(+)

diff --git a/dubbo-samples-resilience4j/README.md b/dubbo-samples-resilience4j/README.md
new file mode 100644
index 0000000..12c735e
--- /dev/null
+++ b/dubbo-samples-resilience4j/README.md
@@ -0,0 +1,17 @@
+## dubbo spring hystrix sample
+
+### Start Provider
+
+Run `org.apache.dubbo.samples.annotation.AnnotationProvider`
+
+
+### Start Consumer
+
+Run `org.apache.dubbo.samples.annotation.AnnotationConsumer`
+
+### Result
+
+0. Start provider
+0. Start consumer
+0. The provider print `java.lang.RuntimeException: Exception to show hystrix enabled`. The exception stack conatins hystrix command info.
+0. The consumer print `result :hystrix fallback value`, which means hystrix fallback configuration is effect.
diff --git a/dubbo-samples-resilience4j/dubbo-samples-resilience4j-filter/README.md b/dubbo-samples-resilience4j/dubbo-samples-resilience4j-filter/README.md
new file mode 100644
index 0000000..12c735e
--- /dev/null
+++ b/dubbo-samples-resilience4j/dubbo-samples-resilience4j-filter/README.md
@@ -0,0 +1,17 @@
+## dubbo spring hystrix sample
+
+### Start Provider
+
+Run `org.apache.dubbo.samples.annotation.AnnotationProvider`
+
+
+### Start Consumer
+
+Run `org.apache.dubbo.samples.annotation.AnnotationConsumer`
+
+### Result
+
+0. Start provider
+0. Start consumer
+0. The provider print `java.lang.RuntimeException: Exception to show hystrix enabled`. The exception stack conatins hystrix command info.
+0. The consumer print `result :hystrix fallback value`, which means hystrix fallback configuration is effect.
diff --git a/dubbo-samples-resilience4j/dubbo-samples-resilience4j-filter/pom.xml b/dubbo-samples-resilience4j/dubbo-samples-resilience4j-filter/pom.xml
new file mode 100644
index 0000000..f7b6552
--- /dev/null
+++ b/dubbo-samples-resilience4j/dubbo-samples-resilience4j-filter/pom.xml
@@ -0,0 +1,75 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ~
+  ~   Licensed to the Apache Software Foundation (ASF) under one or more
+  ~   contributor license agreements.  See the NOTICE file distributed with
+  ~   this work for additional information regarding copyright ownership.
+  ~   The ASF licenses this file to You under the Apache License, Version 2.0
+  ~   (the "License"); you may not use this file except in compliance with
+  ~   the License.  You may obtain a copy of the License at
+  ~
+  ~       http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~   Unless required by applicable law or agreed to in writing, software
+  ~   distributed under the License is distributed on an "AS IS" BASIS,
+  ~   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  ~   See the License for the specific language governing permissions and
+  ~   limitations under the License.
+  ~
+  -->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <parent>
+        <artifactId>dubbo-samples-all</artifactId>
+        <groupId>org.apache.dubbo</groupId>
+        <version>1.0-SNAPSHOT</version>
+        <relativePath>../../pom.xml</relativePath>
+    </parent>
+    <modelVersion>4.0.0</modelVersion>
+
+    <artifactId>dubbo-samples-resilience4j-filter</artifactId>
+
+    <properties>
+        <resilience4j.version>0.13.1</resilience4j.version>
+    </properties>
+
+
+    <dependencies>
+        <dependency>
+            <groupId>io.github.resilience4j</groupId>
+            <artifactId>resilience4j-circuitbreaker</artifactId>
+            <version>${resilience4j.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>io.github.resilience4j</groupId>
+            <artifactId>resilience4j-ratelimiter</artifactId>
+            <version>${resilience4j.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>io.github.resilience4j</groupId>
+            <artifactId>resilience4j-retry</artifactId>
+            <version>${resilience4j.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>io.github.resilience4j</groupId>
+            <artifactId>resilience4j-bulkhead</artifactId>
+            <version>${resilience4j.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>io.github.resilience4j</groupId>
+            <artifactId>resilience4j-cache</artifactId>
+            <version>${resilience4j.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>io.github.resilience4j</groupId>
+            <artifactId>resilience4j-timelimiter</artifactId>
+            <version>${resilience4j.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.springframework</groupId>
+            <artifactId>spring-context</artifactId>
+        </dependency>
+    </dependencies>
+</project>
diff --git a/dubbo-samples-resilience4j/dubbo-samples-resilience4j-filter/src/main/java/org/apache/dubbo/samples/resilience4j/AnnotationConsumer.java b/dubbo-samples-resilience4j/dubbo-samples-resilience4j-filter/src/main/java/org/apache/dubbo/samples/resilience4j/AnnotationConsumer.java
new file mode 100644
index 0000000..d74b20a
--- /dev/null
+++ b/dubbo-samples-resilience4j/dubbo-samples-resilience4j-filter/src/main/java/org/apache/dubbo/samples/resilience4j/AnnotationConsumer.java
@@ -0,0 +1,63 @@
+/*
+ *
+ *   Licensed to the Apache Software Foundation (ASF) under one or more
+ *   contributor license agreements.  See the NOTICE file distributed with
+ *   this work for additional information regarding copyright ownership.
+ *   The ASF licenses this file to You under the Apache License, Version 2.0
+ *   (the "License"); you may not use this file except in compliance with
+ *   the License.  You may obtain a copy of the License at
+ *
+ *       http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *   Unless required by applicable law or agreed to in writing, software
+ *   distributed under the License is distributed on an "AS IS" BASIS,
+ *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *   See the License for the specific language governing permissions and
+ *   limitations under the License.
+ *
+ */
+
+package org.apache.dubbo.samples.resilience4j;
+
+import io.github.resilience4j.circuitbreaker.CircuitBreaker;
+import io.github.resilience4j.circuitbreaker.CircuitBreakerConfig;
+import io.github.resilience4j.circuitbreaker.CircuitBreakerRegistry;
+import io.github.resilience4j.circuitbreaker.utils.CircuitBreakerUtils;
+import org.apache.dubbo.config.spring.context.annotation.EnableDubbo;
+import org.apache.dubbo.samples.resilience4j.action.AnnotationAction;
+import org.springframework.context.annotation.AnnotationConfigApplicationContext;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.ComponentScan;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.context.annotation.EnableAspectJAutoProxy;
+import org.springframework.context.annotation.PropertySource;
+
+/**
+ * CallbackConsumer
+ */
+public class AnnotationConsumer {
+
+    public static void main(String[] args) throws Exception {
+        AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(ConsumerConfiguration.class);
+        context.start();
+        final AnnotationAction annotationAction = (AnnotationAction) context.getBean("annotationAction");
+        String hello = annotationAction.doSayHello("world");
+        System.err.println("result :" + hello);
+        System.in.read();
+    }
+
+    @Configuration
+    @EnableDubbo(scanBasePackages = "com.alibaba.dubbo.samples.resilience4j.action")
+    @PropertySource("classpath:/spring/dubbo-consumer.properties")
+    @ComponentScan(value = {"org.apache.dubbo.samples.resilience4j.action"})
+    @EnableAspectJAutoProxy
+    static public class ConsumerConfiguration {
+
+//        @Bean
+//        public HystrixCommandAspect hystrixCommandAspect() {
+//            return new HystrixCommandAspect();
+//        }
+
+    }
+
+}
diff --git a/dubbo-samples-resilience4j/dubbo-samples-resilience4j-filter/src/main/java/org/apache/dubbo/samples/resilience4j/AnnotationProvider.java b/dubbo-samples-resilience4j/dubbo-samples-resilience4j-filter/src/main/java/org/apache/dubbo/samples/resilience4j/AnnotationProvider.java
new file mode 100644
index 0000000..be7715d
--- /dev/null
+++ b/dubbo-samples-resilience4j/dubbo-samples-resilience4j-filter/src/main/java/org/apache/dubbo/samples/resilience4j/AnnotationProvider.java
@@ -0,0 +1,61 @@
+/*
+ *
+ *   Licensed to the Apache Software Foundation (ASF) under one or more
+ *   contributor license agreements.  See the NOTICE file distributed with
+ *   this work for additional information regarding copyright ownership.
+ *   The ASF licenses this file to You under the Apache License, Version 2.0
+ *   (the "License"); you may not use this file except in compliance with
+ *   the License.  You may obtain a copy of the License at
+ *
+ *       http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *   Unless required by applicable law or agreed to in writing, software
+ *   distributed under the License is distributed on an "AS IS" BASIS,
+ *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *   See the License for the specific language governing permissions and
+ *   limitations under the License.
+ *
+ */
+
+package org.apache.dubbo.samples.resilience4j;
+
+
+import org.apache.dubbo.config.ProviderConfig;
+import org.apache.dubbo.config.spring.context.annotation.EnableDubbo;
+import org.springframework.context.annotation.AnnotationConfigApplicationContext;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.context.annotation.EnableAspectJAutoProxy;
+import org.springframework.context.annotation.PropertySource;
+
+/**
+ * MergeProvider
+ */
+public class AnnotationProvider {
+
+    public static void main(String[] args) throws Exception {
+        new EmbeddedZooKeeper(2181, false).start();
+        AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(ProviderConfiguration.class);
+        context.start();
+        System.in.read();
+    }
+
+    @Configuration
+    @EnableDubbo(scanBasePackages = "com.alibaba.dubbo.samples.resilience4j.impl")
+    @PropertySource("classpath:/spring/dubbo-provider.properties")
+    @EnableAspectJAutoProxy
+    static public class ProviderConfiguration {
+        @Bean
+        public ProviderConfig providerConfig() {
+            ProviderConfig providerConfig = new ProviderConfig();
+            providerConfig.setTimeout(1000);
+            return providerConfig;
+        }
+
+//        @Bean
+//        public HystrixCommandAspect hystrixCommandAspect() {
+//            return new HystrixCommandAspect();
+//        }
+    }
+
+}
diff --git a/dubbo-samples-resilience4j/dubbo-samples-resilience4j-filter/src/main/java/org/apache/dubbo/samples/resilience4j/EmbeddedZooKeeper.java b/dubbo-samples-resilience4j/dubbo-samples-resilience4j-filter/src/main/java/org/apache/dubbo/samples/resilience4j/EmbeddedZooKeeper.java
new file mode 100644
index 0000000..9c8ae8a
--- /dev/null
+++ b/dubbo-samples-resilience4j/dubbo-samples-resilience4j-filter/src/main/java/org/apache/dubbo/samples/resilience4j/EmbeddedZooKeeper.java
@@ -0,0 +1,255 @@
+/*
+ * Copyright 2014 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.dubbo.samples.resilience4j;
+
+import java.io.File;
+import java.lang.reflect.Method;
+import java.util.Properties;
+import java.util.UUID;
+
+import org.apache.zookeeper.server.ServerConfig;
+import org.apache.zookeeper.server.ZooKeeperServerMain;
+import org.apache.zookeeper.server.quorum.QuorumPeerConfig;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.context.SmartLifecycle;
+import org.springframework.util.ErrorHandler;
+import org.springframework.util.SocketUtils;
+
+/**
+ * from: https://github.com/spring-projects/spring-xd/blob/v1.3.1.RELEASE/spring-xd-dirt/src/main/java/org/springframework/xd/dirt/zookeeper/ZooKeeperUtils.java
+ *
+ * Helper class to start an embedded instance of standalone (non clustered) ZooKeeper.
+ *
+ * NOTE: at least an external standalone server (if not an ensemble) are recommended, even for
+ * {@link org.springframework.xd.dirt.server.singlenode.SingleNodeApplication}
+ *
+ * @author Patrick Peralta
+ * @author Mark Fisher
+ * @author David Turanski
+ */
+public class EmbeddedZooKeeper implements SmartLifecycle {
+
+    /**
+     * Logger.
+     */
+    private static final Logger logger = LoggerFactory.getLogger(EmbeddedZooKeeper.class);
+
+    /**
+     * ZooKeeper client port. This will be determined dynamically upon startup.
+     */
+    private final int clientPort;
+
+    /**
+     * Whether to auto-start. Default is true.
+     */
+    private boolean autoStartup = true;
+
+    /**
+     * Lifecycle phase. Default is 0.
+     */
+    private int phase = 0;
+
+    /**
+     * Thread for running the ZooKeeper server.
+     */
+    private volatile Thread zkServerThread;
+
+    /**
+     * ZooKeeper server.
+     */
+    private volatile ZooKeeperServerMain zkServer;
+
+    /**
+     * {@link ErrorHandler} to be invoked if an Exception is thrown from the ZooKeeper server thread.
+     */
+    private ErrorHandler errorHandler;
+
+    private boolean daemon = true;
+
+    /**
+     * Construct an EmbeddedZooKeeper with a random port.
+     */
+    public EmbeddedZooKeeper() {
+        clientPort = SocketUtils.findAvailableTcpPort();
+    }
+
+    /**
+     * Construct an EmbeddedZooKeeper with the provided port.
+     *
+     * @param clientPort  port for ZooKeeper server to bind to
+     */
+    public EmbeddedZooKeeper(int clientPort, boolean daemon) {
+        this.clientPort = clientPort;
+        this.daemon = daemon;
+    }
+
+    /**
+     * Returns the port that clients should use to connect to this embedded server.
+     *
+     * @return dynamically determined client port
+     */
+    public int getClientPort() {
+        return this.clientPort;
+    }
+
+    /**
+     * Specify whether to start automatically. Default is true.
+     *
+     * @param autoStartup whether to start automatically
+     */
+    public void setAutoStartup(boolean autoStartup) {
+        this.autoStartup = autoStartup;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public boolean isAutoStartup() {
+        return this.autoStartup;
+    }
+
+    /**
+     * Specify the lifecycle phase for the embedded server.
+     *
+     * @param phase the lifecycle phase
+     */
+    public void setPhase(int phase) {
+        this.phase = phase;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public int getPhase() {
+        return this.phase;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public boolean isRunning() {
+        return (zkServerThread != null);
+    }
+
+    /**
+     * Start the ZooKeeper server in a background thread.
+     * <p>
+     * Register an error handler via {@link #setErrorHandler} in order to handle
+     * any exceptions thrown during startup or execution.
+     */
+    @Override
+    public synchronized void start() {
+        if (zkServerThread == null) {
+            zkServerThread = new Thread(new ServerRunnable(), "ZooKeeper Server Starter");
+            zkServerThread.setDaemon(daemon);
+            zkServerThread.start();
+        }
+    }
+
+    /**
+     * Shutdown the ZooKeeper server.
+     */
+    @Override
+    public synchronized void stop() {
+        if (zkServerThread != null) {
+            // The shutdown method is protected...thus this hack to invoke it.
+            // This will log an exception on shutdown; see
+            // https://issues.apache.org/jira/browse/ZOOKEEPER-1873 for details.
+            try {
+                Method shutdown = ZooKeeperServerMain.class.getDeclaredMethod("shutdown");
+                shutdown.setAccessible(true);
+                shutdown.invoke(zkServer);
+            }
+
+            catch (Exception e) {
+                throw new RuntimeException(e);
+            }
+
+            // It is expected that the thread will exit after
+            // the server is shutdown; this will block until
+            // the shutdown is complete.
+            try {
+                zkServerThread.join(5000);
+                zkServerThread = null;
+            }
+            catch (InterruptedException e) {
+                Thread.currentThread().interrupt();
+                logger.warn("Interrupted while waiting for embedded ZooKeeper to exit");
+                // abandoning zk thread
+                zkServerThread = null;
+            }
+        }
+    }
+
+    /**
+     * Stop the server if running and invoke the callback when complete.
+     */
+    @Override
+    public void stop(Runnable callback) {
+        stop();
+        callback.run();
+    }
+
+    /**
+     * Provide an {@link ErrorHandler} to be invoked if an Exception is thrown from the ZooKeeper server thread. If none
+     * is provided, only error-level logging will occur.
+     *
+     * @param errorHandler the {@link ErrorHandler} to be invoked
+     */
+    public void setErrorHandler(ErrorHandler errorHandler) {
+        this.errorHandler = errorHandler;
+    }
+
+    /**
+     * Runnable implementation that starts the ZooKeeper server.
+     */
+    private class ServerRunnable implements Runnable {
+
+        @Override
+        public void run() {
+            try {
+                Properties properties = new Properties();
+                File file = new File(System.getProperty("java.io.tmpdir")
+                    + File.separator + UUID.randomUUID());
+                file.deleteOnExit();
+                properties.setProperty("dataDir", file.getAbsolutePath());
+                properties.setProperty("clientPort", String.valueOf(clientPort));
+
+                QuorumPeerConfig quorumPeerConfig = new QuorumPeerConfig();
+                quorumPeerConfig.parseProperties(properties);
+
+                zkServer = new ZooKeeperServerMain();
+                ServerConfig configuration = new ServerConfig();
+                configuration.readFrom(quorumPeerConfig);
+
+                zkServer.runFromConfig(configuration);
+            }
+            catch (Exception e) {
+                if (errorHandler != null) {
+                    errorHandler.handleError(e);
+                }
+                else {
+                    logger.error("Exception running embedded ZooKeeper", e);
+                }
+            }
+        }
+    }
+
+}
diff --git a/dubbo-samples-resilience4j/dubbo-samples-resilience4j-filter/src/main/java/org/apache/dubbo/samples/resilience4j/action/AnnotationAction.java b/dubbo-samples-resilience4j/dubbo-samples-resilience4j-filter/src/main/java/org/apache/dubbo/samples/resilience4j/action/AnnotationAction.java
new file mode 100644
index 0000000..785c9eb
--- /dev/null
+++ b/dubbo-samples-resilience4j/dubbo-samples-resilience4j-filter/src/main/java/org/apache/dubbo/samples/resilience4j/action/AnnotationAction.java
@@ -0,0 +1,46 @@
+/*
+ *
+ *   Licensed to the Apache Software Foundation (ASF) under one or more
+ *   contributor license agreements.  See the NOTICE file distributed with
+ *   this work for additional information regarding copyright ownership.
+ *   The ASF licenses this file to You under the Apache License, Version 2.0
+ *   (the "License"); you may not use this file except in compliance with
+ *   the License.  You may obtain a copy of the License at
+ *
+ *       http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *   Unless required by applicable law or agreed to in writing, software
+ *   distributed under the License is distributed on an "AS IS" BASIS,
+ *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *   See the License for the specific language governing permissions and
+ *   limitations under the License.
+ *
+ */
+
+package org.apache.dubbo.samples.resilience4j.action;
+
+import org.apache.dubbo.config.annotation.Reference;
+
+
+import org.apache.dubbo.samples.resilience4j.api.AnnotationService;
+import org.springframework.stereotype.Component;
+
+/**
+ * AnnotationAction
+ */
+@Component("annotationAction")
+public class AnnotationAction {
+
+    @Reference
+    private AnnotationService annotationService;
+
+//    @HystrixCommand(fallbackMethod = "reliable")
+    public String doSayHello(String name) {
+        return annotationService.sayHello(name);
+    }
+
+    public String reliable(String name) {
+        return "hystrix fallback value";
+    }
+
+}
diff --git a/dubbo-samples-resilience4j/dubbo-samples-resilience4j-filter/src/main/java/org/apache/dubbo/samples/resilience4j/api/AnnotationService.java b/dubbo-samples-resilience4j/dubbo-samples-resilience4j-filter/src/main/java/org/apache/dubbo/samples/resilience4j/api/AnnotationService.java
new file mode 100644
index 0000000..74b849a
--- /dev/null
+++ b/dubbo-samples-resilience4j/dubbo-samples-resilience4j-filter/src/main/java/org/apache/dubbo/samples/resilience4j/api/AnnotationService.java
@@ -0,0 +1,29 @@
+/*
+ *
+ *   Licensed to the Apache Software Foundation (ASF) under one or more
+ *   contributor license agreements.  See the NOTICE file distributed with
+ *   this work for additional information regarding copyright ownership.
+ *   The ASF licenses this file to You under the Apache License, Version 2.0
+ *   (the "License"); you may not use this file except in compliance with
+ *   the License.  You may obtain a copy of the License at
+ *
+ *       http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *   Unless required by applicable law or agreed to in writing, software
+ *   distributed under the License is distributed on an "AS IS" BASIS,
+ *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *   See the License for the specific language governing permissions and
+ *   limitations under the License.
+ *
+ */
+
+package org.apache.dubbo.samples.resilience4j.api;
+
+/**
+ * AsyncService
+ */
+public interface AnnotationService {
+
+    String sayHello(String name);
+
+}
diff --git a/dubbo-samples-resilience4j/dubbo-samples-resilience4j-filter/src/main/java/org/apache/dubbo/samples/resilience4j/filter/Resilience4jCircuitBreakerFilter.java b/dubbo-samples-resilience4j/dubbo-samples-resilience4j-filter/src/main/java/org/apache/dubbo/samples/resilience4j/filter/Resilience4jCircuitBreakerFilter.java
new file mode 100644
index 0000000..7b795cf
--- /dev/null
+++ b/dubbo-samples-resilience4j/dubbo-samples-resilience4j-filter/src/main/java/org/apache/dubbo/samples/resilience4j/filter/Resilience4jCircuitBreakerFilter.java
@@ -0,0 +1,42 @@
+package org.apache.dubbo.samples.resilience4j.filter;
+
+import io.github.resilience4j.circuitbreaker.CircuitBreaker;
+import io.github.resilience4j.circuitbreaker.CircuitBreakerConfig;
+import io.github.resilience4j.circuitbreaker.CircuitBreakerRegistry;
+import org.apache.dubbo.rpc.Filter;
+import org.apache.dubbo.rpc.Invocation;
+import org.apache.dubbo.rpc.Invoker;
+import org.apache.dubbo.rpc.Result;
+import org.apache.dubbo.rpc.RpcException;
+
+/**
+ * @author cvictory ON 2018/12/25
+ */
+public class Resilience4jCircuitBreakerFilter implements Filter {
+
+    static CircuitBreaker circuitBreaker;
+
+    static {
+        CircuitBreakerConfig config = CircuitBreakerConfig.custom()
+                .failureRateThreshold(20)
+                .ringBufferSizeInClosedState(5)
+                .build();
+        CircuitBreakerRegistry registry = CircuitBreakerRegistry.of(config);
+        circuitBreaker = registry.circuitBreaker("my");
+    }
+
+    @Override
+    public Result invoke(Invoker<?> invoker, Invocation invocation) throws RpcException {
+        long start = System.nanoTime();
+        try {
+            Result result = invoker.invoke(invocation);
+            long durationInNanos = System.nanoTime() - start;
+            circuitBreaker.onSuccess(durationInNanos);
+            return result;
+        } catch (Throwable throwable) {
+            long durationInNanos = System.nanoTime() - start;
+            circuitBreaker.onError(durationInNanos, throwable);
+            throw throwable;
+        }
+    }
+}
diff --git a/dubbo-samples-resilience4j/dubbo-samples-resilience4j-filter/src/main/java/org/apache/dubbo/samples/resilience4j/impl/AnnotationServiceImpl.java b/dubbo-samples-resilience4j/dubbo-samples-resilience4j-filter/src/main/java/org/apache/dubbo/samples/resilience4j/impl/AnnotationServiceImpl.java
new file mode 100644
index 0000000..cc2e9f7
--- /dev/null
+++ b/dubbo-samples-resilience4j/dubbo-samples-resilience4j-filter/src/main/java/org/apache/dubbo/samples/resilience4j/impl/AnnotationServiceImpl.java
@@ -0,0 +1,40 @@
+/*
+ *
+ *   Licensed to the Apache Software Foundation (ASF) under one or more
+ *   contributor license agreements.  See the NOTICE file distributed with
+ *   this work for additional information regarding copyright ownership.
+ *   The ASF licenses this file to You under the Apache License, Version 2.0
+ *   (the "License"); you may not use this file except in compliance with
+ *   the License.  You may obtain a copy of the License at
+ *
+ *       http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *   Unless required by applicable law or agreed to in writing, software
+ *   distributed under the License is distributed on an "AS IS" BASIS,
+ *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *   See the License for the specific language governing permissions and
+ *   limitations under the License.
+ *
+ */
+
+package org.apache.dubbo.samples.resilience4j.impl;
+
+import org.apache.dubbo.config.annotation.Service;
+import org.apache.dubbo.samples.resilience4j.api.AnnotationService;
+
+/**
+ * AsyncServiceImpl
+ */
+@Service
+public class AnnotationServiceImpl implements AnnotationService {
+
+//    @HystrixCommand(commandProperties = { @HystrixProperty(name = "circuitBreaker.requestVolumeThreshold", value = "10"),
+//                    @HystrixProperty(name = "execution.isolation.thread.timeoutInMilliseconds", value = "2000") })
+    @Override
+    public String sayHello(String name) {
+//        System.out.println("async provider received: " + name);
+//        return "annotation: hello, " + name;
+        throw new RuntimeException("Exception to show hystrix enabled.");
+    }
+
+}
diff --git a/dubbo-samples-resilience4j/dubbo-samples-resilience4j-filter/src/main/resources/log4j.properties b/dubbo-samples-resilience4j/dubbo-samples-resilience4j-filter/src/main/resources/log4j.properties
new file mode 100644
index 0000000..d6ecd5c
--- /dev/null
+++ b/dubbo-samples-resilience4j/dubbo-samples-resilience4j-filter/src/main/resources/log4j.properties
@@ -0,0 +1,26 @@
+#
+#
+#   Licensed to the Apache Software Foundation (ASF) under one or more
+#   contributor license agreements.  See the NOTICE file distributed with
+#   this work for additional information regarding copyright ownership.
+#   The ASF licenses this file to You under the Apache License, Version 2.0
+#   (the "License"); you may not use this file except in compliance with
+#   the License.  You may obtain a copy of the License at
+#
+#       http://www.apache.org/licenses/LICENSE-2.0
+#
+#   Unless required by applicable law or agreed to in writing, software
+#   distributed under the License is distributed on an "AS IS" BASIS,
+#   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+#   See the License for the specific language governing permissions and
+#   limitations under the License.
+#
+#
+
+###set log levels###
+log4j.rootLogger=info, stdout
+###output to the console###
+log4j.appender.stdout=org.apache.log4j.ConsoleAppender
+log4j.appender.stdout.Target=System.out
+log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
+log4j.appender.stdout.layout.ConversionPattern=[%d{dd/MM/yy hh:mm:ss:sss z}] %t %5p %c{2}: %m%n
\ No newline at end of file
diff --git a/dubbo-samples-resilience4j/dubbo-samples-resilience4j-filter/src/main/resources/spring/dubbo-consumer.properties b/dubbo-samples-resilience4j/dubbo-samples-resilience4j-filter/src/main/resources/spring/dubbo-consumer.properties
new file mode 100644
index 0000000..96ab667
--- /dev/null
+++ b/dubbo-samples-resilience4j/dubbo-samples-resilience4j-filter/src/main/resources/spring/dubbo-consumer.properties
@@ -0,0 +1,22 @@
+#
+#
+#   Licensed to the Apache Software Foundation (ASF) under one or more
+#   contributor license agreements.  See the NOTICE file distributed with
+#   this work for additional information regarding copyright ownership.
+#   The ASF licenses this file to You under the Apache License, Version 2.0
+#   (the "License"); you may not use this file except in compliance with
+#   the License.  You may obtain a copy of the License at
+#  
+#       http://www.apache.org/licenses/LICENSE-2.0
+#  
+#   Unless required by applicable law or agreed to in writing, software
+#   distributed under the License is distributed on an "AS IS" BASIS,
+#   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+#   See the License for the specific language governing permissions and
+#   limitations under the License.
+#  
+#
+
+dubbo.application.name=annotation-consumer
+dubbo.registry.address=zookeeper://127.0.0.1:2181
+dubbo.consumer.timeout=3000
\ No newline at end of file
diff --git a/dubbo-samples-resilience4j/dubbo-samples-resilience4j-filter/src/main/resources/spring/dubbo-provider.properties b/dubbo-samples-resilience4j/dubbo-samples-resilience4j-filter/src/main/resources/spring/dubbo-provider.properties
new file mode 100644
index 0000000..51fccca
--- /dev/null
+++ b/dubbo-samples-resilience4j/dubbo-samples-resilience4j-filter/src/main/resources/spring/dubbo-provider.properties
@@ -0,0 +1,23 @@
+#
+#
+#   Licensed to the Apache Software Foundation (ASF) under one or more
+#   contributor license agreements.  See the NOTICE file distributed with
+#   this work for additional information regarding copyright ownership.
+#   The ASF licenses this file to You under the Apache License, Version 2.0
+#   (the "License"); you may not use this file except in compliance with
+#   the License.  You may obtain a copy of the License at
+#  
+#       http://www.apache.org/licenses/LICENSE-2.0
+#  
+#   Unless required by applicable law or agreed to in writing, software
+#   distributed under the License is distributed on an "AS IS" BASIS,
+#   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+#   See the License for the specific language governing permissions and
+#   limitations under the License.
+#  
+#
+
+dubbo.application.name=annotation-provider
+dubbo.registry.address=zookeeper://127.0.0.1:2181
+dubbo.protocol.name=dubbo
+dubbo.protocol.port=20880
\ No newline at end of file
diff --git a/dubbo-samples-resilience4j/dubbo-samples-resilience4j-springboot2/README.md b/dubbo-samples-resilience4j/dubbo-samples-resilience4j-springboot2/README.md
new file mode 100644
index 0000000..12c735e
--- /dev/null
+++ b/dubbo-samples-resilience4j/dubbo-samples-resilience4j-springboot2/README.md
@@ -0,0 +1,17 @@
+## dubbo spring hystrix sample
+
+### Start Provider
+
+Run `org.apache.dubbo.samples.annotation.AnnotationProvider`
+
+
+### Start Consumer
+
+Run `org.apache.dubbo.samples.annotation.AnnotationConsumer`
+
+### Result
+
+0. Start provider
+0. Start consumer
+0. The provider print `java.lang.RuntimeException: Exception to show hystrix enabled`. The exception stack conatins hystrix command info.
+0. The consumer print `result :hystrix fallback value`, which means hystrix fallback configuration is effect.
diff --git a/dubbo-samples-resilience4j/dubbo-samples-resilience4j-springboot2/pom.xml b/dubbo-samples-resilience4j/dubbo-samples-resilience4j-springboot2/pom.xml
new file mode 100644
index 0000000..862a475
--- /dev/null
+++ b/dubbo-samples-resilience4j/dubbo-samples-resilience4j-springboot2/pom.xml
@@ -0,0 +1,75 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ~
+  ~   Licensed to the Apache Software Foundation (ASF) under one or more
+  ~   contributor license agreements.  See the NOTICE file distributed with
+  ~   this work for additional information regarding copyright ownership.
+  ~   The ASF licenses this file to You under the Apache License, Version 2.0
+  ~   (the "License"); you may not use this file except in compliance with
+  ~   the License.  You may obtain a copy of the License at
+  ~
+  ~       http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~   Unless required by applicable law or agreed to in writing, software
+  ~   distributed under the License is distributed on an "AS IS" BASIS,
+  ~   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  ~   See the License for the specific language governing permissions and
+  ~   limitations under the License.
+  ~
+  -->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <parent>
+        <artifactId>dubbo-samples-all</artifactId>
+        <groupId>org.apache.dubbo</groupId>
+        <version>1.0-SNAPSHOT</version>
+        <relativePath>../../pom.xml</relativePath>
+    </parent>
+    <modelVersion>4.0.0</modelVersion>
+
+    <artifactId>dubbo-samples-resilience4j-springboot2</artifactId>
+
+    <properties>
+        <resilience4j.version>0.13.1</resilience4j.version>
+    </properties>
+
+
+    <dependencies>
+        <dependency>
+            <groupId>io.github.resilience4j</groupId>
+            <artifactId>resilience4j-circuitbreaker</artifactId>
+            <version>${resilience4j.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>io.github.resilience4j</groupId>
+            <artifactId>resilience4j-ratelimiter</artifactId>
+            <version>${resilience4j.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>io.github.resilience4j</groupId>
+            <artifactId>resilience4j-retry</artifactId>
+            <version>${resilience4j.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>io.github.resilience4j</groupId>
+            <artifactId>resilience4j-bulkhead</artifactId>
+            <version>${resilience4j.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>io.github.resilience4j</groupId>
+            <artifactId>resilience4j-cache</artifactId>
+            <version>${resilience4j.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>io.github.resilience4j</groupId>
+            <artifactId>resilience4j-timelimiter</artifactId>
+            <version>${resilience4j.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.springframework</groupId>
+            <artifactId>spring-context</artifactId>
+        </dependency>
+    </dependencies>
+</project>
diff --git a/dubbo-samples-resilience4j/dubbo-samples-resilience4j-springboot2/src/main/java/org/apache/dubbo/samples/resilience4j/AnnotationConsumer.java b/dubbo-samples-resilience4j/dubbo-samples-resilience4j-springboot2/src/main/java/org/apache/dubbo/samples/resilience4j/AnnotationConsumer.java
new file mode 100644
index 0000000..d74b20a
--- /dev/null
+++ b/dubbo-samples-resilience4j/dubbo-samples-resilience4j-springboot2/src/main/java/org/apache/dubbo/samples/resilience4j/AnnotationConsumer.java
@@ -0,0 +1,63 @@
+/*
+ *
+ *   Licensed to the Apache Software Foundation (ASF) under one or more
+ *   contributor license agreements.  See the NOTICE file distributed with
+ *   this work for additional information regarding copyright ownership.
+ *   The ASF licenses this file to You under the Apache License, Version 2.0
+ *   (the "License"); you may not use this file except in compliance with
+ *   the License.  You may obtain a copy of the License at
+ *
+ *       http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *   Unless required by applicable law or agreed to in writing, software
+ *   distributed under the License is distributed on an "AS IS" BASIS,
+ *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *   See the License for the specific language governing permissions and
+ *   limitations under the License.
+ *
+ */
+
+package org.apache.dubbo.samples.resilience4j;
+
+import io.github.resilience4j.circuitbreaker.CircuitBreaker;
+import io.github.resilience4j.circuitbreaker.CircuitBreakerConfig;
+import io.github.resilience4j.circuitbreaker.CircuitBreakerRegistry;
+import io.github.resilience4j.circuitbreaker.utils.CircuitBreakerUtils;
+import org.apache.dubbo.config.spring.context.annotation.EnableDubbo;
+import org.apache.dubbo.samples.resilience4j.action.AnnotationAction;
+import org.springframework.context.annotation.AnnotationConfigApplicationContext;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.ComponentScan;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.context.annotation.EnableAspectJAutoProxy;
+import org.springframework.context.annotation.PropertySource;
+
+/**
+ * CallbackConsumer
+ */
+public class AnnotationConsumer {
+
+    public static void main(String[] args) throws Exception {
+        AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(ConsumerConfiguration.class);
+        context.start();
+        final AnnotationAction annotationAction = (AnnotationAction) context.getBean("annotationAction");
+        String hello = annotationAction.doSayHello("world");
+        System.err.println("result :" + hello);
+        System.in.read();
+    }
+
+    @Configuration
+    @EnableDubbo(scanBasePackages = "com.alibaba.dubbo.samples.resilience4j.action")
+    @PropertySource("classpath:/spring/dubbo-consumer.properties")
+    @ComponentScan(value = {"org.apache.dubbo.samples.resilience4j.action"})
+    @EnableAspectJAutoProxy
+    static public class ConsumerConfiguration {
+
+//        @Bean
+//        public HystrixCommandAspect hystrixCommandAspect() {
+//            return new HystrixCommandAspect();
+//        }
+
+    }
+
+}
diff --git a/dubbo-samples-resilience4j/dubbo-samples-resilience4j-springboot2/src/main/java/org/apache/dubbo/samples/resilience4j/AnnotationProvider.java b/dubbo-samples-resilience4j/dubbo-samples-resilience4j-springboot2/src/main/java/org/apache/dubbo/samples/resilience4j/AnnotationProvider.java
new file mode 100644
index 0000000..be7715d
--- /dev/null
+++ b/dubbo-samples-resilience4j/dubbo-samples-resilience4j-springboot2/src/main/java/org/apache/dubbo/samples/resilience4j/AnnotationProvider.java
@@ -0,0 +1,61 @@
+/*
+ *
+ *   Licensed to the Apache Software Foundation (ASF) under one or more
+ *   contributor license agreements.  See the NOTICE file distributed with
+ *   this work for additional information regarding copyright ownership.
+ *   The ASF licenses this file to You under the Apache License, Version 2.0
+ *   (the "License"); you may not use this file except in compliance with
+ *   the License.  You may obtain a copy of the License at
+ *
+ *       http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *   Unless required by applicable law or agreed to in writing, software
+ *   distributed under the License is distributed on an "AS IS" BASIS,
+ *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *   See the License for the specific language governing permissions and
+ *   limitations under the License.
+ *
+ */
+
+package org.apache.dubbo.samples.resilience4j;
+
+
+import org.apache.dubbo.config.ProviderConfig;
+import org.apache.dubbo.config.spring.context.annotation.EnableDubbo;
+import org.springframework.context.annotation.AnnotationConfigApplicationContext;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.context.annotation.EnableAspectJAutoProxy;
+import org.springframework.context.annotation.PropertySource;
+
+/**
+ * MergeProvider
+ */
+public class AnnotationProvider {
+
+    public static void main(String[] args) throws Exception {
+        new EmbeddedZooKeeper(2181, false).start();
+        AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(ProviderConfiguration.class);
+        context.start();
+        System.in.read();
+    }
+
+    @Configuration
+    @EnableDubbo(scanBasePackages = "com.alibaba.dubbo.samples.resilience4j.impl")
+    @PropertySource("classpath:/spring/dubbo-provider.properties")
+    @EnableAspectJAutoProxy
+    static public class ProviderConfiguration {
+        @Bean
+        public ProviderConfig providerConfig() {
+            ProviderConfig providerConfig = new ProviderConfig();
+            providerConfig.setTimeout(1000);
+            return providerConfig;
+        }
+
+//        @Bean
+//        public HystrixCommandAspect hystrixCommandAspect() {
+//            return new HystrixCommandAspect();
+//        }
+    }
+
+}
diff --git a/dubbo-samples-resilience4j/dubbo-samples-resilience4j-springboot2/src/main/java/org/apache/dubbo/samples/resilience4j/EmbeddedZooKeeper.java b/dubbo-samples-resilience4j/dubbo-samples-resilience4j-springboot2/src/main/java/org/apache/dubbo/samples/resilience4j/EmbeddedZooKeeper.java
new file mode 100644
index 0000000..9c8ae8a
--- /dev/null
+++ b/dubbo-samples-resilience4j/dubbo-samples-resilience4j-springboot2/src/main/java/org/apache/dubbo/samples/resilience4j/EmbeddedZooKeeper.java
@@ -0,0 +1,255 @@
+/*
+ * Copyright 2014 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.dubbo.samples.resilience4j;
+
+import java.io.File;
+import java.lang.reflect.Method;
+import java.util.Properties;
+import java.util.UUID;
+
+import org.apache.zookeeper.server.ServerConfig;
+import org.apache.zookeeper.server.ZooKeeperServerMain;
+import org.apache.zookeeper.server.quorum.QuorumPeerConfig;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.context.SmartLifecycle;
+import org.springframework.util.ErrorHandler;
+import org.springframework.util.SocketUtils;
+
+/**
+ * from: https://github.com/spring-projects/spring-xd/blob/v1.3.1.RELEASE/spring-xd-dirt/src/main/java/org/springframework/xd/dirt/zookeeper/ZooKeeperUtils.java
+ *
+ * Helper class to start an embedded instance of standalone (non clustered) ZooKeeper.
+ *
+ * NOTE: at least an external standalone server (if not an ensemble) are recommended, even for
+ * {@link org.springframework.xd.dirt.server.singlenode.SingleNodeApplication}
+ *
+ * @author Patrick Peralta
+ * @author Mark Fisher
+ * @author David Turanski
+ */
+public class EmbeddedZooKeeper implements SmartLifecycle {
+
+    /**
+     * Logger.
+     */
+    private static final Logger logger = LoggerFactory.getLogger(EmbeddedZooKeeper.class);
+
+    /**
+     * ZooKeeper client port. This will be determined dynamically upon startup.
+     */
+    private final int clientPort;
+
+    /**
+     * Whether to auto-start. Default is true.
+     */
+    private boolean autoStartup = true;
+
+    /**
+     * Lifecycle phase. Default is 0.
+     */
+    private int phase = 0;
+
+    /**
+     * Thread for running the ZooKeeper server.
+     */
+    private volatile Thread zkServerThread;
+
+    /**
+     * ZooKeeper server.
+     */
+    private volatile ZooKeeperServerMain zkServer;
+
+    /**
+     * {@link ErrorHandler} to be invoked if an Exception is thrown from the ZooKeeper server thread.
+     */
+    private ErrorHandler errorHandler;
+
+    private boolean daemon = true;
+
+    /**
+     * Construct an EmbeddedZooKeeper with a random port.
+     */
+    public EmbeddedZooKeeper() {
+        clientPort = SocketUtils.findAvailableTcpPort();
+    }
+
+    /**
+     * Construct an EmbeddedZooKeeper with the provided port.
+     *
+     * @param clientPort  port for ZooKeeper server to bind to
+     */
+    public EmbeddedZooKeeper(int clientPort, boolean daemon) {
+        this.clientPort = clientPort;
+        this.daemon = daemon;
+    }
+
+    /**
+     * Returns the port that clients should use to connect to this embedded server.
+     *
+     * @return dynamically determined client port
+     */
+    public int getClientPort() {
+        return this.clientPort;
+    }
+
+    /**
+     * Specify whether to start automatically. Default is true.
+     *
+     * @param autoStartup whether to start automatically
+     */
+    public void setAutoStartup(boolean autoStartup) {
+        this.autoStartup = autoStartup;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public boolean isAutoStartup() {
+        return this.autoStartup;
+    }
+
+    /**
+     * Specify the lifecycle phase for the embedded server.
+     *
+     * @param phase the lifecycle phase
+     */
+    public void setPhase(int phase) {
+        this.phase = phase;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public int getPhase() {
+        return this.phase;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public boolean isRunning() {
+        return (zkServerThread != null);
+    }
+
+    /**
+     * Start the ZooKeeper server in a background thread.
+     * <p>
+     * Register an error handler via {@link #setErrorHandler} in order to handle
+     * any exceptions thrown during startup or execution.
+     */
+    @Override
+    public synchronized void start() {
+        if (zkServerThread == null) {
+            zkServerThread = new Thread(new ServerRunnable(), "ZooKeeper Server Starter");
+            zkServerThread.setDaemon(daemon);
+            zkServerThread.start();
+        }
+    }
+
+    /**
+     * Shutdown the ZooKeeper server.
+     */
+    @Override
+    public synchronized void stop() {
+        if (zkServerThread != null) {
+            // The shutdown method is protected...thus this hack to invoke it.
+            // This will log an exception on shutdown; see
+            // https://issues.apache.org/jira/browse/ZOOKEEPER-1873 for details.
+            try {
+                Method shutdown = ZooKeeperServerMain.class.getDeclaredMethod("shutdown");
+                shutdown.setAccessible(true);
+                shutdown.invoke(zkServer);
+            }
+
+            catch (Exception e) {
+                throw new RuntimeException(e);
+            }
+
+            // It is expected that the thread will exit after
+            // the server is shutdown; this will block until
+            // the shutdown is complete.
+            try {
+                zkServerThread.join(5000);
+                zkServerThread = null;
+            }
+            catch (InterruptedException e) {
+                Thread.currentThread().interrupt();
+                logger.warn("Interrupted while waiting for embedded ZooKeeper to exit");
+                // abandoning zk thread
+                zkServerThread = null;
+            }
+        }
+    }
+
+    /**
+     * Stop the server if running and invoke the callback when complete.
+     */
+    @Override
+    public void stop(Runnable callback) {
+        stop();
+        callback.run();
+    }
+
+    /**
+     * Provide an {@link ErrorHandler} to be invoked if an Exception is thrown from the ZooKeeper server thread. If none
+     * is provided, only error-level logging will occur.
+     *
+     * @param errorHandler the {@link ErrorHandler} to be invoked
+     */
+    public void setErrorHandler(ErrorHandler errorHandler) {
+        this.errorHandler = errorHandler;
+    }
+
+    /**
+     * Runnable implementation that starts the ZooKeeper server.
+     */
+    private class ServerRunnable implements Runnable {
+
+        @Override
+        public void run() {
+            try {
+                Properties properties = new Properties();
+                File file = new File(System.getProperty("java.io.tmpdir")
+                    + File.separator + UUID.randomUUID());
+                file.deleteOnExit();
+                properties.setProperty("dataDir", file.getAbsolutePath());
+                properties.setProperty("clientPort", String.valueOf(clientPort));
+
+                QuorumPeerConfig quorumPeerConfig = new QuorumPeerConfig();
+                quorumPeerConfig.parseProperties(properties);
+
+                zkServer = new ZooKeeperServerMain();
+                ServerConfig configuration = new ServerConfig();
+                configuration.readFrom(quorumPeerConfig);
+
+                zkServer.runFromConfig(configuration);
+            }
+            catch (Exception e) {
+                if (errorHandler != null) {
+                    errorHandler.handleError(e);
+                }
+                else {
+                    logger.error("Exception running embedded ZooKeeper", e);
+                }
+            }
+        }
+    }
+
+}
diff --git a/dubbo-samples-resilience4j/dubbo-samples-resilience4j-springboot2/src/main/java/org/apache/dubbo/samples/resilience4j/action/AnnotationAction.java b/dubbo-samples-resilience4j/dubbo-samples-resilience4j-springboot2/src/main/java/org/apache/dubbo/samples/resilience4j/action/AnnotationAction.java
new file mode 100644
index 0000000..785c9eb
--- /dev/null
+++ b/dubbo-samples-resilience4j/dubbo-samples-resilience4j-springboot2/src/main/java/org/apache/dubbo/samples/resilience4j/action/AnnotationAction.java
@@ -0,0 +1,46 @@
+/*
+ *
+ *   Licensed to the Apache Software Foundation (ASF) under one or more
+ *   contributor license agreements.  See the NOTICE file distributed with
+ *   this work for additional information regarding copyright ownership.
+ *   The ASF licenses this file to You under the Apache License, Version 2.0
+ *   (the "License"); you may not use this file except in compliance with
+ *   the License.  You may obtain a copy of the License at
+ *
+ *       http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *   Unless required by applicable law or agreed to in writing, software
+ *   distributed under the License is distributed on an "AS IS" BASIS,
+ *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *   See the License for the specific language governing permissions and
+ *   limitations under the License.
+ *
+ */
+
+package org.apache.dubbo.samples.resilience4j.action;
+
+import org.apache.dubbo.config.annotation.Reference;
+
+
+import org.apache.dubbo.samples.resilience4j.api.AnnotationService;
+import org.springframework.stereotype.Component;
+
+/**
+ * AnnotationAction
+ */
+@Component("annotationAction")
+public class AnnotationAction {
+
+    @Reference
+    private AnnotationService annotationService;
+
+//    @HystrixCommand(fallbackMethod = "reliable")
+    public String doSayHello(String name) {
+        return annotationService.sayHello(name);
+    }
+
+    public String reliable(String name) {
+        return "hystrix fallback value";
+    }
+
+}
diff --git a/dubbo-samples-resilience4j/dubbo-samples-resilience4j-springboot2/src/main/java/org/apache/dubbo/samples/resilience4j/api/AnnotationService.java b/dubbo-samples-resilience4j/dubbo-samples-resilience4j-springboot2/src/main/java/org/apache/dubbo/samples/resilience4j/api/AnnotationService.java
new file mode 100644
index 0000000..74b849a
--- /dev/null
+++ b/dubbo-samples-resilience4j/dubbo-samples-resilience4j-springboot2/src/main/java/org/apache/dubbo/samples/resilience4j/api/AnnotationService.java
@@ -0,0 +1,29 @@
+/*
+ *
+ *   Licensed to the Apache Software Foundation (ASF) under one or more
+ *   contributor license agreements.  See the NOTICE file distributed with
+ *   this work for additional information regarding copyright ownership.
+ *   The ASF licenses this file to You under the Apache License, Version 2.0
+ *   (the "License"); you may not use this file except in compliance with
+ *   the License.  You may obtain a copy of the License at
+ *
+ *       http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *   Unless required by applicable law or agreed to in writing, software
+ *   distributed under the License is distributed on an "AS IS" BASIS,
+ *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *   See the License for the specific language governing permissions and
+ *   limitations under the License.
+ *
+ */
+
+package org.apache.dubbo.samples.resilience4j.api;
+
+/**
+ * AsyncService
+ */
+public interface AnnotationService {
+
+    String sayHello(String name);
+
+}
diff --git a/dubbo-samples-resilience4j/dubbo-samples-resilience4j-springboot2/src/main/java/org/apache/dubbo/samples/resilience4j/filter/Resilience4jCircuitBreakerFilter.java b/dubbo-samples-resilience4j/dubbo-samples-resilience4j-springboot2/src/main/java/org/apache/dubbo/samples/resilience4j/filter/Resilience4jCircuitBreakerFilter.java
new file mode 100644
index 0000000..7b795cf
--- /dev/null
+++ b/dubbo-samples-resilience4j/dubbo-samples-resilience4j-springboot2/src/main/java/org/apache/dubbo/samples/resilience4j/filter/Resilience4jCircuitBreakerFilter.java
@@ -0,0 +1,42 @@
+package org.apache.dubbo.samples.resilience4j.filter;
+
+import io.github.resilience4j.circuitbreaker.CircuitBreaker;
+import io.github.resilience4j.circuitbreaker.CircuitBreakerConfig;
+import io.github.resilience4j.circuitbreaker.CircuitBreakerRegistry;
+import org.apache.dubbo.rpc.Filter;
+import org.apache.dubbo.rpc.Invocation;
+import org.apache.dubbo.rpc.Invoker;
+import org.apache.dubbo.rpc.Result;
+import org.apache.dubbo.rpc.RpcException;
+
+/**
+ * @author cvictory ON 2018/12/25
+ */
+public class Resilience4jCircuitBreakerFilter implements Filter {
+
+    static CircuitBreaker circuitBreaker;
+
+    static {
+        CircuitBreakerConfig config = CircuitBreakerConfig.custom()
+                .failureRateThreshold(20)
+                .ringBufferSizeInClosedState(5)
+                .build();
+        CircuitBreakerRegistry registry = CircuitBreakerRegistry.of(config);
+        circuitBreaker = registry.circuitBreaker("my");
+    }
+
+    @Override
+    public Result invoke(Invoker<?> invoker, Invocation invocation) throws RpcException {
+        long start = System.nanoTime();
+        try {
+            Result result = invoker.invoke(invocation);
+            long durationInNanos = System.nanoTime() - start;
+            circuitBreaker.onSuccess(durationInNanos);
+            return result;
+        } catch (Throwable throwable) {
+            long durationInNanos = System.nanoTime() - start;
+            circuitBreaker.onError(durationInNanos, throwable);
+            throw throwable;
+        }
+    }
+}
diff --git a/dubbo-samples-resilience4j/dubbo-samples-resilience4j-springboot2/src/main/java/org/apache/dubbo/samples/resilience4j/impl/AnnotationServiceImpl.java b/dubbo-samples-resilience4j/dubbo-samples-resilience4j-springboot2/src/main/java/org/apache/dubbo/samples/resilience4j/impl/AnnotationServiceImpl.java
new file mode 100644
index 0000000..cc2e9f7
--- /dev/null
+++ b/dubbo-samples-resilience4j/dubbo-samples-resilience4j-springboot2/src/main/java/org/apache/dubbo/samples/resilience4j/impl/AnnotationServiceImpl.java
@@ -0,0 +1,40 @@
+/*
+ *
+ *   Licensed to the Apache Software Foundation (ASF) under one or more
+ *   contributor license agreements.  See the NOTICE file distributed with
+ *   this work for additional information regarding copyright ownership.
+ *   The ASF licenses this file to You under the Apache License, Version 2.0
+ *   (the "License"); you may not use this file except in compliance with
+ *   the License.  You may obtain a copy of the License at
+ *
+ *       http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *   Unless required by applicable law or agreed to in writing, software
+ *   distributed under the License is distributed on an "AS IS" BASIS,
+ *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *   See the License for the specific language governing permissions and
+ *   limitations under the License.
+ *
+ */
+
+package org.apache.dubbo.samples.resilience4j.impl;
+
+import org.apache.dubbo.config.annotation.Service;
+import org.apache.dubbo.samples.resilience4j.api.AnnotationService;
+
+/**
+ * AsyncServiceImpl
+ */
+@Service
+public class AnnotationServiceImpl implements AnnotationService {
+
+//    @HystrixCommand(commandProperties = { @HystrixProperty(name = "circuitBreaker.requestVolumeThreshold", value = "10"),
+//                    @HystrixProperty(name = "execution.isolation.thread.timeoutInMilliseconds", value = "2000") })
+    @Override
+    public String sayHello(String name) {
+//        System.out.println("async provider received: " + name);
+//        return "annotation: hello, " + name;
+        throw new RuntimeException("Exception to show hystrix enabled.");
+    }
+
+}
diff --git a/dubbo-samples-resilience4j/dubbo-samples-resilience4j-springboot2/src/main/resources/log4j.properties b/dubbo-samples-resilience4j/dubbo-samples-resilience4j-springboot2/src/main/resources/log4j.properties
new file mode 100644
index 0000000..d6ecd5c
--- /dev/null
+++ b/dubbo-samples-resilience4j/dubbo-samples-resilience4j-springboot2/src/main/resources/log4j.properties
@@ -0,0 +1,26 @@
+#
+#
+#   Licensed to the Apache Software Foundation (ASF) under one or more
+#   contributor license agreements.  See the NOTICE file distributed with
+#   this work for additional information regarding copyright ownership.
+#   The ASF licenses this file to You under the Apache License, Version 2.0
+#   (the "License"); you may not use this file except in compliance with
+#   the License.  You may obtain a copy of the License at
+#
+#       http://www.apache.org/licenses/LICENSE-2.0
+#
+#   Unless required by applicable law or agreed to in writing, software
+#   distributed under the License is distributed on an "AS IS" BASIS,
+#   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+#   See the License for the specific language governing permissions and
+#   limitations under the License.
+#
+#
+
+###set log levels###
+log4j.rootLogger=info, stdout
+###output to the console###
+log4j.appender.stdout=org.apache.log4j.ConsoleAppender
+log4j.appender.stdout.Target=System.out
+log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
+log4j.appender.stdout.layout.ConversionPattern=[%d{dd/MM/yy hh:mm:ss:sss z}] %t %5p %c{2}: %m%n
\ No newline at end of file
diff --git a/dubbo-samples-resilience4j/dubbo-samples-resilience4j-springboot2/src/main/resources/spring/dubbo-consumer.properties b/dubbo-samples-resilience4j/dubbo-samples-resilience4j-springboot2/src/main/resources/spring/dubbo-consumer.properties
new file mode 100644
index 0000000..96ab667
--- /dev/null
+++ b/dubbo-samples-resilience4j/dubbo-samples-resilience4j-springboot2/src/main/resources/spring/dubbo-consumer.properties
@@ -0,0 +1,22 @@
+#
+#
+#   Licensed to the Apache Software Foundation (ASF) under one or more
+#   contributor license agreements.  See the NOTICE file distributed with
+#   this work for additional information regarding copyright ownership.
+#   The ASF licenses this file to You under the Apache License, Version 2.0
+#   (the "License"); you may not use this file except in compliance with
+#   the License.  You may obtain a copy of the License at
+#  
+#       http://www.apache.org/licenses/LICENSE-2.0
+#  
+#   Unless required by applicable law or agreed to in writing, software
+#   distributed under the License is distributed on an "AS IS" BASIS,
+#   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+#   See the License for the specific language governing permissions and
+#   limitations under the License.
+#  
+#
+
+dubbo.application.name=annotation-consumer
+dubbo.registry.address=zookeeper://127.0.0.1:2181
+dubbo.consumer.timeout=3000
\ No newline at end of file
diff --git a/dubbo-samples-resilience4j/dubbo-samples-resilience4j-springboot2/src/main/resources/spring/dubbo-provider.properties b/dubbo-samples-resilience4j/dubbo-samples-resilience4j-springboot2/src/main/resources/spring/dubbo-provider.properties
new file mode 100644
index 0000000..51fccca
--- /dev/null
+++ b/dubbo-samples-resilience4j/dubbo-samples-resilience4j-springboot2/src/main/resources/spring/dubbo-provider.properties
@@ -0,0 +1,23 @@
+#
+#
+#   Licensed to the Apache Software Foundation (ASF) under one or more
+#   contributor license agreements.  See the NOTICE file distributed with
+#   this work for additional information regarding copyright ownership.
+#   The ASF licenses this file to You under the Apache License, Version 2.0
+#   (the "License"); you may not use this file except in compliance with
+#   the License.  You may obtain a copy of the License at
+#  
+#       http://www.apache.org/licenses/LICENSE-2.0
+#  
+#   Unless required by applicable law or agreed to in writing, software
+#   distributed under the License is distributed on an "AS IS" BASIS,
+#   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+#   See the License for the specific language governing permissions and
+#   limitations under the License.
+#  
+#
+
+dubbo.application.name=annotation-provider
+dubbo.registry.address=zookeeper://127.0.0.1:2181
+dubbo.protocol.name=dubbo
+dubbo.protocol.port=20880
\ No newline at end of file
diff --git a/dubbo-samples-resilience4j/pom.xml b/dubbo-samples-resilience4j/pom.xml
new file mode 100644
index 0000000..404ea6f
--- /dev/null
+++ b/dubbo-samples-resilience4j/pom.xml
@@ -0,0 +1,43 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ~
+  ~   Licensed to the Apache Software Foundation (ASF) under one or more
+  ~   contributor license agreements.  See the NOTICE file distributed with
+  ~   this work for additional information regarding copyright ownership.
+  ~   The ASF licenses this file to You under the Apache License, Version 2.0
+  ~   (the "License"); you may not use this file except in compliance with
+  ~   the License.  You may obtain a copy of the License at
+  ~
+  ~       http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~   Unless required by applicable law or agreed to in writing, software
+  ~   distributed under the License is distributed on an "AS IS" BASIS,
+  ~   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  ~   See the License for the specific language governing permissions and
+  ~   limitations under the License.
+  ~
+  -->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <parent>
+        <artifactId>dubbo-samples-all</artifactId>
+        <groupId>org.apache.dubbo</groupId>
+        <version>1.0-SNAPSHOT</version>
+    </parent>
+    <modelVersion>4.0.0</modelVersion>
+
+    <artifactId>dubbo-samples-resilience4j</artifactId>
+    <packaging>pom</packaging>
+    <modules>
+        <module>dubbo-samples-resilience4j-filter</module>
+        <module>dubbo-samples-resilience4j-springboot2</module>
+    </modules>
+
+    <properties>
+        <resilience4j.version>0.13.1</resilience4j.version>
+    </properties>
+
+
+</project>
diff --git a/dubbo-samples-resilience4j/src/main/java/org/apache/dubbo/samples/resilience4j/AnnotationConsumer.java b/dubbo-samples-resilience4j/src/main/java/org/apache/dubbo/samples/resilience4j/AnnotationConsumer.java
new file mode 100644
index 0000000..d74b20a
--- /dev/null
+++ b/dubbo-samples-resilience4j/src/main/java/org/apache/dubbo/samples/resilience4j/AnnotationConsumer.java
@@ -0,0 +1,63 @@
+/*
+ *
+ *   Licensed to the Apache Software Foundation (ASF) under one or more
+ *   contributor license agreements.  See the NOTICE file distributed with
+ *   this work for additional information regarding copyright ownership.
+ *   The ASF licenses this file to You under the Apache License, Version 2.0
+ *   (the "License"); you may not use this file except in compliance with
+ *   the License.  You may obtain a copy of the License at
+ *
+ *       http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *   Unless required by applicable law or agreed to in writing, software
+ *   distributed under the License is distributed on an "AS IS" BASIS,
+ *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *   See the License for the specific language governing permissions and
+ *   limitations under the License.
+ *
+ */
+
+package org.apache.dubbo.samples.resilience4j;
+
+import io.github.resilience4j.circuitbreaker.CircuitBreaker;
+import io.github.resilience4j.circuitbreaker.CircuitBreakerConfig;
+import io.github.resilience4j.circuitbreaker.CircuitBreakerRegistry;
+import io.github.resilience4j.circuitbreaker.utils.CircuitBreakerUtils;
+import org.apache.dubbo.config.spring.context.annotation.EnableDubbo;
+import org.apache.dubbo.samples.resilience4j.action.AnnotationAction;
+import org.springframework.context.annotation.AnnotationConfigApplicationContext;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.ComponentScan;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.context.annotation.EnableAspectJAutoProxy;
+import org.springframework.context.annotation.PropertySource;
+
+/**
+ * CallbackConsumer
+ */
+public class AnnotationConsumer {
+
+    public static void main(String[] args) throws Exception {
+        AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(ConsumerConfiguration.class);
+        context.start();
+        final AnnotationAction annotationAction = (AnnotationAction) context.getBean("annotationAction");
+        String hello = annotationAction.doSayHello("world");
+        System.err.println("result :" + hello);
+        System.in.read();
+    }
+
+    @Configuration
+    @EnableDubbo(scanBasePackages = "com.alibaba.dubbo.samples.resilience4j.action")
+    @PropertySource("classpath:/spring/dubbo-consumer.properties")
+    @ComponentScan(value = {"org.apache.dubbo.samples.resilience4j.action"})
+    @EnableAspectJAutoProxy
+    static public class ConsumerConfiguration {
+
+//        @Bean
+//        public HystrixCommandAspect hystrixCommandAspect() {
+//            return new HystrixCommandAspect();
+//        }
+
+    }
+
+}
diff --git a/dubbo-samples-resilience4j/src/main/java/org/apache/dubbo/samples/resilience4j/AnnotationProvider.java b/dubbo-samples-resilience4j/src/main/java/org/apache/dubbo/samples/resilience4j/AnnotationProvider.java
new file mode 100644
index 0000000..be7715d
--- /dev/null
+++ b/dubbo-samples-resilience4j/src/main/java/org/apache/dubbo/samples/resilience4j/AnnotationProvider.java
@@ -0,0 +1,61 @@
+/*
+ *
+ *   Licensed to the Apache Software Foundation (ASF) under one or more
+ *   contributor license agreements.  See the NOTICE file distributed with
+ *   this work for additional information regarding copyright ownership.
+ *   The ASF licenses this file to You under the Apache License, Version 2.0
+ *   (the "License"); you may not use this file except in compliance with
+ *   the License.  You may obtain a copy of the License at
+ *
+ *       http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *   Unless required by applicable law or agreed to in writing, software
+ *   distributed under the License is distributed on an "AS IS" BASIS,
+ *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *   See the License for the specific language governing permissions and
+ *   limitations under the License.
+ *
+ */
+
+package org.apache.dubbo.samples.resilience4j;
+
+
+import org.apache.dubbo.config.ProviderConfig;
+import org.apache.dubbo.config.spring.context.annotation.EnableDubbo;
+import org.springframework.context.annotation.AnnotationConfigApplicationContext;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.context.annotation.EnableAspectJAutoProxy;
+import org.springframework.context.annotation.PropertySource;
+
+/**
+ * MergeProvider
+ */
+public class AnnotationProvider {
+
+    public static void main(String[] args) throws Exception {
+        new EmbeddedZooKeeper(2181, false).start();
+        AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(ProviderConfiguration.class);
+        context.start();
+        System.in.read();
+    }
+
+    @Configuration
+    @EnableDubbo(scanBasePackages = "com.alibaba.dubbo.samples.resilience4j.impl")
+    @PropertySource("classpath:/spring/dubbo-provider.properties")
+    @EnableAspectJAutoProxy
+    static public class ProviderConfiguration {
+        @Bean
+        public ProviderConfig providerConfig() {
+            ProviderConfig providerConfig = new ProviderConfig();
+            providerConfig.setTimeout(1000);
+            return providerConfig;
+        }
+
+//        @Bean
+//        public HystrixCommandAspect hystrixCommandAspect() {
+//            return new HystrixCommandAspect();
+//        }
+    }
+
+}
diff --git a/dubbo-samples-resilience4j/src/main/java/org/apache/dubbo/samples/resilience4j/EmbeddedZooKeeper.java b/dubbo-samples-resilience4j/src/main/java/org/apache/dubbo/samples/resilience4j/EmbeddedZooKeeper.java
new file mode 100644
index 0000000..9c8ae8a
--- /dev/null
+++ b/dubbo-samples-resilience4j/src/main/java/org/apache/dubbo/samples/resilience4j/EmbeddedZooKeeper.java
@@ -0,0 +1,255 @@
+/*
+ * Copyright 2014 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.dubbo.samples.resilience4j;
+
+import java.io.File;
+import java.lang.reflect.Method;
+import java.util.Properties;
+import java.util.UUID;
+
+import org.apache.zookeeper.server.ServerConfig;
+import org.apache.zookeeper.server.ZooKeeperServerMain;
+import org.apache.zookeeper.server.quorum.QuorumPeerConfig;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.context.SmartLifecycle;
+import org.springframework.util.ErrorHandler;
+import org.springframework.util.SocketUtils;
+
+/**
+ * from: https://github.com/spring-projects/spring-xd/blob/v1.3.1.RELEASE/spring-xd-dirt/src/main/java/org/springframework/xd/dirt/zookeeper/ZooKeeperUtils.java
+ *
+ * Helper class to start an embedded instance of standalone (non clustered) ZooKeeper.
+ *
+ * NOTE: at least an external standalone server (if not an ensemble) are recommended, even for
+ * {@link org.springframework.xd.dirt.server.singlenode.SingleNodeApplication}
+ *
+ * @author Patrick Peralta
+ * @author Mark Fisher
+ * @author David Turanski
+ */
+public class EmbeddedZooKeeper implements SmartLifecycle {
+
+    /**
+     * Logger.
+     */
+    private static final Logger logger = LoggerFactory.getLogger(EmbeddedZooKeeper.class);
+
+    /**
+     * ZooKeeper client port. This will be determined dynamically upon startup.
+     */
+    private final int clientPort;
+
+    /**
+     * Whether to auto-start. Default is true.
+     */
+    private boolean autoStartup = true;
+
+    /**
+     * Lifecycle phase. Default is 0.
+     */
+    private int phase = 0;
+
+    /**
+     * Thread for running the ZooKeeper server.
+     */
+    private volatile Thread zkServerThread;
+
+    /**
+     * ZooKeeper server.
+     */
+    private volatile ZooKeeperServerMain zkServer;
+
+    /**
+     * {@link ErrorHandler} to be invoked if an Exception is thrown from the ZooKeeper server thread.
+     */
+    private ErrorHandler errorHandler;
+
+    private boolean daemon = true;
+
+    /**
+     * Construct an EmbeddedZooKeeper with a random port.
+     */
+    public EmbeddedZooKeeper() {
+        clientPort = SocketUtils.findAvailableTcpPort();
+    }
+
+    /**
+     * Construct an EmbeddedZooKeeper with the provided port.
+     *
+     * @param clientPort  port for ZooKeeper server to bind to
+     */
+    public EmbeddedZooKeeper(int clientPort, boolean daemon) {
+        this.clientPort = clientPort;
+        this.daemon = daemon;
+    }
+
+    /**
+     * Returns the port that clients should use to connect to this embedded server.
+     *
+     * @return dynamically determined client port
+     */
+    public int getClientPort() {
+        return this.clientPort;
+    }
+
+    /**
+     * Specify whether to start automatically. Default is true.
+     *
+     * @param autoStartup whether to start automatically
+     */
+    public void setAutoStartup(boolean autoStartup) {
+        this.autoStartup = autoStartup;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public boolean isAutoStartup() {
+        return this.autoStartup;
+    }
+
+    /**
+     * Specify the lifecycle phase for the embedded server.
+     *
+     * @param phase the lifecycle phase
+     */
+    public void setPhase(int phase) {
+        this.phase = phase;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public int getPhase() {
+        return this.phase;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public boolean isRunning() {
+        return (zkServerThread != null);
+    }
+
+    /**
+     * Start the ZooKeeper server in a background thread.
+     * <p>
+     * Register an error handler via {@link #setErrorHandler} in order to handle
+     * any exceptions thrown during startup or execution.
+     */
+    @Override
+    public synchronized void start() {
+        if (zkServerThread == null) {
+            zkServerThread = new Thread(new ServerRunnable(), "ZooKeeper Server Starter");
+            zkServerThread.setDaemon(daemon);
+            zkServerThread.start();
+        }
+    }
+
+    /**
+     * Shutdown the ZooKeeper server.
+     */
+    @Override
+    public synchronized void stop() {
+        if (zkServerThread != null) {
+            // The shutdown method is protected...thus this hack to invoke it.
+            // This will log an exception on shutdown; see
+            // https://issues.apache.org/jira/browse/ZOOKEEPER-1873 for details.
+            try {
+                Method shutdown = ZooKeeperServerMain.class.getDeclaredMethod("shutdown");
+                shutdown.setAccessible(true);
+                shutdown.invoke(zkServer);
+            }
+
+            catch (Exception e) {
+                throw new RuntimeException(e);
+            }
+
+            // It is expected that the thread will exit after
+            // the server is shutdown; this will block until
+            // the shutdown is complete.
+            try {
+                zkServerThread.join(5000);
+                zkServerThread = null;
+            }
+            catch (InterruptedException e) {
+                Thread.currentThread().interrupt();
+                logger.warn("Interrupted while waiting for embedded ZooKeeper to exit");
+                // abandoning zk thread
+                zkServerThread = null;
+            }
+        }
+    }
+
+    /**
+     * Stop the server if running and invoke the callback when complete.
+     */
+    @Override
+    public void stop(Runnable callback) {
+        stop();
+        callback.run();
+    }
+
+    /**
+     * Provide an {@link ErrorHandler} to be invoked if an Exception is thrown from the ZooKeeper server thread. If none
+     * is provided, only error-level logging will occur.
+     *
+     * @param errorHandler the {@link ErrorHandler} to be invoked
+     */
+    public void setErrorHandler(ErrorHandler errorHandler) {
+        this.errorHandler = errorHandler;
+    }
+
+    /**
+     * Runnable implementation that starts the ZooKeeper server.
+     */
+    private class ServerRunnable implements Runnable {
+
+        @Override
+        public void run() {
+            try {
+                Properties properties = new Properties();
+                File file = new File(System.getProperty("java.io.tmpdir")
+                    + File.separator + UUID.randomUUID());
+                file.deleteOnExit();
+                properties.setProperty("dataDir", file.getAbsolutePath());
+                properties.setProperty("clientPort", String.valueOf(clientPort));
+
+                QuorumPeerConfig quorumPeerConfig = new QuorumPeerConfig();
+                quorumPeerConfig.parseProperties(properties);
+
+                zkServer = new ZooKeeperServerMain();
+                ServerConfig configuration = new ServerConfig();
+                configuration.readFrom(quorumPeerConfig);
+
+                zkServer.runFromConfig(configuration);
+            }
+            catch (Exception e) {
+                if (errorHandler != null) {
+                    errorHandler.handleError(e);
+                }
+                else {
+                    logger.error("Exception running embedded ZooKeeper", e);
+                }
+            }
+        }
+    }
+
+}
diff --git a/dubbo-samples-resilience4j/src/main/java/org/apache/dubbo/samples/resilience4j/action/AnnotationAction.java b/dubbo-samples-resilience4j/src/main/java/org/apache/dubbo/samples/resilience4j/action/AnnotationAction.java
new file mode 100644
index 0000000..785c9eb
--- /dev/null
+++ b/dubbo-samples-resilience4j/src/main/java/org/apache/dubbo/samples/resilience4j/action/AnnotationAction.java
@@ -0,0 +1,46 @@
+/*
+ *
+ *   Licensed to the Apache Software Foundation (ASF) under one or more
+ *   contributor license agreements.  See the NOTICE file distributed with
+ *   this work for additional information regarding copyright ownership.
+ *   The ASF licenses this file to You under the Apache License, Version 2.0
+ *   (the "License"); you may not use this file except in compliance with
+ *   the License.  You may obtain a copy of the License at
+ *
+ *       http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *   Unless required by applicable law or agreed to in writing, software
+ *   distributed under the License is distributed on an "AS IS" BASIS,
+ *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *   See the License for the specific language governing permissions and
+ *   limitations under the License.
+ *
+ */
+
+package org.apache.dubbo.samples.resilience4j.action;
+
+import org.apache.dubbo.config.annotation.Reference;
+
+
+import org.apache.dubbo.samples.resilience4j.api.AnnotationService;
+import org.springframework.stereotype.Component;
+
+/**
+ * AnnotationAction
+ */
+@Component("annotationAction")
+public class AnnotationAction {
+
+    @Reference
+    private AnnotationService annotationService;
+
+//    @HystrixCommand(fallbackMethod = "reliable")
+    public String doSayHello(String name) {
+        return annotationService.sayHello(name);
+    }
+
+    public String reliable(String name) {
+        return "hystrix fallback value";
+    }
+
+}
diff --git a/dubbo-samples-resilience4j/src/main/java/org/apache/dubbo/samples/resilience4j/api/AnnotationService.java b/dubbo-samples-resilience4j/src/main/java/org/apache/dubbo/samples/resilience4j/api/AnnotationService.java
new file mode 100644
index 0000000..74b849a
--- /dev/null
+++ b/dubbo-samples-resilience4j/src/main/java/org/apache/dubbo/samples/resilience4j/api/AnnotationService.java
@@ -0,0 +1,29 @@
+/*
+ *
+ *   Licensed to the Apache Software Foundation (ASF) under one or more
+ *   contributor license agreements.  See the NOTICE file distributed with
+ *   this work for additional information regarding copyright ownership.
+ *   The ASF licenses this file to You under the Apache License, Version 2.0
+ *   (the "License"); you may not use this file except in compliance with
+ *   the License.  You may obtain a copy of the License at
+ *
+ *       http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *   Unless required by applicable law or agreed to in writing, software
+ *   distributed under the License is distributed on an "AS IS" BASIS,
+ *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *   See the License for the specific language governing permissions and
+ *   limitations under the License.
+ *
+ */
+
+package org.apache.dubbo.samples.resilience4j.api;
+
+/**
+ * AsyncService
+ */
+public interface AnnotationService {
+
+    String sayHello(String name);
+
+}
diff --git a/dubbo-samples-resilience4j/src/main/java/org/apache/dubbo/samples/resilience4j/filter/Resilience4jCircuitBreakerFilter.java b/dubbo-samples-resilience4j/src/main/java/org/apache/dubbo/samples/resilience4j/filter/Resilience4jCircuitBreakerFilter.java
new file mode 100644
index 0000000..7b795cf
--- /dev/null
+++ b/dubbo-samples-resilience4j/src/main/java/org/apache/dubbo/samples/resilience4j/filter/Resilience4jCircuitBreakerFilter.java
@@ -0,0 +1,42 @@
+package org.apache.dubbo.samples.resilience4j.filter;
+
+import io.github.resilience4j.circuitbreaker.CircuitBreaker;
+import io.github.resilience4j.circuitbreaker.CircuitBreakerConfig;
+import io.github.resilience4j.circuitbreaker.CircuitBreakerRegistry;
+import org.apache.dubbo.rpc.Filter;
+import org.apache.dubbo.rpc.Invocation;
+import org.apache.dubbo.rpc.Invoker;
+import org.apache.dubbo.rpc.Result;
+import org.apache.dubbo.rpc.RpcException;
+
+/**
+ * @author cvictory ON 2018/12/25
+ */
+public class Resilience4jCircuitBreakerFilter implements Filter {
+
+    static CircuitBreaker circuitBreaker;
+
+    static {
+        CircuitBreakerConfig config = CircuitBreakerConfig.custom()
+                .failureRateThreshold(20)
+                .ringBufferSizeInClosedState(5)
+                .build();
+        CircuitBreakerRegistry registry = CircuitBreakerRegistry.of(config);
+        circuitBreaker = registry.circuitBreaker("my");
+    }
+
+    @Override
+    public Result invoke(Invoker<?> invoker, Invocation invocation) throws RpcException {
+        long start = System.nanoTime();
+        try {
+            Result result = invoker.invoke(invocation);
+            long durationInNanos = System.nanoTime() - start;
+            circuitBreaker.onSuccess(durationInNanos);
+            return result;
+        } catch (Throwable throwable) {
+            long durationInNanos = System.nanoTime() - start;
+            circuitBreaker.onError(durationInNanos, throwable);
+            throw throwable;
+        }
+    }
+}
diff --git a/dubbo-samples-resilience4j/src/main/java/org/apache/dubbo/samples/resilience4j/impl/AnnotationServiceImpl.java b/dubbo-samples-resilience4j/src/main/java/org/apache/dubbo/samples/resilience4j/impl/AnnotationServiceImpl.java
new file mode 100644
index 0000000..cc2e9f7
--- /dev/null
+++ b/dubbo-samples-resilience4j/src/main/java/org/apache/dubbo/samples/resilience4j/impl/AnnotationServiceImpl.java
@@ -0,0 +1,40 @@
+/*
+ *
+ *   Licensed to the Apache Software Foundation (ASF) under one or more
+ *   contributor license agreements.  See the NOTICE file distributed with
+ *   this work for additional information regarding copyright ownership.
+ *   The ASF licenses this file to You under the Apache License, Version 2.0
+ *   (the "License"); you may not use this file except in compliance with
+ *   the License.  You may obtain a copy of the License at
+ *
+ *       http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *   Unless required by applicable law or agreed to in writing, software
+ *   distributed under the License is distributed on an "AS IS" BASIS,
+ *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *   See the License for the specific language governing permissions and
+ *   limitations under the License.
+ *
+ */
+
+package org.apache.dubbo.samples.resilience4j.impl;
+
+import org.apache.dubbo.config.annotation.Service;
+import org.apache.dubbo.samples.resilience4j.api.AnnotationService;
+
+/**
+ * AsyncServiceImpl
+ */
+@Service
+public class AnnotationServiceImpl implements AnnotationService {
+
+//    @HystrixCommand(commandProperties = { @HystrixProperty(name = "circuitBreaker.requestVolumeThreshold", value = "10"),
+//                    @HystrixProperty(name = "execution.isolation.thread.timeoutInMilliseconds", value = "2000") })
+    @Override
+    public String sayHello(String name) {
+//        System.out.println("async provider received: " + name);
+//        return "annotation: hello, " + name;
+        throw new RuntimeException("Exception to show hystrix enabled.");
+    }
+
+}
diff --git a/dubbo-samples-resilience4j/src/main/resources/log4j.properties b/dubbo-samples-resilience4j/src/main/resources/log4j.properties
new file mode 100644
index 0000000..d6ecd5c
--- /dev/null
+++ b/dubbo-samples-resilience4j/src/main/resources/log4j.properties
@@ -0,0 +1,26 @@
+#
+#
+#   Licensed to the Apache Software Foundation (ASF) under one or more
+#   contributor license agreements.  See the NOTICE file distributed with
+#   this work for additional information regarding copyright ownership.
+#   The ASF licenses this file to You under the Apache License, Version 2.0
+#   (the "License"); you may not use this file except in compliance with
+#   the License.  You may obtain a copy of the License at
+#
+#       http://www.apache.org/licenses/LICENSE-2.0
+#
+#   Unless required by applicable law or agreed to in writing, software
+#   distributed under the License is distributed on an "AS IS" BASIS,
+#   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+#   See the License for the specific language governing permissions and
+#   limitations under the License.
+#
+#
+
+###set log levels###
+log4j.rootLogger=info, stdout
+###output to the console###
+log4j.appender.stdout=org.apache.log4j.ConsoleAppender
+log4j.appender.stdout.Target=System.out
+log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
+log4j.appender.stdout.layout.ConversionPattern=[%d{dd/MM/yy hh:mm:ss:sss z}] %t %5p %c{2}: %m%n
\ No newline at end of file
diff --git a/dubbo-samples-resilience4j/src/main/resources/spring/dubbo-consumer.properties b/dubbo-samples-resilience4j/src/main/resources/spring/dubbo-consumer.properties
new file mode 100644
index 0000000..96ab667
--- /dev/null
+++ b/dubbo-samples-resilience4j/src/main/resources/spring/dubbo-consumer.properties
@@ -0,0 +1,22 @@
+#
+#
+#   Licensed to the Apache Software Foundation (ASF) under one or more
+#   contributor license agreements.  See the NOTICE file distributed with
+#   this work for additional information regarding copyright ownership.
+#   The ASF licenses this file to You under the Apache License, Version 2.0
+#   (the "License"); you may not use this file except in compliance with
+#   the License.  You may obtain a copy of the License at
+#  
+#       http://www.apache.org/licenses/LICENSE-2.0
+#  
+#   Unless required by applicable law or agreed to in writing, software
+#   distributed under the License is distributed on an "AS IS" BASIS,
+#   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+#   See the License for the specific language governing permissions and
+#   limitations under the License.
+#  
+#
+
+dubbo.application.name=annotation-consumer
+dubbo.registry.address=zookeeper://127.0.0.1:2181
+dubbo.consumer.timeout=3000
\ No newline at end of file
diff --git a/dubbo-samples-resilience4j/src/main/resources/spring/dubbo-provider.properties b/dubbo-samples-resilience4j/src/main/resources/spring/dubbo-provider.properties
new file mode 100644
index 0000000..51fccca
--- /dev/null
+++ b/dubbo-samples-resilience4j/src/main/resources/spring/dubbo-provider.properties
@@ -0,0 +1,23 @@
+#
+#
+#   Licensed to the Apache Software Foundation (ASF) under one or more
+#   contributor license agreements.  See the NOTICE file distributed with
+#   this work for additional information regarding copyright ownership.
+#   The ASF licenses this file to You under the Apache License, Version 2.0
+#   (the "License"); you may not use this file except in compliance with
+#   the License.  You may obtain a copy of the License at
+#  
+#       http://www.apache.org/licenses/LICENSE-2.0
+#  
+#   Unless required by applicable law or agreed to in writing, software
+#   distributed under the License is distributed on an "AS IS" BASIS,
+#   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+#   See the License for the specific language governing permissions and
+#   limitations under the License.
+#  
+#
+
+dubbo.application.name=annotation-provider
+dubbo.registry.address=zookeeper://127.0.0.1:2181
+dubbo.protocol.name=dubbo
+dubbo.protocol.port=20880
\ No newline at end of file
diff --git a/pom.xml b/pom.xml
index 7f5c36c..08eb7a2 100644
--- a/pom.xml
+++ b/pom.xml
@@ -58,6 +58,7 @@
         <module>dubbo-samples-simplified-registry</module>
         <module>dubbo-samples-chain</module>
         <module>dubbo-samples-generic-call</module>
+        <module>dubbo-samples-resilience4j</module>
     </modules>
 
     <properties>


[incubator-dubbo-samples] 01/04: fix sample issue

Posted by vi...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

victory pushed a commit to branch samples-for-2.7.0-SNAPSHOT
in repository https://gitbox.apache.org/repos/asf/incubator-dubbo-samples.git

commit c8ab4546aca0d52f01b70a31420b08c07411e13a
Author: cvictory <sh...@gmail.com>
AuthorDate: Tue Dec 25 17:27:59 2018 +0800

    fix sample issue
---
 dubbo-samples-annotation/pom.xml                                 | 7 ++++++-
 dubbo-samples-merge/src/main/resources/spring/merge-consumer.xml | 4 ++--
 2 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/dubbo-samples-annotation/pom.xml b/dubbo-samples-annotation/pom.xml
index 2382088..1c3bd48 100644
--- a/dubbo-samples-annotation/pom.xml
+++ b/dubbo-samples-annotation/pom.xml
@@ -39,5 +39,10 @@
             <groupId>org.apache.dubbo</groupId>
             <artifactId>dubbo-metadata-report-api</artifactId>
         </dependency>
+        <dependency>
+            <groupId>com.alibaba.spring</groupId>
+            <artifactId>spring-context-support</artifactId>
+            <version>1.0.2</version>
+        </dependency>
     </dependencies>
-</project>
\ No newline at end of file
+</project>
diff --git a/dubbo-samples-merge/src/main/resources/spring/merge-consumer.xml b/dubbo-samples-merge/src/main/resources/spring/merge-consumer.xml
index 2b91a72..18d04d4 100644
--- a/dubbo-samples-merge/src/main/resources/spring/merge-consumer.xml
+++ b/dubbo-samples-merge/src/main/resources/spring/merge-consumer.xml
@@ -28,6 +28,6 @@
 
     <dubbo:registry address="zookeeper://127.0.0.1:2181"/>
 
-    <dubbo:reference id="mergeService" interface="org.apache.dubbo.samples.merge.api.MergeService" group="*"/>
+    <dubbo:reference id="mergeService" interface="org.apache.dubbo.samples.merge.api.MergeService" group="*" merger="true"/>
 
-</beans>
\ No newline at end of file
+</beans>