-
Type:
Improvement
-
Resolution: Done
-
Priority:
Minor - P4
-
None
-
Affects Version/s: None
-
Component/s: None
-
None
-
None
-
None
-
None
-
None
-
None
-
None
I have a process that takes messages from a rabbit queue and saves the data on mongo. If any error occurs the message returns to the queue. When the connection with the mongo is broken the process loops taking and returning the message to the queue. To avoid this so that the connection is broken the process stops to take messages from the queue and when the connection is established the process comes back to consume the messages from the queue. So I need to know when the connection is re-established. Actually I uses the 'reconnect' event from db.serverConfig but this is a internal object. Is it a good practice to use this internal object?
Another point, when using a replica set the driver buffer 'operations' to mongo and the process continues taken messages from queue. Is there a limit to this buffer? The queue has a lot of messages waiting to save. Are the buffered operations executed in order when the election is finished? And about pool connections? Can each connection on the pool execute a buffered operation? Can the driver guarantee that operations are executed in order?