spring - Cannot query MongoDb on producer endpoint using direct component -


i have configured following route query local mongodb instance. instance running on localhost on port 27017 without authentication.

the route is:

from("direct:start")     .to("mongodb:mongobean?" +     "database=camel-source" +     "&collection=racingevents" +     "&operation=getdbstats")             .convertbodyto(string.class)     .to("file://e:/data/test.txt"); 

my mongobean defined in spring as:

<bean id="mongobean" class="com.mongodb.mongo">         <constructor-arg name="host" value="localhost" />         <constructor-arg name="port" value="27017" /> </bean> 

the route starts fine no data sent file endpoint.

if replace direct: component endpoint timer: component data written file endpoint:

from("timer://foo?delay=1&repeatcount=1")         .to("mongodb:mongobean?" +         "database=camel-source" +         "&collection=racingevents" +         "&operation=getdbstats")                 .convertbodyto(string.class)         .to("file://e:/data/test.txt"); 

the question why direct component not initiate call mongodb timer component does.

the direct component routes if send message it, direct method invocation in java, eg when call method on java instance. timer on other hand runs indpendently, , triggeres new empty message every x period.

see more details at

and bit in faq


Comments

Popular posts from this blog

c# - Better 64-bit byte array hash -

webrtc - Which ICE candidate am I using and why? -

php - Zend Framework / Skeleton-Application / Composer install issue -