当前位置: 首页>>代码示例>>Java>>正文


Java RibbonTransportFactory类代码示例

本文整理汇总了Java中com.netflix.ribbon.RibbonTransportFactory的典型用法代码示例。如果您正苦于以下问题:Java RibbonTransportFactory类的具体用法?Java RibbonTransportFactory怎么用?Java RibbonTransportFactory使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


RibbonTransportFactory类属于com.netflix.ribbon包,在下文中一共展示了RibbonTransportFactory类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: shouldBindCustomClientConfigFactory

import com.netflix.ribbon.RibbonTransportFactory; //导入依赖的package包/类
@Test
public void shouldBindCustomClientConfigFactory() {
    ConfigurationManager.getConfigInstance().setProperty(MovieService.class.getSimpleName() + ".MyConfig.listOfServers", "localhost:" + port);

    Injector injector = Guice.createInjector(
            new AbstractModule() {
                @Override
                protected void configure() {
                    bind(RibbonResourceFactory.class).to(DefaultResourceFactory.class).in(Scopes.SINGLETON);
                    bind(RibbonTransportFactory.class).to(DefaultRibbonTransportFactory.class).in(Scopes.SINGLETON);
                    bind(AnnotationProcessorsProvider.class).to(DefaultAnnotationProcessorsProvider.class).in(Scopes.SINGLETON);
                    bind(ClientConfigFactory.class).to(MyClientConfigFactory.class).in(Scopes.SINGLETON);
                }
            },
            new AbstractModule() {
                @Override
                protected void configure() {
                    bind(MovieService.class).toProvider(new RibbonResourceProvider<MovieService>(MovieService.class)).asEagerSingleton();
                }
            }
    );

    RxMovieProxyExample example = injector.getInstance(RxMovieProxyExample.class);
    assertTrue(example.runExample());
}
 
开发者ID:Netflix,项目名称:ribbon,代码行数:26,代码来源:RxMovieProxyExampleTest.java

示例2: testTransportFactoryWithInjection

import com.netflix.ribbon.RibbonTransportFactory; //导入依赖的package包/类
@Test
public void testTransportFactoryWithInjection() {
    Injector injector = Guice.createInjector(
            new AbstractModule() {
                @Override
                protected void configure() {
                    bind(ClientConfigFactory.class).to(MyClientConfigFactory.class).in(Scopes.SINGLETON);
                    bind(RibbonTransportFactory.class).to(DefaultRibbonTransportFactory.class).in(Scopes.SINGLETON);
                }
            }
    );

    RibbonTransportFactory transportFactory = injector.getInstance(RibbonTransportFactory.class);
    HttpClient<ByteBuf, ByteBuf> client = transportFactory.newHttpClient("myClient");
    IClientConfig config = ((LoadBalancingHttpClient) client).getClientConfig();
    assertEquals("MyConfig", config.getNameSpace());
}
 
开发者ID:Netflix,项目名称:ribbon,代码行数:18,代码来源:RxMovieProxyExampleTest.java

示例3: configure

import com.netflix.ribbon.RibbonTransportFactory; //导入依赖的package包/类
@Override
protected void configure() {
    bind(ClientConfigFactory.class).to(DefaultClientConfigFactory.class).in(Scopes.SINGLETON);
    bind(RibbonTransportFactory.class).to(DefaultRibbonTransportFactory.class).in(Scopes.SINGLETON);
    bind(AnnotationProcessorsProvider.class).to(DefaultAnnotationProcessorsProvider.class).in(Scopes.SINGLETON);
    bind(RibbonResourceFactory.class).to(DefaultResourceFactory.class).in(Scopes.SINGLETON);
}
 
开发者ID:Netflix,项目名称:ribbon,代码行数:8,代码来源:RibbonModule.java

示例4: RibbonDynamicProxy

import com.netflix.ribbon.RibbonTransportFactory; //导入依赖的package包/类
public RibbonDynamicProxy(Class<T> clientInterface, RibbonResourceFactory resourceGroupFactory, ClientConfigFactory configFactory,
                          RibbonTransportFactory transportFactory, AnnotationProcessorsProvider processors) {
    registerAnnotationProcessors(processors);
    ClassTemplate<T> classTemplate = ClassTemplate.from(clientInterface);
    HttpResourceGroup httpResourceGroup = new ProxyHttpResourceGroupFactory<T>(classTemplate, resourceGroupFactory, processors).createResourceGroup();
    templateExecutorMap = MethodTemplateExecutor.from(httpResourceGroup, clientInterface, processors);
    lifeCycle = new ProxyLifecycleImpl(httpResourceGroup);
}
 
