This example shows how to use consul as Dubbo's registry center
In this example, a docker compose file is provided to start the required consul agent easily. But at the same time, it requires you to prepare docker environment as a prerequisite. You can refer to docker quick start to install.
docker run -p8500:8500 consul:latest
You may need also check further from Consul Devops Handbook.
Execute the following maven command under dubbo-samples-consul directory, or simply import the whole sample project into IDE.
mvn clean package
- Run ConsulProvider to start service provider
- Run ConsulConsumer to start service consumer, you should see the following result in the console:
result: hello, consul