Money v3.2.1 Money.ExchangeRates.Supervisor View Source
Functions to manage the starting, stopping, deleting and restarting of the Exchange Rates Retriever.
Link to this section Summary
Functions
Returns a specification to start this module under a supervisor
Deleted the retriever child specification from the exchange rates supervisor
Restarts a stopped retriever
Returns a boolean indicating of the retriever process is configured and running
Returns the status of the exchange rates retriever. The returned value is one of
Starts the Exchange Rates supervisor and optionally starts the exchange rates retrieval service as well
Starts the exchange rates retriever
Stop the Money.ExchangeRates.Supervisor
Stop the exchange rates retriever
Link to this section Functions
child_spec(arg) View Source
Returns a specification to start this module under a supervisor.
See Supervisor
.
delete_retriever() View Source
Deleted the retriever child specification from the exchange rates supervisor.
This is primarily of use if you want to change the configuration of the retriever after it is stopped and before it is restarted.
In this situation the sequence of calls would be:
iex> Money.ExchangeRates.Retriever.stop
iex> Money.ExchangeRates.Retriever.delete
iex> Money.ExchangeRates.Retriever.start(config)
restart_retriever() View Source
Restarts a stopped retriever.
See also Money.ExchangeRates.Retriever.stop/0
retriever_running?() View Source
Returns a boolean indicating of the retriever process is configured and running
retriever_status() View Source
Returns the status of the exchange rates retriever. The returned value is one of:
:running
if the service is running. In this state the valid action isMoney.ExchangeRates.Service.stop/0
:stopped
if it is stopped. In this state the valid actions areMoney.ExchangeRates.Supervisor.restart_retriever/0
orMoney.ExchangeRates.Supervisor.delete_retriever/0
:not_started
if it is not configured in the supervisor and is not running. In this state the only valid action isMoney.ExchangeRates.Supervisor.start_retriever/1
start_link() View Source
Starts the Exchange Rates supervisor and optionally starts the exchange rates retrieval service as well.
Options
:restart
is a boolean value indicating if the supervisor is to be restarted. This is typically used to move the supervisor from its default position under theex_money
supervision tree to a different supervision tree. The default isfalse
:start_retriever
is a boolean indicating if the exchange rates retriever is to be started when the supervisor is started. The default is defined by the configuration key:auto_start_exchange_rate_service
start_link(options) View Source
start_retriever(config \\ ExchangeRates.config()) View Source
Starts the exchange rates retriever
Arguments
config
is a%Money.ExchangeRages.Config{}
struct returned byMoney.ExchangeRates.config/0
and adjusted as required. The default isMoney.ExchangeRates.config/0
stop() View Source
Stop the Money.ExchangeRates.Supervisor.
The Money.ExchangeRates.Supervisor is always started
with ex_money
starts even if the config key
:auto_start_exchange_rates_service
is set to false
.
In some instances an application may require the
Money.ExchangeRates.Supervisor
to be started under
a different supervision tree. In this case it is
required to call this function first before a new
configuration is started.
One use case is when the Exchange Rates service is configured with either an API module, a Callback module or a Cache module which uses Ecto and therefore its a requirement that Ecto is started first.
See the README section on "Using Ecto or other applications from within the callback module" for an eanple of how to configure the supervisor in this case.
stop_retriever() View Source
Stop the exchange rates retriever.