【问题标题】:How do I add only the parameter value to the endpoint in camel?如何仅将参数值添加到骆驼的端点?
【发布时间】:2020-01-10 06:37:57
【问题描述】:
<camel:from id="_from2" uri="timer://foo?repeatCount=1"/>
            <camel:to id="_to2" uri="DBSQLComponent:{{sql.testQuery}}"/>
            <log id="_log4" message="Received ${body.size()} records from the poller query"/>
            <log id="_log5" message="Message Body= ${body}"/>
            <to id="_to3" uri="log:output?showAll=true"/>
            <camel:process id="_processNewNotifications" ref="newNotifications"/>
            <setHeader headerName="CamelHttpMethod" id="setHeader4">
                <constant>GET</constant>
            </setHeader>
            <setHeader headerName="Content-Type" id="_setHeader5">
                <constant>application/json</constant>
            </setHeader>                                                                                                                                                                                                                        
            <setHeader headerName="CamelHttpQuery" id="setHeader7">
                <simple>Id=${property.POList}</simple>
            </setHeader>
            <inOut id="_createPO" uri="cxfrs:bean:purchaseOrderDetailsEndpoint+${property.POList}"/>
</camel>

我是骆驼的新手,我正在努力寻找资源来仅附加参数的值?对于当前代码,它将添加 ?Id=${property.POList} 到端点。我只希望将值 ${property.POList} 添加到其余端点。请建议最好的做法是在 Spring DSL 中只向端点添加一个值。谢谢!

【问题讨论】:

  • 你在哪里设置 ${property.POList} 的值?假设您尝试将 CXFRS 端点作为客户端调用,我是否正确?
  • 我在 中设置

标签: apache-camel spring-camel camel-http


【解决方案1】:

您正在设置一个名为“CamelHttpQuery”的特殊标头,当交换被传递到 CXFRS 组件时,它会将其内容作为 HTTP 查询添加到 CXF URL(这就是为什么您会看到 ? 符号被自动添加)。

您可以尝试使用标头“CamelHttpPath”,它应该设置资源路径。

【讨论】:

    【解决方案2】:

    您可以尝试toD 或receipientList,它允许将参数输入到 URI 中

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2012-05-04
      • 1970-01-01
      • 2011-12-05
      • 1970-01-01
      • 1970-01-01
      • 2018-01-30
      • 2017-01-09
      • 1970-01-01
      相关资源
      最近更新 更多