我正在创建这样的路由:
<routes xmlns="http://camel.apache.org/schema/spring">
<route id="ESP_01.Handle_Movement">
<from uri="mqtt:ESP_01.Handle_Movement?host=tcp://localhost:1883&subscribeTopicName=ESP_01/Handle Movement&version=3.1&maxReadRate=0&qualityOfService=AtLeastOnce" />
<to uri="micrometer:timer:camel.proxy.mqtt.kafka.stream?action=start" />
<to uri="log://camel.proxy?groupInterval=3&level=INFO" />
<to uri="kafka://ESP_01.Handle_Movement?brokers=localhost:9092" />
<to uri="micrometer:timer:camel.proxy.mqtt.kafka.stream?action=stop" />
<to uri="micrometer:timer:camel.proxy.cache?action=start" />
<setHeader name="CamelCacheKey">
<constant>Test ESP_01.Handle_Movement</constant>
</setHeader>
<setHeader name="CamelCacheOperation">
<constant>Update</constant>
</setHeader>
<to uri="cache://Test ESP_01.Handle_Movement?maxElementsInMemory=10&eternal=true" />
<to uri="micrometer:timer:camel.proxy.cache?action=stop" />
</route>
</routes>
我有
<setHeader name="CamelCacheKey">
<constant>Test ESP_01.Handle_Movement</constant>
</setHeader>
<setHeader name="CamelCacheOperation">
<constant>Update</constant>
</setHeader>
然而,根据这个例子,我从标题中得到了一条错误消息,要求已经存在的名称参数丢失:
org.apache.camel.FailedToCreateRouteException: Failed to create route ESP_01.Handle_Movement at: >>> SetHeader[null, constant{Test ESP_01.Handle_Movement}] <<< in route: Route(ESP_01.Handle_Movement)[[From[mqtt:ESP_01.Handle_Movem... because of headerName must be specified
这可能是由于<camel.version>2.24.3<camel.version>
在Spring DSL中,经过验证的参数是name
,而在头的类中,参数名称是headerName
,设置为null。如果我尝试在Spring DSL中使用headerName
参数,我会得到以下错误:
"org.xml.sax.SAXParseException; lineNumber: 1; columnNumber: 633; cvc-complex-type.3.2.2: Attribute 'headerName' is not allowed to appear in element 'setHeader'.",