use of com.yahoo.vespaclient.config.FeederConfig in project vespa by vespa-engine.
the class DomV20ClientsBuilder method createSpoolers.
/**
* Creates VespaSpooler objects using the given xml Element.
*/
private void createSpoolers(AbstractConfigProducer pcp, Element element, Clients clients) {
String jvmArgs = null;
if (element.hasAttribute(VespaDomBuilder.JVMARGS_ATTRIB_NAME))
jvmArgs = element.getAttribute(VespaDomBuilder.JVMARGS_ATTRIB_NAME);
SimpleConfigProducer spoolerCfg = new VespaDomBuilder.DomSimpleConfigProducerBuilder(element.getNodeName()).build(pcp, element);
Element spoolersFeederOptions = findFeederOptions(element);
createSpoolMasters(spoolerCfg, element);
for (Element e : XML.getChildren(element, "spooler")) {
String configId = e.getAttribute("id").trim();
FeederConfig.Builder feederConfig = getFeederConfig(spoolersFeederOptions, e);
SpoolerConfig.Builder spoolConfig = getSpoolConfig(e);
if (configId.length() == 0) {
int index = clients.getVespaSpoolers().size();
VespaSpoolerService spoolerService = new VespaSpoolerServiceBuilder(index, new VespaSpooler(feederConfig, spoolConfig)).build(spoolerCfg, e);
if ("".equals(spoolerService.getJvmArgs()) && jvmArgs != null)
spoolerService.setJvmArgs(jvmArgs);
spoolerService.setProp("index", String.valueOf(index));
clients.getVespaSpoolers().add(spoolerService);
} else {
new VespaSpoolerProducerBuilder(configId, new VespaSpooler(feederConfig, spoolConfig)).build(spoolerCfg, e);
}
}
}
use of com.yahoo.vespaclient.config.FeederConfig in project vespa by vespa-engine.
the class VisitorSearcherTestCase method testNoClusterParamWhenSeveralClusters.
@Test(expected = IllegalArgumentException.class)
public void testNoClusterParamWhenSeveralClusters() throws Exception {
DocumentSessionFactory factory = new DocumentSessionFactory(docType);
ClusterListConfig.Storage.Builder storageCluster1 = new ClusterListConfig.Storage.Builder().configid("storage/cluster.foo").name("foo");
ClusterListConfig.Storage.Builder storageCluster2 = new ClusterListConfig.Storage.Builder().configid("storage/cluster.bar").name("bar");
ClusterListConfig clusterListCfg = new ClusterListConfig(new ClusterListConfig.Builder().storage(Arrays.asList(storageCluster1, storageCluster2)));
ClusterList clusterList = new ClusterList(clusterListCfg);
VisitSearcher searcher = new VisitSearcher(new FeedContext(new MessagePropertyProcessor(new FeederConfig(new FeederConfig.Builder().timeout(100).route("whatever").retryenabled(true)), new LoadTypeConfig(new LoadTypeConfig.Builder())), factory, docMan, clusterList, new NullFeedMetric()));
searcher.getVisitorParameters(newQuery("visit?visit.selection=id.user=1234"), null);
}
use of com.yahoo.vespaclient.config.FeederConfig in project vespa by vespa-engine.
the class VespaFeedHandlerTestCase method setup.
public void setup(com.yahoo.messagebus.Error e, LoadTypeConfig loadTypeCfg, boolean autoReply, DummySessionFactory.ReplyFactory autoReplyFactory) throws Exception {
DocumentTypeManager docMan = new DocumentTypeManager();
DocumentTypeManagerConfigurer.configure(docMan, "file:" + xmlFilesPath + "documentmanager.cfg");
if (autoReply) {
if (autoReplyFactory != null) {
factory = DummySessionFactory.createWithAutoReplyFactory(autoReplyFactory);
} else {
factory = DummySessionFactory.createWithErrorAutoReply(e);
}
} else {
factory = DummySessionFactory.createDefault();
}
context = new FeedContext(new MessagePropertyProcessor(new FeederConfig(new FeederConfig.Builder()), loadTypeCfg), factory, docMan, new ClusterList(), new NullFeedMetric());
Executor threadPool = Executors.newCachedThreadPool();
feedHandler = new VespaFeedHandler(context, threadPool);
removeHandler = new VespaFeedHandlerRemove(context, threadPool);
statusHandler = new VespaFeedHandlerStatus(context, false, false, threadPool);
removeLocationHandler = new VespaFeedHandlerRemoveLocation(context, threadPool);
CallStack dpCallstack = new CallStack("bar");
dpCallstack.addLast(new TestDocProc());
dpCallstack.addLast(new TestLaterDocProc());
DocprocService myservice = new DocprocService("bar");
myservice.setCallStack(dpCallstack);
myservice.setInService(true);
ComponentRegistry<DocprocService> registry = new ComponentRegistry<DocprocService>();
registry.register(new ComponentId(myservice.getName()), myservice);
DocumentProcessingHandler handler = new DocumentProcessingHandler(registry, new ComponentRegistry<>(), new ComponentRegistry<>(), new DocumentProcessingHandlerParameters());
Container container = Container.get();
ComponentRegistry<RequestHandler> requestHandlerComponentRegistry = new ComponentRegistry<>();
requestHandlerComponentRegistry.register(new ComponentId(DocumentProcessingHandler.class.getName()), handler);
container.setRequestHandlerRegistry(requestHandlerComponentRegistry);
}
use of com.yahoo.vespaclient.config.FeederConfig in project vespa by vespa-engine.
the class VespaFeederTestCase method testParseArgs.
@Test
public void testParseArgs() throws Exception {
String argsS = "--abortondataerror false --abortonsenderror false --file foo.xml --maxpending 10" + " --maxpendingsize 11 --maxfeedrate 29 --mode benchmark --noretry --retrydelay 12 --route e6 --timeout 13 --trace 4" + " --validate -v bar.xml --priority LOW_1";
Arguments arguments = new Arguments(argsS.split(" "), DummySessionFactory.createWithAutoReply());
FeederConfig config = arguments.getFeederConfig();
assertEquals(false, config.abortondocumenterror());
assertEquals(13.0, config.timeout(), 0.00001);
assertEquals(false, config.retryenabled());
assertEquals(12.0, config.retrydelay(), 0.0001);
assertEquals("e6", config.route());
assertEquals(4, config.tracelevel());
assertEquals(false, config.abortonsenderror());
assertEquals(10, config.maxpendingdocs());
assertEquals(11, config.maxpendingbytes());
assertEquals(29.0, config.maxfeedrate(), 0.0001);
assertTrue(arguments.isVerbose());
assertFalse(config.createifnonexistent());
assertEquals("LOW_1", arguments.getPriority());
assertEquals("benchmark", arguments.getMode());
assertEquals("foo.xml", arguments.getFiles().get(0));
assertEquals("bar.xml", arguments.getFiles().get(1));
}
use of com.yahoo.vespaclient.config.FeederConfig in project vespa by vespa-engine.
the class SpoolerTestCase method testFeederConfigBuilder.
private void testFeederConfigBuilder(VespaModel model, String id, FeederConfig.Builder expected) throws Exception {
FeederConfig.Builder b = new FeederConfig.Builder();
model.getConfig(b, id);
FeederConfig config = new FeederConfig(b);
FeederConfig expectedConfig = new FeederConfig(expected);
assertEquals(expectedConfig, config);
}
Aggregations