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

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

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 our linked processes as well

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
Link to this function

stop_streaming_mode(pid)

View Source

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

  • connection
  • streaming process