ServiceComb
Install
Service Registry
Create Registry
Kitex provides two functions to create service registry.
NewDefaultSCRegistry
NewDefaultSCRegistry
uses service-comb to create a default service registry, which needs to pass in the endpoint value. The service registry configuration can be customized.
Function signature:
Example:
NewSCRegistry
NewSCRegistry
uses service-comb to create a new service registry. It needs to pass in a custom client. Customizable service registry configuration.
Function signature:
Example:
Option
Servicecomb extension provides option configuration in the service registry section.
WithAppId
Servicecomb extension provides WithAppId
to help users configure the AppId of Servicecomb. Defaults to “DEFAULT” .
Function signature:
WithRegistryVersionRule
Servicecomb extension provides WithRegistryVersionRule
to help users configure the version requirements of Servicecomb. Defaults to 1.0.0 .
Function signature:
WithRegistryHostName
Servicecomb extension provides WithRegistryHostName
to help users configure Servicecomb’s hostname. Defaults to “DEFAULT” .
Function signature:
WithRegistryHeartbeatInterval
Servicecomb extension provides WithRegistryHeartbeatInterval
to help users configure the interval for sending heartbeat packets. Default is 5.
Function signature:
Service Discovery
Create Resolver
Kitex provides two functions to create service resolver.
NewDefaultSCResolver
NewDefaultSCResolver
uses service-comb to create a default service discovery center, which needs to pass in the endpoint value. Service discovery center configuration can be customized.
Function signature:
Example:
NewSCResolver
NewSCReslover
uses service-comb to create a new service discovery center. It needs to pass in a custom client. The configuration of the service discovery center can be customized.
Function signature:
Example:
Option
Servicecomb extension provides option configuration in the service discovery section.
WithAppId
Servicecomb extension provides WithAppId
to help users configure the AppId of Servicecomb. Defaults to “DEFAULT” .
Function signature:
WithResolverVersionRule
Servicecomb extension provides WithResolverVersionRule
to help users configure Servicecomb’s version requirements. Defaults to latest .
Function signature:
WithResolverConsumerId
Servicecomb extension provides WithResolverConsumerId
to help users configure Servicecomb’s ConsumerId . Default is empty .
Function signature:
How To Use
Server
Client
Configuration
The configuration of Servicecomb client and server can be customized, refer to the configuration of go-chassis/sc-client.
Complete Example
For more, see example.