Search in sources :

Example 11 with ClientFactoryInternal

use of com.alipay.sofa.runtime.spi.client.ClientFactoryInternal in project sofa-boot by sofastack.

the class RuntimeTestConfiguration method sofaRuntimeManager.

@Bean
@ConditionalOnMissingBean
public static SofaRuntimeManager sofaRuntimeManager(@Value("${spring.application.name}") String appName, BindingConverterFactory bindingConverterFactory, BindingAdapterFactory bindingAdapterFactory) {
    ClientFactoryInternal clientFactoryInternal = new ClientFactoryImpl();
    SofaRuntimeManager sofaRuntimeManager = new StandardSofaRuntimeManager(appName, Thread.currentThread().getContextClassLoader(), clientFactoryInternal);
    sofaRuntimeManager.getComponentManager().registerComponentClient(ReferenceClient.class, new ReferenceClientImpl(sofaRuntimeManager.getSofaRuntimeContext(), bindingConverterFactory, bindingAdapterFactory));
    sofaRuntimeManager.getComponentManager().registerComponentClient(ServiceClient.class, new ServiceClientImpl(sofaRuntimeManager.getSofaRuntimeContext(), bindingConverterFactory, bindingAdapterFactory));
    SofaFramework.registerSofaRuntimeManager(sofaRuntimeManager);
    return sofaRuntimeManager;
}
Also used : ClientFactoryImpl(com.alipay.sofa.runtime.client.impl.ClientFactoryImpl) ClientFactoryInternal(com.alipay.sofa.runtime.spi.client.ClientFactoryInternal) ReferenceClientImpl(com.alipay.sofa.runtime.service.client.ReferenceClientImpl) StandardSofaRuntimeManager(com.alipay.sofa.runtime.component.impl.StandardSofaRuntimeManager) ServiceClientImpl(com.alipay.sofa.runtime.service.client.ServiceClientImpl) SofaRuntimeManager(com.alipay.sofa.runtime.spi.component.SofaRuntimeManager) StandardSofaRuntimeManager(com.alipay.sofa.runtime.component.impl.StandardSofaRuntimeManager) ConditionalOnMissingBean(org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean) ConditionalOnMissingBean(org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean) Bean(org.springframework.context.annotation.Bean)

Example 12 with ClientFactoryInternal

use of com.alipay.sofa.runtime.spi.client.ClientFactoryInternal in project sofa-boot by sofastack.

the class RuntimeConfiguration method sofaRuntimeManager.

@Bean
@ConditionalOnMissingBean
public static SofaRuntimeManager sofaRuntimeManager(Environment environment, BindingConverterFactory bindingConverterFactory, BindingAdapterFactory bindingAdapterFactory) {
    String appName = environment.getProperty(SofaBootConstants.APP_NAME_KEY);
    ClientFactoryInternal clientFactoryInternal = new ClientFactoryImpl();
    SofaRuntimeManager sofaRuntimeManager = new StandardSofaRuntimeManager(appName, Thread.currentThread().getContextClassLoader(), clientFactoryInternal);
    sofaRuntimeManager.getComponentManager().registerComponentClient(ReferenceClient.class, new ReferenceClientImpl(sofaRuntimeManager.getSofaRuntimeContext(), bindingConverterFactory, bindingAdapterFactory));
    sofaRuntimeManager.getComponentManager().registerComponentClient(ServiceClient.class, new ServiceClientImpl(sofaRuntimeManager.getSofaRuntimeContext(), bindingConverterFactory, bindingAdapterFactory));
    SofaFramework.registerSofaRuntimeManager(sofaRuntimeManager);
    return sofaRuntimeManager;
}
Also used : ClientFactoryImpl(com.alipay.sofa.runtime.client.impl.ClientFactoryImpl) ClientFactoryInternal(com.alipay.sofa.runtime.spi.client.ClientFactoryInternal) ReferenceClientImpl(com.alipay.sofa.runtime.service.client.ReferenceClientImpl) StandardSofaRuntimeManager(com.alipay.sofa.runtime.component.impl.StandardSofaRuntimeManager) ServiceClientImpl(com.alipay.sofa.runtime.service.client.ServiceClientImpl) SofaRuntimeManager(com.alipay.sofa.runtime.spi.component.SofaRuntimeManager) StandardSofaRuntimeManager(com.alipay.sofa.runtime.component.impl.StandardSofaRuntimeManager) ConditionalOnMissingBean(org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean) ConditionalOnMissingBean(org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean) Bean(org.springframework.context.annotation.Bean)

