use of org.apache.servicecomb.foundation.common.event.SubscriberOrder in project java-chassis by ServiceComb.
the class ServiceRegistryListener method onCreateMicroserviceVersion.
@EnableExceptionPropagation
@SubscriberOrder(-1000)
@Subscribe
public void onCreateMicroserviceVersion(CreateMicroserviceVersionEvent event) {
// TODO:如果失败,应该标记出错,以便删除MicroserviceVersions
MicroserviceVersion microserviceVersion = event.getMicroserviceVersion();
Microservice microservice = microserviceVersion.getMicroservice();
// not shortName, to support cross app invoke
String microserviceName = microserviceVersion.getMicroserviceName();
MicroserviceMeta microserviceMeta = new MicroserviceMeta(scbEngine, microserviceName, true);
microserviceMeta.setHandlerChain(scbEngine.getConsumerHandlerManager().getOrCreate(microserviceName));
microserviceMeta.setFilterChain(scbEngine.getFilterChainsManager().findConsumerChain(microserviceName));
MicroserviceVersions microserviceVersions = microserviceVersion.getMicroserviceVersions();
microserviceMeta.setMicroserviceVersionsMeta(getMicroserviceVersionsMeta(microserviceVersions));
boolean isServiceCenter = DefinitionConst.REGISTRY_APP_ID.equals(microservice.getAppId()) && DefinitionConst.REGISTRY_SERVICE_NAME.equals(microservice.getServiceName());
// service center better to resolve the problem.
if (!isServiceCenter) {
for (String schemaId : microservice.getSchemas()) {
Swagger swagger = scbEngine.getSwaggerLoader().loadSwagger(microservice, microserviceVersion.getInstances(), schemaId);
// non java-chassis framework.
if (swagger != null) {
microserviceMeta.registerSchemaMeta(schemaId, swagger);
}
}
}
microserviceMeta.putExtData(CORE_MICROSERVICE_VERSION, microserviceVersion);
microserviceVersion.getVendorExtensions().put(CORE_MICROSERVICE_META, microserviceMeta);
}
use of org.apache.servicecomb.foundation.common.event.SubscriberOrder in project java-chassis by ServiceComb.
the class ServiceRegistryListener method onCreateMicroservice.
@EnableExceptionPropagation
@SubscriberOrder(-1000)
@Subscribe
public void onCreateMicroservice(CreateMicroserviceEvent event) {
MicroserviceVersions microserviceVersions = event.getMicroserviceVersions();
microserviceVersions.getVendorExtensions().put(CORE_MICROSERVICE_VERSIONS_META, new ConsumerMicroserviceVersionsMeta(scbEngine, microserviceVersions));
}
use of org.apache.servicecomb.foundation.common.event.SubscriberOrder in project incubator-servicecomb-java-chassis by apache.
the class ServiceRegistryListener method onCreateMicroservice.
@EnableExceptionPropagation
@SubscriberOrder(-1000)
@Subscribe
public void onCreateMicroservice(CreateMicroserviceEvent event) {
MicroserviceVersions microserviceVersions = event.getMicroserviceVersions();
microserviceVersions.getVendorExtensions().put(CORE_MICROSERVICE_VERSIONS_META, new ConsumerMicroserviceVersionsMeta(scbEngine, microserviceVersions));
}
use of org.apache.servicecomb.foundation.common.event.SubscriberOrder in project incubator-servicecomb-java-chassis by apache.
the class ServiceRegistryListener method onCreateMicroserviceVersion.
@EnableExceptionPropagation
@SubscriberOrder(-1000)
@Subscribe
public void onCreateMicroserviceVersion(CreateMicroserviceVersionEvent event) {
// TODO:如果失败,应该标记出错,以便删除MicroserviceVersions
MicroserviceVersion microserviceVersion = event.getMicroserviceVersion();
Microservice microservice = microserviceVersion.getMicroservice();
// not shortName, to support cross app invoke
String microserviceName = microserviceVersion.getMicroserviceName();
MicroserviceMeta microserviceMeta = new MicroserviceMeta(scbEngine, microserviceName, true);
microserviceMeta.setHandlerChain(scbEngine.getConsumerHandlerManager().getOrCreate(microserviceName));
microserviceMeta.setFilterChain(scbEngine.getFilterChainsManager().findConsumerChain(microserviceName));
MicroserviceVersions microserviceVersions = microserviceVersion.getMicroserviceVersions();
microserviceMeta.setMicroserviceVersionsMeta(getMicroserviceVersionsMeta(microserviceVersions));
boolean isServiceCenter = DefinitionConst.REGISTRY_APP_ID.equals(microservice.getAppId()) && DefinitionConst.REGISTRY_SERVICE_NAME.equals(microservice.getServiceName());
// service center better to resolve the problem.
if (!isServiceCenter) {
for (String schemaId : microservice.getSchemas()) {
Swagger swagger = scbEngine.getSwaggerLoader().loadSwagger(microservice, microserviceVersion.getInstances(), schemaId);
// non java-chassis framework.
if (swagger != null) {
microserviceMeta.registerSchemaMeta(schemaId, swagger);
}
}
}
microserviceMeta.putExtData(CORE_MICROSERVICE_VERSION, microserviceVersion);
microserviceVersion.getVendorExtensions().put(CORE_MICROSERVICE_META, microserviceMeta);
}
Aggregations