2016-02-17 14 views
0

我有一個駱駝Elasticsearch端點通過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節點?

回答

1

駱駝彈性搜索組件檢查configuration.getIp() == null是否確定它是否創建Elasticsearch節點。

因此,你必須在指定的URI的IP和端口禁用此功能,因爲這樣:

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