Example 13 with ClientFactoryInternal

use of com.alipay.sofa.runtime.spi.client.ClientFactoryInternal in project sofa-boot by sofastack.

the class RuntimeConfiguration method sofaRuntimeManager.

@Bean
@ConditionalOnMissingBean
public static SofaRuntimeManager sofaRuntimeManager(Environment environment, BindingConverterFactory bindingConverterFactory, BindingAdapterFactory bindingAdapterFactory) {
    String appName = environment.getProperty(SofaBootConstants.APP_NAME_KEY);
    ClientFactoryInternal clientFactoryInternal = new ClientFactoryImpl();
    SofaRuntimeManager sofaRuntimeManager = new StandardSofaRuntimeManager(appName, Thread.currentThread().getContextClassLoader(), clientFactoryInternal);
    sofaRuntimeManager.getComponentManager().registerComponentClient(ReferenceClient.class, new ReferenceClientImpl(sofaRuntimeManager.getSofaRuntimeContext(), bindingConverterFactory, bindingAdapterFactory));
    sofaRuntimeManager.getComponentManager().registerComponentClient(ServiceClient.class, new ServiceClientImpl(sofaRuntimeManager.getSofaRuntimeContext(), bindingConverterFactory, bindingAdapterFactory));
    SofaFramework.registerSofaRuntimeManager(sofaRuntimeManager);
    return sofaRuntimeManager;
}
Also used : ClientFactoryImpl(com.alipay.sofa.runtime.client.impl.ClientFactoryImpl) ClientFactoryInternal(com.alipay.sofa.runtime.spi.client.ClientFactoryInternal) ReferenceClientImpl(com.alipay.sofa.runtime.service.client.ReferenceClientImpl) StandardSofaRuntimeManager(com.alipay.sofa.runtime.component.impl.StandardSofaRuntimeManager) ServiceClientImpl(com.alipay.sofa.runtime.service.client.ServiceClientImpl) SofaRuntimeManager(com.alipay.sofa.runtime.spi.component.SofaRuntimeManager) StandardSofaRuntimeManager(com.alipay.sofa.runtime.component.impl.StandardSofaRuntimeManager) ConditionalOnMissingBean(org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean) ConditionalOnMissingBean(org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean) Bean(org.springframework.context.annotation.Bean)

Aggregations

ClientFactoryInternal (com.alipay.sofa.runtime.spi.client.ClientFactoryInternal)13 ClientFactoryImpl (com.alipay.sofa.runtime.client.impl.ClientFactoryImpl)11 StandardSofaRuntimeManager (com.alipay.sofa.runtime.component.impl.StandardSofaRuntimeManager)11 SofaRuntimeManager (com.alipay.sofa.runtime.spi.component.SofaRuntimeManager)11 ConditionalOnMissingBean (org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean)10 Bean (org.springframework.context.annotation.Bean)10 ReferenceClientImpl (com.alipay.sofa.runtime.service.client.ReferenceClientImpl)9 ServiceClientImpl (com.alipay.sofa.runtime.service.client.ServiceClientImpl)9 ComponentManager (com.alipay.sofa.runtime.spi.component.ComponentManager)3 ErrorCode (com.alipay.sofa.boot.error.ErrorCode)2 SofaRuntimeProperties (com.alipay.sofa.runtime.SofaRuntimeProperties)2 ServiceRuntimeException (com.alipay.sofa.runtime.api.ServiceRuntimeException)2 ComponentName (com.alipay.sofa.runtime.api.component.ComponentName)2 SofaLogger (com.alipay.sofa.runtime.log.SofaLogger)2 ComponentStatus (com.alipay.sofa.runtime.model.ComponentStatus)2 ComponentType (com.alipay.sofa.runtime.model.ComponentType)2 ComponentInfo (com.alipay.sofa.runtime.spi.component.ComponentInfo)2 SpringContextComponent (com.alipay.sofa.runtime.spring.SpringContextComponent)2 ArrayList (java.util.ArrayList)2 Collection (java.util.Collection)2