Mongo.Monitor (mongodb-driver v1.4.0) View Source

Each server has a monitor process. The monitor process is created by the topology process.

If the network connection is working, then the monitor process reports this and the topology process starts the connection pool. Per server we get 1 + pool size connections to each server.

After waiting for heartbeat_frequency_ms milliseconds, the monitor process calls hello command and reports the result to the topology process.

The result of the hello command is mapped the ServerDescription structure and sent to the topology process, which updates it internal data structure.

see https://github.com/mongodb/specifications/blob/master/source/server-discovery-and-monitoring/server-discovery-and-monitoring.rst#monitoring

Link to this section Summary

Functions

Returns a specification to start this module under a supervisor.

Report the connection event, so the topology process can now create the connection pool.

Try to update the server description.

Initialize the monitor process

Returns the possible modes of the monitor process.

In case of terminating we stop the our linked processes as well

Link to this section Functions

Returns a specification to start this module under a supervisor.

See Supervisor.

Link to this function

connected(connection, me, topology_pid)

View Source

Report the connection event, so the topology process can now create the connection pool.

Try to update the server description.

Initialize the monitor process

Returns the possible modes of the monitor process.

Link to this function

set_heartbeat_frequency_ms(pid, heartbeat_frequency_ms)

View Source

In case of terminating we stop the our linked processes as well:

  • connection
  • streaming process