开发者ID:Netflix,项目名称:ribbon,代码行数:9,代码来源:RibbonDynamicProxy.java

示例5: newInstance

import com.netflix.ribbon.RibbonTransportFactory; //导入依赖的package包/类
@SuppressWarnings("unchecked")
public static <T> T newInstance(Class<T> clientInterface, RibbonResourceFactory resourceGroupFactory,
                                ClientConfigFactory configFactory, RibbonTransportFactory transportFactory, AnnotationProcessorsProvider processors) {
    if (!clientInterface.isInterface()) {
        throw new IllegalArgumentException(clientInterface.getName() + " is a class not interface");
    }
    return (T) Proxy.newProxyInstance(
            Thread.currentThread().getContextClassLoader(),
            new Class[]{clientInterface, ProxyLifeCycle.class},
            new RibbonDynamicProxy<T>(clientInterface, resourceGroupFactory, configFactory, transportFactory, processors)
    );
}
 
开发者ID:Netflix,项目名称:ribbon,代码行数:13,代码来源:RibbonDynamicProxy.java

示例6: SecuredRibbonResourceFactory

import com.netflix.ribbon.RibbonTransportFactory; //导入依赖的package包/类
public SecuredRibbonResourceFactory(final ClientConfigFactory configFactory, final RibbonTransportFactory transportFactory, final AnnotationProcessorsProvider processors) {
    super(configFactory, transportFactory, processors);
}
 
开发者ID:wildfly-swarm,项目名称:wildfly-swarm,代码行数:4,代码来源:SecuredRibbonResourceFactory.java

示例7: ProxyHttpResourceGroupFactory

import com.netflix.ribbon.RibbonTransportFactory; //导入依赖的package包/类
ProxyHttpResourceGroupFactory(ClassTemplate<T> classTemplate) {
    this(classTemplate, new DefaultResourceFactory(ClientConfigFactory.DEFAULT, RibbonTransportFactory.DEFAULT, AnnotationProcessorsProvider.DEFAULT),
            AnnotationProcessorsProvider.DEFAULT);
}
 
开发者ID:Netflix,项目名称:ribbon,代码行数:5,代码来源:ProxyHttpResourceGroupFactory.java

示例8: Builder

import com.netflix.ribbon.RibbonTransportFactory; //导入依赖的package包/类
private Builder(String name, ClientConfigFactory configFactory, RibbonTransportFactory transportFactory) {
    this.name = name;
    this.clientConfigFactory = configFactory;
    this.transportFactory = transportFactory;
}
 
开发者ID:Netflix,项目名称:ribbon,代码行数:6,代码来源:HttpResourceGroup.java

示例9: newBuilder

import com.netflix.ribbon.RibbonTransportFactory; //导入依赖的package包/类
public static Builder newBuilder(String groupName, ClientConfigFactory configFactory, RibbonTransportFactory transportFactory) {
    return new Builder(groupName, configFactory, transportFactory);
}
 
开发者ID:Netflix,项目名称:ribbon,代码行数:4,代码来源:HttpResourceGroup.java

示例10: HttpResourceGroup

import com.netflix.ribbon.RibbonTransportFactory; //导入依赖的package包/类
protected HttpResourceGroup(String groupName) {
    super(groupName, ClientOptions.create(), ClientConfigFactory.DEFAULT, RibbonTransportFactory.DEFAULT);
    client = transportFactory.newHttpClient(getClientConfig());
    headers = HttpHeaders.EMPTY_HEADERS;
}
 
开发者ID:Netflix,项目名称:ribbon,代码行数:6,代码来源:HttpResourceGroup.java

示例11: testResourceGroupAnnotationMissing

import com.netflix.ribbon.RibbonTransportFactory; //导入依赖的package包/类
@Test
public void testResourceGroupAnnotationMissing() throws Exception {
    ClassTemplate<SampleMovieService> classTemplate = new ClassTemplate<SampleMovieService>(SampleMovieService.class);
    new ProxyHttpResourceGroupFactory<SampleMovieService>(classTemplate, new DefaultResourceFactory(ClientConfigFactory.DEFAULT, RibbonTransportFactory.DEFAULT, AnnotationProcessorsProvider.DEFAULT),
            AnnotationProcessorsProvider.DEFAULT).createResourceGroup();
}
 
开发者ID:Netflix,项目名称:ribbon,代码行数:7,代码来源:HttpResourceGroupFactoryTest.java


注:本文中的com.netflix.ribbon.RibbonTransportFactory类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。