无法启动路由 [A],因为不允许多个消费者使用同一端点:[E]
Failed to start route [A] because of Multiple consumers for the same endpoint is not allowed: [E]
通过 "xml-rests" 将剩余定义加载到 Camel Spring Boot 3.2 时出现此错误,其中 XML 路径在 属性 camel.springboot.xml-rest 中定义= 类路径:folder-camel/folder-rest/*.xml
我的其余定义文件如下所示
<?xml version="1.0" encoding="UTF-8"?>
<rests xmlns="http://camel.apache.org/schema/spring" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="
http://camel.apache.org/schema/spring https://camel.apache.org/schema/spring/camel-spring-3.2.0.xsd
">
<rest path="/test">
<get uri="/folderuri">
<to uri="log:test-log-rest" />
</get>
</rest>
</rests>
异常堆栈跟踪是
org.apache.camel.FailedToStartRouteException: Failed to start route route2 because of Multiple consumers for the same endpoint is not allowed: http://0.0.0.0:8080/test/nexus12345?httpMethodRestrict=GET%2COPTIONS
at org.apache.camel.impl.engine.AbstractCamelContext.doStartOrResumeRouteConsumers(AbstractCamelContext.java:3351)
at org.apache.camel.impl.engine.AbstractCamelContext.doStartRouteConsumers(AbstractCamelContext.java:3325)
at org.apache.camel.impl.engine.AbstractCamelContext.safelyStartRouteServices(AbstractCamelContext.java:3230)
at org.apache.camel.impl.engine.AbstractCamelContext.doStartOrResumeRoutes(AbstractCamelContext.java:2992)
at org.apache.camel.impl.engine.AbstractCamelContext.doStartCamel(AbstractCamelContext.java:2790)
at org.apache.camel.impl.engine.AbstractCamelContext.doStartContext(AbstractCamelContext.java:2643)
at org.apache.camel.impl.engine.AbstractCamelContext.doStart(AbstractCamelContext.java:2606)
at org.apache.camel.support.service.BaseService.start(BaseService.java:115)
at org.apache.camel.impl.engine.AbstractCamelContext.start(AbstractCamelContext.java:2448)
at org.apache.camel.spring.SpringCamelContext.start(SpringCamelContext.java:121)
at org.apache.camel.spring.CamelContextFactoryBean.start(CamelContextFactoryBean.java:373)
at org.apache.camel.spring.CamelContextFactoryBean.onApplicationEvent(CamelContextFactoryBean.java:420)
at org.apache.camel.spring.CamelContextFactoryBean.onApplicationEvent(CamelContextFactoryBean.java:94)
at org.springframework.context.event.SimpleApplicationEventMulticaster.doInvokeListener(SimpleApplicationEventMulticaster.java:172)
at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:165)
at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:139)
at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:403)
at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:360)
at org.springframework.context.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:897)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:553)
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:747)
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:397)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:315)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1226)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1215)
找到这个问题的根本原因后 CAMEL-14969,我研究了一种方法来找到一个简单的解决方法,并提出了通过用 ROUTE 标记包围它来在其余端点上指定路由 ID 的解决方案如下。
<?xml version="1.0" encoding="UTF-8"?>
<rests xmlns= . . . >
<rest id="id1" path="/test">
<get id="id2" uri="/folderuri">
<route id="id4">
<to id="id3" uri="log:test-log-rest-route" />
</route>
</get>
</rest>
</rests>
通过 "xml-rests" 将剩余定义加载到 Camel Spring Boot 3.2 时出现此错误,其中 XML 路径在 属性 camel.springboot.xml-rest 中定义= 类路径:folder-camel/folder-rest/*.xml
我的其余定义文件如下所示
<?xml version="1.0" encoding="UTF-8"?>
<rests xmlns="http://camel.apache.org/schema/spring" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="
http://camel.apache.org/schema/spring https://camel.apache.org/schema/spring/camel-spring-3.2.0.xsd
">
<rest path="/test">
<get uri="/folderuri">
<to uri="log:test-log-rest" />
</get>
</rest>
</rests>
异常堆栈跟踪是
org.apache.camel.FailedToStartRouteException: Failed to start route route2 because of Multiple consumers for the same endpoint is not allowed: http://0.0.0.0:8080/test/nexus12345?httpMethodRestrict=GET%2COPTIONS
at org.apache.camel.impl.engine.AbstractCamelContext.doStartOrResumeRouteConsumers(AbstractCamelContext.java:3351)
at org.apache.camel.impl.engine.AbstractCamelContext.doStartRouteConsumers(AbstractCamelContext.java:3325)
at org.apache.camel.impl.engine.AbstractCamelContext.safelyStartRouteServices(AbstractCamelContext.java:3230)
at org.apache.camel.impl.engine.AbstractCamelContext.doStartOrResumeRoutes(AbstractCamelContext.java:2992)
at org.apache.camel.impl.engine.AbstractCamelContext.doStartCamel(AbstractCamelContext.java:2790)
at org.apache.camel.impl.engine.AbstractCamelContext.doStartContext(AbstractCamelContext.java:2643)
at org.apache.camel.impl.engine.AbstractCamelContext.doStart(AbstractCamelContext.java:2606)
at org.apache.camel.support.service.BaseService.start(BaseService.java:115)
at org.apache.camel.impl.engine.AbstractCamelContext.start(AbstractCamelContext.java:2448)
at org.apache.camel.spring.SpringCamelContext.start(SpringCamelContext.java:121)
at org.apache.camel.spring.CamelContextFactoryBean.start(CamelContextFactoryBean.java:373)
at org.apache.camel.spring.CamelContextFactoryBean.onApplicationEvent(CamelContextFactoryBean.java:420)
at org.apache.camel.spring.CamelContextFactoryBean.onApplicationEvent(CamelContextFactoryBean.java:94)
at org.springframework.context.event.SimpleApplicationEventMulticaster.doInvokeListener(SimpleApplicationEventMulticaster.java:172)
at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:165)
at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:139)
at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:403)
at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:360)
at org.springframework.context.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:897)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:553)
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:747)
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:397)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:315)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1226)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1215)
找到这个问题的根本原因后 CAMEL-14969,我研究了一种方法来找到一个简单的解决方法,并提出了通过用 ROUTE 标记包围它来在其余端点上指定路由 ID 的解决方案如下。
<?xml version="1.0" encoding="UTF-8"?>
<rests xmlns= . . . >
<rest id="id1" path="/test">
<get id="id2" uri="/folderuri">
<route id="id4">
<to id="id3" uri="log:test-log-rest-route" />
</route>
</get>
</rest>
</rests>