Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/305.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java Camel restlet在POST后终止,而不是返回正文_Java_Apache Camel_Restlet_Jbossfuse_Blueprint - Fatal编程技术网

Java Camel restlet在POST后终止,而不是返回正文

Java Camel restlet在POST后终止,而不是返回正文,java,apache-camel,restlet,jbossfuse,blueprint,Java,Apache Camel,Restlet,Jbossfuse,Blueprint,我正在使用blueprint开发一个camel restlet项目,以部署到Fuse上。这是一个非常简单的HTTP POST,具有简单的文本体。我仅将交换模式设置为inoly 然而,我期望连接在实际发布后终止,但是我收到了一个200 OK,正文中填充了最终正文在处理中的内容 这就是它的工作原理吗?因此,我是否需要手动清除车身 另外,如果处理是一个长时间运行的过程,会发生什么?我希望在数据发布后立即终止,而不是等到上下文中完成处理 我的蓝图是这样的: <camelContext xmlns

我正在使用blueprint开发一个camel restlet项目,以部署到Fuse上。这是一个非常简单的HTTP POST,具有简单的文本体。我仅将交换模式设置为
inoly

然而,我期望连接在实际发布后终止,但是我收到了一个200 OK,正文中填充了最终正文在处理中的内容

这就是它的工作原理吗?因此,我是否需要手动清除车身

另外,如果处理是一个长时间运行的过程,会发生什么?我希望在数据发布后立即终止,而不是等到上下文中完成处理

我的蓝图是这样的:

 <camelContext xmlns="http://camel.apache.org/schema/blueprint">
  <route id="timerToLog">
    <from uri="restlet:http://localhost:7070/arena?restletMethod=POST&amp;exchangePattern=inOnly"/>
    <process ref="marcformatreader"/>
    <log message="${body}" loggingLevel="INFO"/>
    <process ref="marcformatwriter"/>
    <log message="${body}" loggingLevel="INFO"/>
    <to pattern="InOnly" uri="file:C:/Camel/output?fileName=output.mrc"/>
  </route>
</camelContext>

一种解决方案是像这样立即使用并返回响应(注意!我没有执行该代码,所以请注意可能的打字错误)


好啊

使用WireTap,Camel将继续在另一个线程中处理交换,因此POST方法将立即返回文本“OK”

啊哈,听起来很有趣,我会试一试,测试一下,然后带着结果回来。希望将来有一个简单的参数可以设置来启用它。您的代码几乎是正确的。我还必须添加属性copy=“true”。我将编辑你的文章只是为了澄清。唯一奇怪的是,你实际上没有看到这反映了节点的图形布局。您可以在xml文件中看到它,但是节点没有反映出来,我猜这是因为在一个路由文件中不能有多个源。
<camelContext xmlns="http://camel.apache.org/schema/blueprint">
    <route id="timerToLog">
        <from uri="restlet:http://localhost:7070/arena?restletMethod=POST&amp;exchangePattern=inOnly"/>
        <wireTap uri="direct:tap" copy="true"></wireTap>
        <transform>
            <constant>OK</constant>
        </transform>
    </route>

    <route id="wireTapToLog">
        <from uri="direct:tap"/>
        <process ref="marcformatreader"/>
        <log message="${body}" loggingLevel="INFO"/>
        <process ref="marcformatwriter"/>
        <log message="${body}" loggingLevel="INFO"/>
        <to pattern="InOnly" uri="file:C:/Camel/output?fileName=output.mrc"/>
    </route>

</camelContext>