2017-01-24 1 views
1

우리는 간단한 테스트 번들을 만들었지 만 MongoDB를 Camel 경로 중 하나에서 사용하자 마자 경로가 더 이상 시작되지 않습니다. MongoDB는 Karaf 4.0.8에서 Camel 2.18.1과 작동하지 않습니다.

청사진

아주 간단하여 MongoDB는 POM의 종속성으로 첨가

<?xml version="1.0" encoding="UTF-8"?> 
<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0" 
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:cm="http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.1.0" 
    xsi:schemaLocation=" 
     http://www.osgi.org/xmlns/blueprint/v1.0.0 https://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd 
     http://camel.apache.org/schema/blueprint http://camel.apache.org/schema/blueprint/camel-blueprint.xsd 
     http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.1.0 http://aries.apache.org/schemas/blueprint-cm/blueprint-cm-1.1.0.xsd"> 

    <bean id="mongo" class="com.mongodb.Mongo"> 
     <argument value="localhost"/> 
    </bean> 

    <camelContext id="blueprint-bean-context" 
     xmlns="http://camel.apache.org/schema/blueprint"> 

     <route id="testTimer"> 
      <from uri="timer:testTimer?period=5000" /> 

      <setBody> 
       <spel>{"type": "product"}</spel> 
      </setBody> 
      <to uri="mongodb:mongo?database=testdb&amp;collection=mycollection&amp;operation=findAll" /> 
      <log message="Result was queried" /> 

     </route> 
    </camelContext> 

</blueprint> 

. DEBUG 모드의 로그 발췌 부분은 다음과 같습니다.

2017-01-24 13:41:27,672 | DEBUG | raf-4.0.8/deploy | ReferenceRecipe     | 12 - org.apache.aries.blueprint.core - 1.7.1 | Binding reference .camelBlueprint.languageResolver.spel to [org.apache.camel.spi.LanguageResolver] 
2017-01-24 13:41:27,672 | DEBUG | raf-4.0.8/deploy | BlueprintLanguageResolver  | 55 - org.apache.camel.camel-blueprint - 2.18.1 | Found language resolver: spel in registry: [email protected]375f 
2017-01-24 13:41:27,673 | DEBUG | raf-4.0.8/deploy | DefaultChannel     | 58 - org.apache.camel.camel-core - 2.18.1 | Initialize channel for target: 'SetBody[spel{SpelExpression[{"type": "product"}]}]' 
2017-01-24 13:41:27,673 | DEBUG | raf-4.0.8/deploy | BlueprintContainerImpl   | 12 - org.apache.aries.blueprint.core - 1.7.1 | Instantiating component blueprintBundle 
2017-01-24 13:41:27,676 | DEBUG | raf-4.0.8/deploy | DefaultManagementAgent   | 58 - org.apache.camel.camel-core - 2.18.1 | Registered MBean with ObjectName: org.apache.camel:context=de.test.bundle-x1-blueprint-bean-context,type=tracer,name=BacklogTracer 
2017-01-24 13:41:27,676 | DEBUG | raf-4.0.8/deploy | BlueprintContainerImpl   | 12 - org.apache.aries.blueprint.core - 1.7.1 | Instantiating component blueprintBundle 
2017-01-24 13:41:27,680 | DEBUG | raf-4.0.8/deploy | DefaultManagementAgent   | 58 - org.apache.camel.camel-core - 2.18.1 | Registered MBean with ObjectName: org.apache.camel:context=de.test.bundle-x1-blueprint-bean-context,type=tracer,name=BacklogDebugger 
2017-01-24 13:41:27,683 | DEBUG | raf-4.0.8/deploy | DefaultManagementAgent   | 58 - org.apache.camel.camel-core - 2.18.1 | Registered MBean with ObjectName: org.apache.camel:context=de.test.bundle-x1-blueprint-bean-context,type=errorhandlers,name="DefaultErrorHandlerBuilder(ref:CamelDefaultErrorHandlerBuilder)" 
2017-01-24 13:41:27,686 | DEBUG | raf-4.0.8/deploy | DefaultComponent     | 58 - org.apache.camel.camel-core - 2.18.1 | Creating endpoint uri=[mongodb://mongo?collection=processing_requests&database=genex&operation=findAll], path=[mongo] 
2017-01-24 13:41:27,686 | DEBUG | raf-4.0.8/deploy | BlueprintContainerImpl   | 12 - org.apache.aries.blueprint.core - 1.7.1 | Instantiating component mongo 
2017-01-24 13:41:27,687 | INFO | raf-4.0.8/deploy | BlueprintCamelContext   | 58 - org.apache.camel.camel-core - 2.18.1 | Apache Camel 2.18.1 (CamelContext: blueprint-bean-context) is shutting down 
2017-01-24 13:41:27,687 | DEBUG | raf-4.0.8/deploy | efaultAsyncProcessorAwaitManager | 58 - org.apache.camel.camel-core - 2.18.1 | Shutting down with no inflight threads. 
2017-01-24 13:41:27,688 | DEBUG | raf-4.0.8/deploy | TimerListenerManager    | 58 - org.apache.camel.camel-core - 2.18.1 | Removed TimerListener: [email protected] 
2017-01-24 13:41:27,688 | DEBUG | raf-4.0.8/deploy | DefaultManagementAgent   | 58 - org.apache.camel.camel-core - 2.18.1 | Unregistered MBean with ObjectName: org.apache.camel:context=de.test.bundle-x1-blueprint-bean-context,type=context,name="blueprint-bean-context" 
2017-01-24 13:41:27,688 | DEBUG | raf-4.0.8/deploy | DefaultInflightRepository  | 58 - org.apache.camel.camel-core - 2.18.1 | Shutting down with no inflight exchanges. 

왜 Camel 컨텍스트가 즉시 시작되고 종료됩니까? 타이머가 실행되지 않고 로그 메시지가 인쇄되지 않습니다. MongoDB를 호출하기 위해 to을 제거하자 마자 작동합니다.

답변

1
는 낙타의 몽고 구성 요소의 official documentation에 대한 자세한 내용을보실 수 있습니다

<bean id="mongo" class="com.mongodb.MongoClient"> 

에 빈 선언

<bean id="mongo" class="com.mongodb.Mongo"> 

을 변경

.

관련 문제