Search in sources :

Example 1 with PojoConsumerMeta

use of org.apache.servicecomb.provider.pojo.definition.PojoConsumerMeta in project java-chassis by ServiceComb.

the class PojoConsumerMetaRefresher method refreshMeta.

protected PojoConsumerMeta refreshMeta() {
    MicroserviceReferenceConfig microserviceReferenceConfig = scbEngine.createMicroserviceReferenceConfig(microserviceName);
    MicroserviceMeta microserviceMeta = microserviceReferenceConfig.getLatestMicroserviceMeta();
    SchemaMeta schemaMeta = findSchemaMeta(microserviceMeta);
    if (schemaMeta == null) {
        throw new IllegalStateException(String.format("Schema not exist, microserviceName=%s, schemaId=%s, consumer interface=%s; " + "new producer not running or not deployed.", microserviceName, schemaId, consumerIntf.getName()));
    }
    SwaggerConsumer swaggerConsumer = scbEngine.getSwaggerEnvironment().createConsumer(consumerIntf, schemaMeta.getSwagger());
    return new PojoConsumerMeta(microserviceReferenceConfig, swaggerConsumer, schemaMeta);
}
Also used : MicroserviceReferenceConfig(org.apache.servicecomb.core.provider.consumer.MicroserviceReferenceConfig) SwaggerConsumer(org.apache.servicecomb.swagger.engine.SwaggerConsumer) SchemaMeta(org.apache.servicecomb.core.definition.SchemaMeta) MicroserviceMeta(org.apache.servicecomb.core.definition.MicroserviceMeta) PojoConsumerMeta(org.apache.servicecomb.provider.pojo.definition.PojoConsumerMeta)

Example 2 with PojoConsumerMeta

use of org.apache.servicecomb.provider.pojo.definition.PojoConsumerMeta in project java-chassis by ServiceComb.

the class PojoInvocationCreator method create.

public PojoInvocation create(Method method, PojoConsumerMetaRefresher metaRefresher, Object[] args) {
    PojoConsumerMeta pojoConsumerMeta = metaRefresher.getLatestMeta();
    PojoConsumerOperationMeta consumerOperationMeta = pojoConsumerMeta.ensureFindOperationMeta(method);
    PojoInvocation invocation = new PojoInvocation(consumerOperationMeta);
    invocation.setSuccessResponseType(consumerOperationMeta.getResponsesType());
    invocation.setInvocationArguments(consumerOperationMeta.getSwaggerConsumerOperation().toInvocationArguments(args));
    invocation.setSync(consumerOperationMeta.isSync());
    return invocation;
}
Also used : PojoConsumerOperationMeta(org.apache.servicecomb.provider.pojo.definition.PojoConsumerOperationMeta) PojoConsumerMeta(org.apache.servicecomb.provider.pojo.definition.PojoConsumerMeta)

Example 3 with PojoConsumerMeta

use of org.apache.servicecomb.provider.pojo.definition.PojoConsumerMeta in project incubator-servicecomb-java-chassis by apache.

the class PojoConsumerMetaRefresher method refreshMeta.

protected PojoConsumerMeta refreshMeta() {
    MicroserviceReferenceConfig microserviceReferenceConfig = scbEngine.createMicroserviceReferenceConfig(microserviceName);
    MicroserviceMeta microserviceMeta = microserviceReferenceConfig.getLatestMicroserviceMeta();
    SchemaMeta schemaMeta = findSchemaMeta(microserviceMeta);
    if (schemaMeta == null) {
        throw new IllegalStateException(String.format("Schema not exist, microserviceName=%s, schemaId=%s, consumer interface=%s; " + "new producer not running or not deployed.", microserviceName, schemaId, consumerIntf.getName()));
    }
    SwaggerConsumer swaggerConsumer = scbEngine.getSwaggerEnvironment().createConsumer(consumerIntf, schemaMeta.getSwagger());
    return new PojoConsumerMeta(microserviceReferenceConfig, swaggerConsumer, schemaMeta);
}
Also used : MicroserviceReferenceConfig(org.apache.servicecomb.core.provider.consumer.MicroserviceReferenceConfig) SwaggerConsumer(org.apache.servicecomb.swagger.engine.SwaggerConsumer) SchemaMeta(org.apache.servicecomb.core.definition.SchemaMeta) MicroserviceMeta(org.apache.servicecomb.core.definition.MicroserviceMeta) PojoConsumerMeta(org.apache.servicecomb.provider.pojo.definition.PojoConsumerMeta)

Example 4 with PojoConsumerMeta

use of org.apache.servicecomb.provider.pojo.definition.PojoConsumerMeta in project incubator-servicecomb-java-chassis by apache.

the class PojoInvocationCreator method create.

public PojoInvocation create(Method method, PojoConsumerMetaRefresher metaRefresher, Object[] args) {
    PojoConsumerMeta pojoConsumerMeta = metaRefresher.getLatestMeta();
    PojoConsumerOperationMeta consumerOperationMeta = pojoConsumerMeta.ensureFindOperationMeta(method);
    PojoInvocation invocation = new PojoInvocation(consumerOperationMeta);
    invocation.setSuccessResponseType(consumerOperationMeta.getResponsesType());
    invocation.setInvocationArguments(consumerOperationMeta.getSwaggerConsumerOperation().toInvocationArguments(args));
    invocation.setSync(consumerOperationMeta.isSync());
    return invocation;
}
Also used : PojoConsumerOperationMeta(org.apache.servicecomb.provider.pojo.definition.PojoConsumerOperationMeta) PojoConsumerMeta(org.apache.servicecomb.provider.pojo.definition.PojoConsumerMeta)

Aggregations

PojoConsumerMeta (org.apache.servicecomb.provider.pojo.definition.PojoConsumerMeta)4 MicroserviceMeta (org.apache.servicecomb.core.definition.MicroserviceMeta)2 SchemaMeta (org.apache.servicecomb.core.definition.SchemaMeta)2 MicroserviceReferenceConfig (org.apache.servicecomb.core.provider.consumer.MicroserviceReferenceConfig)2 PojoConsumerOperationMeta (org.apache.servicecomb.provider.pojo.definition.PojoConsumerOperationMeta)2 SwaggerConsumer (org.apache.servicecomb.swagger.engine.SwaggerConsumer)2