• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Callback when Document is Stored in Mongo

 
Ranch Hand
Posts: 162
1
Android Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am using JAVA to talk to MONGO DB,

I am interested in getting the callback from MongoDB when a Document is stored successfully on the Mongo.

I want to get this callback so that I can broadcast the success message to the Listeners.

 
Bartender
Posts: 2407
36
Scala Python Oracle Postgres Database Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It sounds like you need to look at Write Concern in MongoDB. This is basically a setting that decides when/if MongoDB confirms that a document has been written successfully or how it reports any errors. MongoDB is designed to support robust horizontal scaling across multiple machines via sharding and replication, and data gets written first to memory, then to the actual database and replicas. There are different levels of write concern depending on how much of a guarantee you want that your data has definitely been written to the database and replicated across all servers, so you would choose the write concern that suits your application's requirements. The default is Acknowledged.

One common practice on a replicated cluster is to write to one machine (the master) but read from several replicated workers, so it may take a few moments before your workers receive the latest update from the master, for example. A very strict write concern may influence application performance on a replicated cluster, because your application may have to wait for all replicated nodes to respond before it can continue after the write operation. This might be a reason to explore asynchronous processing, for example.
 
reply
    Bookmark Topic Watch Topic
  • New Topic