You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by gmh <go...@gmail.com> on 2014/11/14 20:29:24 UTC

question about database querying design pattern

Hi all,
I have a requirement where we would leverage redis as cache and Mongodb as
our backend.
So we would first do a query against redis cache, if no result can be found
we would then query against Mongodb for data. Assuming redis and Mongodb
components are working, what type of integration pattern can I use for this?
And how would I implement it?
Thanks, Gordon



--
View this message in context: http://camel.465427.n5.nabble.com/question-about-database-querying-design-pattern-tp5759159.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: question about database querying design pattern

Posted by boday <be...@initekconsulting.com>.
there isn't a "reach through cache" design pattern implementation...that
said, given that both redis/mongdb components support producing/consuming,
this shouldn't be difficult to use along with some simple conditional logic
implemented via a filter or content based router...

here is a pseudo route using a filter...

from("direct:getDataFromRedisOrMongoDB")
    .to("spring-redis...<query>")
    .filter(<no data found>)
         .to("mongodb...<query>")
         .to("spring-redis...<add to cache>")
        .end()
    .to(<process/deliver data>);
    


gmh wrote
> Hi all,
> I have a requirement where we would leverage redis as cache and Mongodb as
> our backend.
> So we would first do a query against redis cache, if no result can be
> found we would then query against Mongodb for data. Assuming redis and
> Mongodb components are working, what type of integration pattern can I use
> for this? And how would I implement it?
> Thanks, Gordon





-----
Ben O'Day
IT Consultant -http://consulting-notes.com

--
View this message in context: http://camel.465427.n5.nabble.com/question-about-database-querying-design-pattern-tp5759159p5759172.html
Sent from the Camel - Users mailing list archive at Nabble.com.