title: “Service Definition” lang: en ref: service-definition permalink: /docs/users/service-definition/ excerpt: “Service Definition” last_modified_at: 2017-08-15T15:01:43-04:00 redirect_from:
{% include toc %}
A service definition identifies a microservice. It defines the service name, version, and the application that the service belongs to. The service definition can also contain extended information defining the attribute metadata of a service.
To define a new microservice or modify its basic information, you may need to create and modify service definitions.
This section describe the following configration items related to the microservice.yaml file in the src\main\resources\ directory.
Configuration on Item | Default | Range | Mandatory | Description | Remarks |
---|---|---|---|---|---|
APPLICATION_ID | - | - | Yes | Indicates an application name. | - |
service_description.name | - | - | Yes | Indicates a microservice name | The microservice name should be unique within an application. The name can contain digits, uppercase and lowercase letters, hyphens(-), underscores(_), and periods(.); and can neither start nor end with punctuations. The naming rule is as follows: ^[a-zA-Z0-9]+$|^[a-zA-Z0-9][a-zA-Z0-9_-.]*[a-zA-Z0-9]$. |
service_description.version | - | - | Yes | Indicates a service version. | - |
service_description.properties | - | - | No | Configures microservice metadata(in the microservice.yaml file). | - |
service_description.propertyExtendedClass | - | - | No | Configures microservice metadata(through the PropertyExtended API). | The configurations returned through the API will overwrite those with the same keys in the configuration file. |
instance_description.properties | - | - | No | Configures instance metadata(in the microservice.yaml file) | |
instance_description.propertyExtendedClass | - | - | No | Configures microservice metadata(through the PropertyExtended API). | The configurations returned through the API will overwrite thos with the same keys in the configuration file. |
NOTE:
APPLICATION_ID: helloTest #Application name service_description: #Service description name: helloServer #Microservice name version: 0.0.1 #Service version properties: #Metadata allowCrossApp: false key1: value1 key2: value2 propertyExtendedClass: org.apache.servicecomb.serviceregistry.MicroServicePropertyExtendedStub instance_description: #Instance description properties: #Metadata key3: value3 propertyExtendedClass: org.apache.servicecomb.serviceregistry.MicroServicePropertyExtendedStub