1 Star 0 Fork 1

寒松/camel-spring-boot-examples2

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

Spring Cloud and ServiceCall EIP Example

This example show how to use Camel with ServiceCall EIP with spring-cloud and consul.

This example includes two maven modules:

  • service that exposes a number of services

  • consumer that consumes services

Configuration

The consumer is configured in the src/main/resources/application.properties

Build

You can build this example using

mvn compile

Run the example

Using multiple shells:

  • start consul:

    $ cd service
    $ src/main/bash/consul-run-linux.sh    (for linux)
    $ src/main/bash/consul-run-osx.sh      (for mac osx)
  • start the service:

    $ cd service
    $ mvn spring-boot:run
  • start the consumer

    $ cd consumer
    $ mvn spring-boot:run

Test the example:

In a new shell:

$ curl localhost:8080/camel/serviceCall/service1
Hi!, I'm service-1 on camel-1/route1
$ curl localhost:8080/camel/serviceCall/service2
Hi!, I'm service-1 on camel-1/route2

If you keep calling the http endpoint you’ll notice they are consumed using a round robin policy and that only the services matching specific tags are consumed.

Web console

You can open the Consul web console

http://localhost:8500/ui

Where you can find information about the services and its state.

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!

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

搜索帮助