我有一个由URI配置的Camel-Elasticsearch端点,如下所示:
SELECT t.[Description],
t.RequestedCompletionDate,
t.CommitDate,
t.StatusId,
t.PriorityId,
p.ProjectNumber,
s.Name AS StatusDescription,
pr.Name AS PriorityDescription
FROM ProjectTask t
inner join Project p
on p.Id = t.ProjectId
inner join Project_TaskStatus s
on s.Id = t.StatusId
inner join Project_Priority pr
on pr.Id = t.PriorityId
WHERE t.Type = 'ET'
AND t.StatusId NOT IN (4,7)
AND
(
SELECT StatusId FROM Project WHERE Id = p.Id
)
NOT IN (3, 4)
ORDER BY t.PriorityId,
t.CommitDate,
t.RequestedCompletionDate
在测试中,我拦截了这个端点,只是想通过这样做确认我已经在这里发送了有效载荷:
.to("elasticsearch://clusterName?operation=INDEX&indexName=" + elasticIndex + "&indexType=" + elasticIndexType)
然而,这总是会提示Camel启动一个本地嵌入式ElasticSearch,这反过来会在我的Jenkins服务器上创建一个我不想要的数据文件夹。
如何禁用自动创建本地Elasticsearch节点?
答案 0 :(得分:1)
camel-elasticsearch组件检查configuration.getIp() == null是否确定它是否创建了Elasticsearch节点。
因此,您必须在URI中指定IP和端口以禁用此功能,因此:
elasticEndpoint = context.getEndpoint("mock:elastic", MockEndpoint.class);
interceptRoute = new AdviceWithRouteBuilder() {
@Override
public void configure() throws Exception {
interceptSendToEndpoint("elasticsearch:*")
.skipSendToOriginalEndpoint()
.to(elasticEndpoint);
}
};