Search in sources :

Example 6 with FeederConfig

use of com.yahoo.vespaclient.config.FeederConfig in project vespa by vespa-engine.

the class ContainerDocumentApiBuilderTest method document_api_config_is_added_to_container_cluster.

@Test
public void document_api_config_is_added_to_container_cluster() throws Exception {
    Element elem = DomBuilderTest.parse("<jdisc id='cluster1' version='1.0'>", "  <document-api>", "    <abortondocumenterror>false</abortondocumenterror>", "    <maxpendingdocs>4321</maxpendingdocs>", "    <retrydelay>12.34</retrydelay>", "    <route>non-default</route>", "  </document-api>", nodesXml, "</jdisc>");
    createModel(root, elem);
    ContainerCluster cluster = (ContainerCluster) root.getProducer("cluster1");
    FeederConfig.Builder builder = new FeederConfig.Builder();
    cluster.getDocumentApi().getConfig(builder);
    FeederConfig config = new FeederConfig(builder);
    assertThat(config.abortondocumenterror(), is(false));
    assertThat(config.maxpendingdocs(), is(4321));
    assertThat(config.retrydelay(), is(12.34));
    assertThat(config.route(), is("non-default"));
}
Also used : Element(org.w3c.dom.Element) ContainerCluster(com.yahoo.vespa.model.container.ContainerCluster) FeederConfig(com.yahoo.vespaclient.config.FeederConfig) Test(org.junit.Test) DomBuilderTest(com.yahoo.config.model.builder.xml.test.DomBuilderTest)

Example 7 with FeederConfig

use of com.yahoo.vespaclient.config.FeederConfig in project vespa by vespa-engine.

the class GetSearcherTestCase method testConfig.

@Test
public void testConfig() throws Exception {
    DocumentSessionFactory factory = new DocumentSessionFactory(docType);
    GetSearcher searcher = new GetSearcher(new FeedContext(new MessagePropertyProcessor(new FeederConfig(new FeederConfig.Builder().timeout(58).route("route66").retryenabled(false)), defLoadTypeCfg), factory, docMan, new ClusterList(), new NullFeedMetric()));
    Chain<Searcher> searchChain = new Chain<>(searcher);
    Result result = new Execution(searchChain, Execution.Context.createContextStub()).search(newQuery("?id=doc:batman:dahnahnahnah"));
    assertEquals(1, factory.messages.size());
    {
        Message m = factory.messages.get(0);
        assertEquals(DocumentProtocol.MESSAGE_GETDOCUMENT, m.getType());
        GetDocumentMessage gdm = (GetDocumentMessage) m;
        DocumentId d = gdm.getDocumentId();
        assertEquals("doc:batman:dahnahnahnah", d.toString());
        assertEquals("[all]", gdm.getFieldSet());
        assertEquals(Route.parse("route66"), gdm.getRoute());
        assertFalse(gdm.getRetryEnabled());
        assertTrue(58000 >= gdm.getTimeRemaining());
    }
}
Also used : Chain(com.yahoo.component.chain.Chain) ClusterList(com.yahoo.vespaclient.ClusterList) Message(com.yahoo.messagebus.Message) GetDocumentMessage(com.yahoo.documentapi.messagebus.protocol.GetDocumentMessage) Searcher(com.yahoo.search.Searcher) FeederConfig(com.yahoo.vespaclient.config.FeederConfig) Result(com.yahoo.search.Result) Execution(com.yahoo.search.searchchain.Execution) FeedContext(com.yahoo.feedapi.FeedContext) GetDocumentMessage(com.yahoo.documentapi.messagebus.protocol.GetDocumentMessage) MessagePropertyProcessor(com.yahoo.feedapi.MessagePropertyProcessor) NullFeedMetric(com.yahoo.feedhandler.NullFeedMetric) Test(org.junit.Test)

Example 8 with FeederConfig

use of com.yahoo.vespaclient.config.FeederConfig in project vespa by vespa-engine.

the class GetSearcherTestCase method testConfigChanges.

