You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by rich_g <ri...@citi.com> on 2012/07/31 18:05:57 UTC

Using MongoDB queries with Timer

Hi all
I want to make a timer that polls a Mongo collection to get data with an id
> variable set at runtime.

I am able to get a timer working using but don't know how to set a query
filter

from("timer://myTimer?period=30000")
      
.to("mongodb:myDb?database=test&collection=test&operation=findAll&dynamicity=true")
       .to("stream:out");
but don't know


And using the unit tests for camel-mongo I am able to query using the code
below to get the filtered set.

DBObject query =
BasicDBObjectBuilder.start().push("_id").add("$gte",12).get();
Object result = template.requestBody("direct:findAll", query);

....

  from("direct:findAll")
                    .to("mongodb:myDb?database
test&collection=test&operation=findAll&dynamicity=true")
                    .to("mock:resultFindAll");


Can anyone give me some advice on how to combine the 2?

Thanks

Rich




--
View this message in context: http://activemq.2283324.n4.nabble.com/Using-MongoDB-queries-with-Timer-tp4654613.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Re: Using MongoDB queries with Timer

Posted by Torsten Mielke <to...@fusesource.com>.
Hi Rich,

You may want to raise your question on the Camel user mailing list. 
http://camel.apache.org/discussion-forums.html


Regards,

Torsten Mielke
torsten@fusesource.com
tmielke@blogspot.com


On Jul 31, 2012, at 6:05 PM, rich_g wrote:

> Hi all
> I want to make a timer that polls a Mongo collection to get data with an id
>> variable set at runtime.
> 
> I am able to get a timer working using but don't know how to set a query
> filter
> 
> from("timer://myTimer?period=30000")
> 
> .to("mongodb:myDb?database=test&collection=test&operation=findAll&dynamicity=true")
>       .to("stream:out");
> but don't know
> 
> 
> And using the unit tests for camel-mongo I am able to query using the code
> below to get the filtered set.
> 
> DBObject query =
> BasicDBObjectBuilder.start().push("_id").add("$gte",12).get();
> Object result = template.requestBody("direct:findAll", query);
> 
> ....
> 
>  from("direct:findAll")
>                    .to("mongodb:myDb?database
> test&collection=test&operation=findAll&dynamicity=true")
>                    .to("mock:resultFindAll");
> 
> 
> Can anyone give me some advice on how to combine the 2?
> 
> Thanks
> 
> Rich
> 
> 
> 
> 
> --
> View this message in context: http://activemq.2283324.n4.nabble.com/Using-MongoDB-queries-with-Timer-tp4654613.html
> Sent from the ActiveMQ - User mailing list archive at Nabble.com.