gpt4 book ai didi

elasticsearch - 如何迫使Camel Elasticsearch在测试中不启动本地节点?

转载 作者:行者123 更新时间:2023-12-03 01:57:41 27 4
gpt4 key购买 nike

我有一个通过URI配置的Camel-Elasticsearch端点,如下所示:

.to("elasticsearch://clusterName?operation=INDEX&indexName=" + elasticIndex + "&indexType=" + elasticIndexType)

在测试中,我拦截了此端点,并且只想确认我是否已通过以下方式向此处发送了有效负载:
elasticEndpoint = context.getEndpoint("mock:elastic", MockEndpoint.class);
interceptRoute = new AdviceWithRouteBuilder() {
@Override
public void configure() throws Exception {
interceptSendToEndpoint("elasticsearch:*")
.skipSendToOriginalEndpoint()
.to(elasticEndpoint);
}
};

但是,这总是提示Camel启动本地嵌入式ElasticSearch,这反过来又在我的Jenkins服务器上创建了我不想要的数据文件夹。

如何禁用本地Elasticsearch-node的自动创建?

最佳答案

camel-elasticsearch组件检查是否configuration.getIp() == null以确定是否创建了Elasticsearch节点。

因此,您必须在URI中指定IP和端 Eloquent 能将其禁用,例如:

.to("elasticsearch://clusterName?ip="+ elasticHostIp + "&port=" + elasticHostPort + "&operation=INDEX&indexName=" + elasticIndex + "&indexType=" + elasticIndexType)

关于elasticsearch - 如何迫使Camel Elasticsearch在测试中不启动本地节点?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35461100/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com