Search in sources :

Example 1 with JRTConfigRequester

use of com.yahoo.config.subscription.impl.JRTConfigRequester in project vespa by vespa-engine.

the class RpcConfigSourceClient method getSourceConnections.

@Override
public List<String> getSourceConnections() {
    ArrayList<String> ret = new ArrayList<>();
    final JRTConfigRequester jrtConfigRequester = requesterPool.get(configSourceSet);
    if (jrtConfigRequester != null) {
        ret.addAll(configSourceSet.getSources());
    }
    return ret;
}
Also used : JRTConfigRequester(com.yahoo.config.subscription.impl.JRTConfigRequester)

Example 2 with JRTConfigRequester

use of com.yahoo.config.subscription.impl.JRTConfigRequester in project vespa by vespa-engine.

the class GenericConfigSubscriberTest method testGenericRequesterPooling.

@Test
public void testGenericRequesterPooling() {
    ConfigSourceSet source1 = new ConfigSourceSet("tcp/foo:78");
    ConfigSourceSet source2 = new ConfigSourceSet("tcp/bar:79");
    JRTConfigRequester req1 = JRTConfigRequester.get(new JRTConnectionPool(source1), JRTConfigRequesterTest.getTestTimingValues());
    JRTConfigRequester req2 = JRTConfigRequester.get(new JRTConnectionPool(source2), JRTConfigRequesterTest.getTestTimingValues());
    Map<ConfigSourceSet, JRTConfigRequester> requesters = new LinkedHashMap<>();
    requesters.put(source1, req1);
    requesters.put(source2, req2);
    GenericConfigSubscriber sub = new GenericConfigSubscriber(requesters);
    assertEquals(sub.requesters().get(source1).getConnectionPool().getCurrent().getAddress(), "tcp/foo:78");
    assertEquals(sub.requesters().get(source2).getConnectionPool().getCurrent().getAddress(), "tcp/bar:79");
}
Also used : JRTConnectionPool(com.yahoo.vespa.config.JRTConnectionPool) JRTConfigRequester(com.yahoo.config.subscription.impl.JRTConfigRequester) GenericConfigSubscriber(com.yahoo.config.subscription.impl.GenericConfigSubscriber) JRTConfigRequesterTest(com.yahoo.config.subscription.impl.JRTConfigRequesterTest) Test(org.junit.Test)

Example 3 with JRTConfigRequester

use of com.yahoo.config.subscription.impl.JRTConfigRequester in project vespa by vespa-engine.

the class GenericConfigSubscriberTest method testSubscribeGeneric.

@Test
public void testSubscribeGeneric() {
    Map<ConfigSourceSet, JRTConfigRequester> requesters = new HashMap<>();
    ConfigSourceSet sourceSet = new ConfigSourceSet("blabla");
    requesters.put(sourceSet, JRTConfigRequester.get(new MockConnection(), JRTConfigRequesterTest.getTestTimingValues()));
    GenericConfigSubscriber sub = new GenericConfigSubscriber(requesters);
    final List<String> defContent = Arrays.asList("myVal int");
    GenericConfigHandle handle = sub.subscribe(new ConfigKey<>("simpletypes", "id", "config"), defContent, sourceSet, JRTConfigRequesterTest.getTestTimingValues());
    assertTrue(sub.nextConfig());
    assertTrue(handle.isChanged());
    // MockConnection returns empty string
    assertThat(handle.getRawConfig().getPayload().withCompression(CompressionType.UNCOMPRESSED).toString(), is("{}"));
    assertFalse(sub.nextConfig());
    assertFalse(handle.isChanged());
}
Also used : GenericConfigHandle(com.yahoo.config.subscription.impl.GenericConfigHandle) JRTConfigRequester(com.yahoo.config.subscription.impl.JRTConfigRequester) GenericConfigSubscriber(com.yahoo.config.subscription.impl.GenericConfigSubscriber) MockConnection(com.yahoo.config.subscription.impl.MockConnection) JRTConfigRequesterTest(com.yahoo.config.subscription.impl.JRTConfigRequesterTest) Test(org.junit.Test)

Aggregations

JRTConfigRequester (com.yahoo.config.subscription.impl.JRTConfigRequester)3 GenericConfigSubscriber (com.yahoo.config.subscription.impl.GenericConfigSubscriber)2 JRTConfigRequesterTest (com.yahoo.config.subscription.impl.JRTConfigRequesterTest)2 Test (org.junit.Test)2 GenericConfigHandle (com.yahoo.config.subscription.impl.GenericConfigHandle)1 MockConnection (com.yahoo.config.subscription.impl.MockConnection)1 JRTConnectionPool (com.yahoo.vespa.config.JRTConnectionPool)1