search

Home  >  Q&A  >  body text

How does a dubbo consumer subscribe to a provider's services?


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?

我想大声告诉你我想大声告诉你2825 days ago757

reply all(4)I'll reply

  • 大家讲道理

    大家讲道理2017-05-17 10:07:25

    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.

    reply
    0
  • 为情所困

    为情所困2017-05-17 10:07:25

    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>

    reply
    0
  • 为情所困

    为情所困2017-05-17 10:07:25

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

    reply
    0
  • 曾经蜡笔没有小新

    曾经蜡笔没有小新2017-05-17 10:07:25

    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.

    reply
    0
  • Cancelreply