Apache camel 通过blueprint覆盖camel http4组件中的默认属性

Apache camel 通过blueprint覆盖camel http4组件中的默认属性,apache-camel,Apache Camel,我想通过blueprint更改camel http4组件中的maxTotalConnections和connectionsPerRoute 有人能告诉我这是可能的,还是我必须把它作为URI选项发送 我是骆驼2.16.3骆驼确实让你。它还允许您使用。但是您需要将这些值放在URI中 因此,您可以使用以下内容: <blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"> <cm:property-placeho

我想通过blueprint更改camel http4组件中的
maxTotalConnections
connectionsPerRoute

有人能告诉我这是可能的,还是我必须把它作为URI选项发送

我是骆驼
2.16.3

骆驼确实让你。它还允许您使用。但是您需要将这些值放在URI中

因此,您可以使用以下内容:

<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0">
    <cm:property-placeholder persistent-id="my-placeholders" update-strategy="reload">
      <cm:default-properties>
          <cm:property name="maxTotalConnections" value="200"/>
          <cm:property name="connectionsPerRoute" value="20"/>
      </cm:default-properties>
    </cm:property-placeholder>

    <camelContext xmlns="http://camel.apache.org/schema/blueprint">
        <route>
            <from uri="timer:test" />
            <to uri="http4:localhost:80/resource?maxTotalConnections={{maxTotalConnections}}&amp;connectionsPerRoute={{connectionsPerRoute}}" />
        </route>
    </camelContext>

</blueprint>
设置第一条路由后,将设置clientConnectionManager。对于第一个路由之后设置的任何其他路由,由于clientConnectionManager绑定到Http4组件的单个实例,看起来这些选项被忽略了。我会在所有路线上使用相同的组件选项

您可以通过创建新的bean并给它们一个id来实例化新的HTTP4组件。您可以使用这个来创建具有不同组件选项的多个HTTP4组件

<bean id="http4-foo" class="org.apache.camel.component.http4.HttpComponent"/>
<bean id="http4-bar" class="org.apache.camel.component.http4.HttpComponent"/>

然后在设置端点时使用这些ID

<to uri="http4-foo:localhost:80/resource?maxTotalConnections=300"/>


什么是每个主机的连接?我在文件里没找到。你是说
maxTotalConnections
?哦,是的,那只是个错误。已修复。如果我的驼峰中有多条路由,我是否必须像您在回答中所示的那样为每条路由
maxTotalConnections
?如果是,那么如果我在一条路由中以
maxTotalConnection
的形式给出
x
,在一条路由中以
maxTotalConnections
的形式给出
y
,驼峰http路由将如何运行?我已经更新了答案。它将使用所创建的第一条路由的
maxTotalConnection
。您能否给出答案最后一部分的示例?创建
bean
后,如何在端点中使用
beanId
<to uri="http4-foo:localhost:80/resource?maxTotalConnections=300"/>