public abstract class ThirdServiceRegister extends Object implements BootListener, org.springframework.context.EnvironmentAware
for declare a 3rd service as a servicecomb service
assume a 3rd service:
1. named svc
2. have 2 address: https://svc-1 and https://svc-2
3. have 2 schemas: schema1 and schema2
usage:
1. define schema interface in JAX-RS or springMVC mode
1) schema1
{@codeBootListener.BootEvent, BootListener.EventType| Modifier and Type | Field and Description |
|---|---|
protected String |
appId |
static List<String> |
DEFAULT_ADDRESSES |
protected String |
microserviceName |
static int |
ORDER |
protected Map<String,Class<?>> |
schemaByIdMap |
protected List<String> |
urls
role:
EndpointUtilsdefault to any address |
static String |
VERSION |
| Constructor and Description |
|---|
ThirdServiceRegister(String microserviceName) |
| Modifier and Type | Method and Description |
|---|---|
protected void |
addSchema(String schemaId,
Class<?> schemaCls) |
protected List<String> |
createEndpoints() |
protected List<MicroserviceInstance> |
createInstances(List<String> endpoints) |
protected MicroserviceVersions |
createMicroserviceVersions(List<MicroserviceInstance> instances) |
int |
getOrder() |
List<String> |
getUrls() |
void |
onBeforeRegistry(BootListener.BootEvent event) |
protected void |
registerMicroserviceMapping() |
void |
setEnvironment(org.springframework.core.env.Environment environment) |
void |
setUrls(String urlKey,
List<String> urls) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitonAfterClose, onAfterConsumerProvider, onAfterFilter, onAfterHandler, onAfterProducerProvider, onAfterRegistry, onAfterTransport, onBeforeClose, onBeforeConsumerProvider, onBeforeFilter, onBeforeHandler, onBeforeProducerProvider, onBeforeTransport, onBootEventpublic static final int ORDER
public static final String VERSION
protected List<String> urls
EndpointUtilsprotected String appId
protected final String microserviceName
public ThirdServiceRegister(String microserviceName)
public int getOrder()
getOrder in interface BootListenerpublic void setEnvironment(org.springframework.core.env.Environment environment)
setEnvironment in interface org.springframework.context.EnvironmentAwarepublic void onBeforeRegistry(BootListener.BootEvent event)
onBeforeRegistry in interface BootListenerprotected void registerMicroserviceMapping()
protected List<MicroserviceInstance> createInstances(List<String> endpoints)
protected MicroserviceVersions createMicroserviceVersions(List<MicroserviceInstance> instances)
Copyright © 2017–2022 The Apache Software Foundation. All rights reserved.