Media at Scale: Callbacks vs pipelines - Shopify
Jul 9, 2020

Summary
This post details the architectural decision-making process for integrating new media types (videos, 3D models) into Shopify's product media system. It contrasts the use of Rails Active Record callbacks with a pipeline approach. The pipeline approach, involving separate classes for specific operations (before_transaction, during_transaction, after_transaction) and a cascading handler structure, was chosen over callbacks due to better control, maintainability, debugging, and separation of concerns in a complex, evolving system. The pipeline provides a single entry point, hides implementation details, and ensures transactional integrity for media creation.