Headers exchange bỏ qua routing_key và định tuyến dựa trên header attributes của message.
- Khi bind, bạn chỉ định các header matching rule như "department: sales" và "urgent: true", message chỉ được route nếu header của nó match với criteria đó.
- Linh hoạt hơn routing_key cho logic phức tạp, nhưng cũng đắt hơn — headers matching chậm hơn so khớp string.
- Trong thực tế headers exchange hiếm dùng; chỉ dùng khi logic routing thực sự không thể diễn đạt bằng routing_key pattern.
A headers exchange ignores routing keys and routes based on message header attributes.
- When binding, you specify matching rules like "department: sales" and "urgent: true" — messages only get routed if their headers match.
- More flexible than routing keys for complex logic but more expensive (header matching is slower than string comparison).
- Rarely used in practice.