How does a dubbo consumer subscribe to a provider's services?
我想大声告诉你
我想大声告诉你 2017-05-17 10:05:25
0
4
698


After I write the service provider program, how do service consumers subscribe to their own services from the registration center?
How do service consumers know what services I provide?

我想大声告诉你
我想大声告诉你

reply all(4)
大家讲道理

The provider registers the service to the registration center
The consumer configures locally which services it depends on, and after going online, it goes to the registration center to retrieve the provider. After retrieval, the two are directly connected.

为情所困

class A implements B

Service provider implements class A and annotates it
@org.springframework.stereotype.Service
@com.alibaba.dubbo.config.annotation.Service(protocol = {"dubbo"})

Serve consumers

<dubbo:reference id="Customize a name" interface="Interface B">

The configuration file required by both projects in the dubbo configuration file
<dubbo:registry address="Your registration center" />
<dubbo:annotation package="Scan annotation package" />
< dubbo:protocol name="dubbo"></dubbo:protocol>

为情所困

How do service consumers know what services I provide?
Documentation, communication

曾经蜡笔没有小新

Consumers will go to the registration center to find the service interface they need. If the service exists, the address of the service interface will be returned. Then the consumer will use this address to call the service provider's interface. What should be noted here is that consumers do not immediately obtain services directly from the registration center, but only obtain the address.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template