使用Apache Camel的Solr Delta导入调度 - 调用Delta Importer的数据导入处理程序



我是Solr和Camel的新手,这就是我要完成的工作:

我正在使用数据导入处理程序将数据索引到SOLR。当我从Solr Admin跑步时,所有内容(完整/Delta导入)都可以正常工作。我想编写一个调度程序,该调度程序将定期运行并触发从我的WebApp导入的三角洲。我正在尝试将Apache骆驼用于此目的。

我的目的是让骆驼石英调度程序每5分钟创建一个事件,然后将该事件重定向到SOLR路由,然后将其调用Solr Delta Import Handler。

    from("quartz2://SolrUpdateHandlerInvokerTimer?trigger.repeatCount=-1&trigger.repeatInterval=300000")
            .to("direct:insert");
    from("direct:insert")
            .to("solr://localhost:8080/solr/hylighter/dataimport?command=delta-import")
            .to("direct:commit");
    from("direct:commit")
          .setHeader(SolrConstants.OPERATION,constant(SolrConstants.OPERATION_COMMIT))
          .to("solr://localhost:8080/solr/hylighter");

,但这无效,并且在以下例外失败。

例外:

Caused by: 
org.apache.camel.ResolveEndpointFailedException: Failed to resolve endpoint: solr://localhost:8080/solr/hylighter/dataimport?command=delta-import due to: Failed to resolve endpoint: solr://localhost:8080/solr/hylighter/dataimport?command=delta-import due to: There are 1 parameters that couldn't be set on the endpoint. Check the uri if the parameters are spelt correctly and that they are properties of the endpoint. Unknown parameters=[{command=delta-import}]

如果我删除了?command=delta-import,则代码不会抛出任何异常并运行,但是当我检查dataimport.properties我的核心/conf文件夹中时,它没有更新,也没有我的索引。

有人可以帮助我确定我错了吗?

编辑:

路线更改:

    from("quartz2://SolrUpdateHandlerInvokerTimer?trigger.repeatCount=-1&trigger.repeatInterval=3000")
            .process(new LoggingProcessor())
            .to("direct:insert");
    from("direct:insert")
            .process(new SolrLoggingProcessor())
            .to("solr://localhost:8080/solr/hylighter/dataimport")
            .process(new SolrLoggingProcessor())
            .to("direct:commit");
    from("direct:commit")
            .setHeader(SolrConstants.OPERATION,constant(SolrConstants.OPERATION_COMMIT))
            .process(new CommitLoggingProcessor())
            .to("solr://localhost:8080/solr/hylighter")
            .process(new CommitLoggingProcessor());

跟踪:

Quartz路线:ID-BEE-58722-1390286766821-0-2
从SOLR UPDATE ID ID-BEE-58722-139028676821-0-2
石英路线:ID-BEE-58722-139028676821-0-4
从SOLR UPDATE ID ID-BEE-58722-139028676821-0-4
石英路线:ID-BEE-58722-1390286766821-0-6
从SOLR UPDATE ID ID-BEE-58722-139028676821-0-6
石英路线:ID-BEE-58722-139028676821-0-8
从SOLR UPDATE ID ID-BEE-58722-139028676821-0-8

我在路线的端点和路线中的端点之后添加了一个处理器,我看到一旦撞到了调用solr数据导入的路线,它不会返回并在路线中向前移动。

这就是我解决问题的方式。我使用了Camel-HTTP组件,而不是Camel-Solr组件,并调用了Solr Data Importer进行Delta导入。

路线:

    from("quartz2://SolrUpdateHandlerTimer?trigger.repeatCount=-1&trigger.repeatInterval=300000")
        .to("direct:start");
    from("direct:start")
        .setHeader(Exchange.HTTP_METHOD, constant("GET"))
        .to("http://localhost:8080/solr/hylighter/dataimport?command=delta-import&commit=true")
        .end();

最新更新