0
我有一個使用駱駝來設置從隊列中消耗的路由的spring應用程序。 我使用rabbitmq作爲消息代理。 現在的問題是,如果rabbitmq代理跌落連接不自動恢復。 我試過啓用automaticRecoveryEnabled。但我得到noSuchMethodError。 我將顯示用於創建連接的代碼。春季處理關機信號
<camelContext xmlns="http://camel.apache.org/schema/spring">
<propertyPlaceholder id="properties" location="file:data/rabbitmq/rabbitmq.properties"/>
<route>
<from uri="rabbitmq://{{mete.rabbitmq.host}}:{{mete.rabbitmq.port}}/{{mete.rabbitmq.exchange}}
?queue={{mete.rabbitmq.queue}}&username={{mete.rabbitmq.username}}
&password={{mete.rabbitmq.password}}&exchangeType={{mee.rabbitmq.exchange.type}}
&queueArgsConfigurer=#myArgs&autoDelete=false&automaticRecoveryEnabled=true&networkRecoveryInterval=654&requestedHeartbeat=987"/>
<to uri="stream:out"/>
<process ref="myProcessor"/>
</route>
</camelContext>
下面是堆棧跟蹤失敗的原因是AMQP的客戶依賴
Exception in thread "main" java.lang.NoSuchMethodError: com.rabbitmq.client.ConnectionFactory.setAutomaticRecoveryEnabled(Z)V
at org.apache.camel.component.rabbitmq.RabbitMQEndpoint.getOrCreateConnectionFactory(RabbitMQEndpoint.java:278)
at org.apache.camel.component.rabbitmq.RabbitMQEndpoint.connect(RabbitMQEndpoint.java:195)
at org.apache.camel.component.rabbitmq.RabbitMQConsumer.openConnection(RabbitMQConsumer.java:68)
at org.apache.camel.component.rabbitmq.RabbitMQConsumer.doStart(RabbitMQConsumer.java:118)
at org.apache.camel.support.ServiceSupport.start(ServiceSupport.java:61)
at org.apache.camel.impl.DefaultCamelContext.startService(DefaultCamelContext.java:2869)
at org.apache.camel.impl.DefaultCamelContext.doStartOrResumeRouteConsumers(DefaultCamelContext.java:3163)
at org.apache.camel.impl.DefaultCamelContext.doStartRouteConsumers(DefaultCamelContext.java:3099)
at org.apache.camel.impl.DefaultCamelContext.safelyStartRouteServices(DefaultCamelContext.java:3029)
at org.apache.camel.impl.DefaultCamelContext.doStartOrResumeRoutes(DefaultCamelContext.java:2797)
at org.apache.camel.impl.DefaultCamelContext.doStartCamel(DefaultCamelContext.java:2653)
at org.apache.camel.impl.DefaultCamelContext.access$000(DefaultCamelContext.java:167)
at org.apache.camel.impl.DefaultCamelContext$2.call(DefaultCamelContext.java:2467)
at org.apache.camel.impl.DefaultCamelContext$2.call(DefaultCamelContext.java:2463)
at org.apache.camel.impl.DefaultCamelContext.doWithDefinedClassLoader(DefaultCamelContext.java:2486)
at org.apache.camel.impl.DefaultCamelContext.doStart(DefaultCamelContext.java:2463)
at org.apache.camel.support.ServiceSupport.start(ServiceSupport.java:61)
at org.apache.camel.impl.DefaultCamelContext.start(DefaultCamelContext.java:2432)
at org.apache.camel.spring.SpringCamelContext.maybeStart(SpringCamelContext.java:255)
at org.apache.camel.spring.SpringCamelContext.onApplicationEvent(SpringCamelContext.java:121)
at org.apache.camel.spring.CamelContextFactoryBean.onApplicationEvent(CamelContextFactoryBean.java:332)
at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:97)
at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:303)
at org.springframework.context.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:911)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:428)
at org.springframework.context.support.FileSystemXmlApplicationContext.<init>(FileSystemXmlApplicationContext.java:140)
at org.springframework.context.support.FileSystemXmlApplicationContext.<init>(FileSystemXmlApplicationContext.java:84)
at rabbitmqClient.AbstractConsumer.openAMQPConnection(AbstractConsumer.java:77)
at rabbitmqClient.ConsumerPoolExecutor.startConsumer(ConsumerPoolExecutor.java:122)
at medagate.MedagateContext.main(MedagateContext.java:15)
您能通過'關機signal' –
我編輯的問題理解的錯誤解釋越多,你的意思。 – NitKrish
你使用的是什麼版本的駱駝?你可以粘貼你得到的stacktrace錯誤。 –