1 Star 0 Fork 1

zhouanan511/camel-spring-boot-examples2

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
README.adoc 2.26 KB
一键复制 编辑 原始数据 按行查看 历史

Hystrix Example

Introduction

This example shows how to use Camel with Hystrix EIP as circuit breaker in Camel routes

The example includes three sub maven modules that implement

  • client

  • service1

  • service2

Where client → service1 client → service2 (fallback)

Configuration

Service1 is configured in the src/main/java/sample/camel/Service1Application.java source code. Service2 is configured in the src/main/resources/application.properties properties file.

Build

You will need to compile this example first:

$ mvn compile

Run the example

Then using three different shells and run service1 and service2 before the client.

$ cd service1
$ mvn compile spring-boot:run

When service1 is ready then start service2

$ cd service2
$ mvn compile camel:run

And then start the client that calls service1 every second.

$ cd client
$ mvn compile spring-boot:run

You can then stop service1 and see that the client should fallback to call service2 in the Hystrix EIP circuit breaker. And then start service 1 again and see the Hystrix EIP go back to normal.

Hystrix web console

You should be able to visualize the state of the Hystrix Circuit Breaker in the Hystrix Web Console.

You can find instructions at Hystrix how to build and run the web console: https://github.com/Netflix/Hystrix/wiki/Dashboard

For example using gradle, you can then access the web console locally at: http://localhost:7979/hystrix-dashboard.

The stream is accessinble from the client at: http://localhost:8080/hystrix.stream which you can add as stream to the web console and then you should see the circuit breakers. In the screen shot below, we have just stopped service1, so the Hystrix EIP will execute the fallback via network, which is calling service2 instead. If you start service 1 again then the Hystrix EIP should go back to green again.

Hystrix Web Console

Help and contributions

If you hit any problem using Camel or have some feedback, then please let us know.

We also love contributors, so get involved :-)

The Camel riders!

马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/zhouanan511/camel-spring-boot-examples2.git
git@gitee.com:zhouanan511/camel-spring-boot-examples2.git
zhouanan511
camel-spring-boot-examples2
camel-spring-boot-examples2
camel-3.4.x

搜索帮助

0d507c66 1850385 C8b1a773 1850385