@Test
public void testConfigChanges() throws Exception {
    String config = "raw:timeout 37\nroute \"riksveg18\"\nretryenabled true";
    DocumentSessionFactory factory = new DocumentSessionFactory(docType);
    GetSearcher searcher = new GetSearcher(new FeedContext(new MessagePropertyProcessor(new FeederConfig(new FeederConfig.Builder().timeout(58).route("riksveg18").retryenabled(true)), defLoadTypeCfg), factory, docMan, new ClusterList(), new NullFeedMetric()));
    Chain<Searcher> searchChain = new Chain<>(searcher);
    new Execution(searchChain, Execution.Context.createContextStub()).search(newQuery("?id=doc:batman:dahnahnahnah"));
    assertEquals(1, factory.messages.size());
    assertEquals(1, factory.getSessionsCreated());
    {
        Message m = factory.messages.get(0);
        assertEquals(DocumentProtocol.MESSAGE_GETDOCUMENT, m.getType());
        GetDocumentMessage gdm = (GetDocumentMessage) m;
        DocumentId d = gdm.getDocumentId();
        assertEquals("doc:batman:dahnahnahnah", d.toString());
        assertEquals("[all]", gdm.getFieldSet());
        assertEquals(Route.parse("riksveg18"), gdm.getRoute());
        assertTrue(gdm.getRetryEnabled());
        assertTrue(58000 >= gdm.getTimeRemaining());
    }
    factory.messages.clear();
    FeederConfig newConfig = new FeederConfig(new FeederConfig.Builder().timeout(123).route("e6").retryenabled(false));
    searcher.getMessagePropertyProcessor().configure(newConfig, defLoadTypeCfg);
    new Execution(searchChain, Execution.Context.createContextStub()).search(newQuery("?id=doc:spiderman:does_whatever_a_spider_can"));
    // riksveg18 is created again, and e6 is created as well.
    assertEquals(3, factory.getSessionsCreated());
    assertEquals(1, factory.messages.size());
    {
        Message m = factory.messages.get(0);
        assertEquals(DocumentProtocol.MESSAGE_GETDOCUMENT, m.getType());
        GetDocumentMessage gdm = (GetDocumentMessage) m;
        DocumentId d = gdm.getDocumentId();
        assertEquals("doc:spiderman:does_whatever_a_spider_can", d.toString());
        assertEquals("[all]", gdm.getFieldSet());
        assertEquals(Route.parse("e6"), gdm.getRoute());
        assertFalse(gdm.getRetryEnabled());
        assertTrue(123000 >= gdm.getTimeRemaining());
    }
}
Also used : Chain(com.yahoo.component.chain.Chain) ClusterList(com.yahoo.vespaclient.ClusterList) Message(com.yahoo.messagebus.Message) GetDocumentMessage(com.yahoo.documentapi.messagebus.protocol.GetDocumentMessage) Searcher(com.yahoo.search.Searcher) FeederConfig(com.yahoo.vespaclient.config.FeederConfig) Execution(com.yahoo.search.searchchain.Execution) FeedContext(com.yahoo.feedapi.FeedContext) GetDocumentMessage(com.yahoo.documentapi.messagebus.protocol.GetDocumentMessage) MessagePropertyProcessor(com.yahoo.feedapi.MessagePropertyProcessor) NullFeedMetric(com.yahoo.feedhandler.NullFeedMetric) Test(org.junit.Test)

Example 9 with FeederConfig

use of com.yahoo.vespaclient.config.FeederConfig in project vespa by vespa-engine.

the class VisitorSearcherTestCase method create.

public VisitSearcher create() throws Exception {
    ClusterListConfig.Storage.Builder storageCluster = new ClusterListConfig.Storage.Builder().configid("storage/cluster.foobar").name("foobar");
    ClusterListConfig clusterListCfg = new ClusterListConfig(new ClusterListConfig.Builder().storage(storageCluster));
    ClusterList clusterList = new ClusterList(clusterListCfg);
    return new VisitSearcher(new FeedContext(new MessagePropertyProcessor(new FeederConfig(new FeederConfig.Builder().timeout(458).route("riksveg18").retryenabled(true)), new LoadTypeConfig(new LoadTypeConfig.Builder())), factory, docMan, clusterList, new NullFeedMetric()));
}
Also used : ClusterList(com.yahoo.vespaclient.ClusterList) FeedContext(com.yahoo.feedapi.FeedContext) ClusterListConfig(com.yahoo.cloud.config.ClusterListConfig) FeederConfig(com.yahoo.vespaclient.config.FeederConfig) MessagePropertyProcessor(com.yahoo.feedapi.MessagePropertyProcessor) NullFeedMetric(com.yahoo.feedhandler.NullFeedMetric) LoadTypeConfig(com.yahoo.vespa.config.content.LoadTypeConfig)

Aggregations

FeederConfig (com.yahoo.vespaclient.config.FeederConfig)9 FeedContext (com.yahoo.feedapi.FeedContext)5 MessagePropertyProcessor (com.yahoo.feedapi.MessagePropertyProcessor)5 ClusterList (com.yahoo.vespaclient.ClusterList)5 Test (org.junit.Test)5 NullFeedMetric (com.yahoo.feedhandler.NullFeedMetric)4 ClusterListConfig (com.yahoo.cloud.config.ClusterListConfig)2 Chain (com.yahoo.component.chain.Chain)2 GetDocumentMessage (com.yahoo.documentapi.messagebus.protocol.GetDocumentMessage)2 Message (com.yahoo.messagebus.Message)2 Searcher (com.yahoo.search.Searcher)2 Execution (com.yahoo.search.searchchain.Execution)2 LoadTypeConfig (com.yahoo.vespa.config.content.LoadTypeConfig)2 Element (org.w3c.dom.Element)2 ComponentId (com.yahoo.component.ComponentId)1 ComponentRegistry (com.yahoo.component.provider.ComponentRegistry)1 DomBuilderTest (com.yahoo.config.model.builder.xml.test.DomBuilderTest)1 Container (com.yahoo.container.Container)1 CallStack (com.yahoo.docproc.CallStack)1 DocumentProcessingHandler (com.yahoo.docproc.jdisc.DocumentProcessingHandler)1