DoubleEntryLedger.CommandQueue.InstanceMonitor (double_entry_ledger v0.1.0)
View SourceMonitors the command queue for pending commands and ensures processors are started as needed.
Overview
The InstanceMonitor is a GenServer responsible for periodically scanning the database
for instances that have commands requiring processing. For each such instance,
it ensures that an InstanceProcessor is running to handle those commands.
Responsibilities
- Periodically poll the database for instances with pending, failed, or timed-out commands.
- For each instance with processable commands, ensure an
InstanceProcessoris started. - Avoid starting duplicate processors for the same instance by checking the Registry.
- Use application configuration for poll interval (
:poll_intervalin:command_queueconfig).
Configuration
The poll interval can be set in your application config:
config :double_entry_ledger, :command_queue, poll_interval: 5_000The default poll interval is 5,000 milliseconds (5 seconds) if not specified.
Process Supervision
This module is intended to be supervised as part of the command queue supervision tree.
Summary
Functions
Returns a specification to start this module under a supervisor.
Starts the InstanceMonitor GenServer.
Functions
Returns a specification to start this module under a supervisor.
See Supervisor.
Starts the InstanceMonitor GenServer.
This function is typically called by the supervisor and does not need to be called directly.