View Source Money.ExchangeRates.Supervisor (Money v5.15.2)

Functions to manage the starting, stopping, deleting and restarting of the Exchange Rates Retriever.

Summary

Functions

Returns a specification to start this module under a supervisor.

Returns the name of the default supervisor which is Money.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.

Functions

Returns a specification to start this module under a supervisor.

See Supervisor.

Returns the name of the default supervisor which is Money.Supervisor

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)

Restarts a stopped retriever.

See also Money.ExchangeRates.Retriever.stop/0

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.

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 the ex_money supervision tree to a different supervision tree. The default is false

  • :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

Link to this function

start_retriever(config \\ ExchangeRates.config())

View Source

Starts the exchange rates retriever

Arguments

Link to this function

stop(supervisor \\ default_supervisor())

View Source

Stop the Money.ExchangeRates.Supervisor.

Unless ex_money is configured in mix.exs as rumtime: false, the Money.ExchangeRates.Supervisor is always started when 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 the exchange rates retriever.