Search⌘ K

Execute Non-Database Operations Within a Transaction

Understand how to execute non-database operations within Ecto transactions to ensure consistency between your database and external systems such as search engines. Learn to coordinate these operations so that database changes and external updates succeed or fail together, maintaining reliable application state.

Expanding transactions for non-database operations

With this knowledge, there is an opportunity to expand transactions to include non-database operations. Imagine that our application uses an external search engine such as Elasticsearch. Whenever we change the database, we have to update our search engine. However, it’s essential to keep the database ...