spring - Java: Async MongoTemplate / MongoOperation -


is there way insert asynchronously mongodb?

i know mongodb quick in cases, thought maybe can save milliseconds returning command given.

it use cases connect server send mongodb command insert something. want return client once command issued , not wait response mongodb.

i read documentation: http://docs.spring.io/spring-data/mongodb/docs/current/reference/html/

it seems read asynchronously, not insert asychronously.

the spring data mongodb documentation shows example of using @async annotation on query methods, possible use on every method.

quoting documentation:

repository queries can executed asynchronously using spring’s asynchronous method execution capability. means method return upon invocation , actual query execution occur in task has been submitted spring taskexecutor.

asynchronous invocation of methods not spring data concern spring core concern can refer spring framework documentation.

simply said, need add @async annotation on method want , configure proper task executor in spring configuration. sample xml configuration be:

<task:annotation-driven executor="myexecutor" /> <task:executor id="myexecutor" pool-size="5"/> 

Comments

Popular posts from this blog

javascript - Slick Slider width recalculation -

jsf - PrimeFaces Datatable - What is f:facet actually doing? -

angular2 services - Angular 2 RC 4 Http post not firing -