Fanout Değiş Tokuşlarıyla Yayınla/Abone Ol
Fanout değiş tokuşları ve geçici kuyruklar üzerine kurulu RabbitMQ yayınla/abone ol modelini kullanarak iletileri aynı anda birçok tüketiciye yayınlamayı öğrenin.
Fanout Değiş Tokuşlarıyla Yayınla/Abone Ol, CoddyKit'te ücretsiz bir RabbitMQ Messaging & Async Systems dersidir. Bu, 4 dersinin 4. dersidir. Aşağıdan dersin tamamını ücretsiz okuyabilir, sonra tarayıcıda yerleşik kod editörü ve 7/24 yapay zeka koçu ile uygulamalı olarak pratik yapabilirsin. Bu, RabbitMQ Messaging & Async Systems öğrenme yolunun bir parçasıdır ve ilerlemeniz web ve CoddyKit uygulaması arasında senkronize olur. RabbitMQ Messaging & Async Systems kursu toplamda 4 dersten oluşur.
Bu dersin bazı bölümleri henüz çevrilmemiş olup İngilizce olarak gösterilmektedir.
Beyond a Single Consumer
Work queues deliver each message to one worker. But sometimes every interested consumer needs the same message — like broadcasting a live score to all dashboards.
This is the publish/subscribe pattern.
The Fanout Exchange
Pub/sub in RabbitMQ uses a fanout exchange, which copies every incoming message to all queues bound to it, ignoring routing keys entirely.
Declaring a Fanout Exchange
A producer declares the fanout exchange and publishes to it.
channel.exchangeDeclare('scores', 'fanout');
channel.basicPublish('scores', '', null, body);Empty Routing Key
Notice the routing key is an empty string. Fanout exchanges ignore it, so producers do not need to specify any routing logic at all.
Temporary Queues
Each subscriber usually wants a fresh, private queue. Declaring a queue with no name lets RabbitMQ generate a random one, and marking it exclusive auto-deletes it when the consumer disconnects.
String q = channel.queueDeclare().getQueue();Binding the Queue
The subscriber binds its temporary queue to the fanout exchange so it begins receiving broadcasts.
channel.queueBind(q, 'scores', '');Multiple Independent Subscribers
Because each subscriber has its own queue, they all get independent copies of every message. Adding a new subscriber does not affect the others.
Pub/Sub vs Work Queues
Key difference:
- Work queue — one queue, many workers, each message handled once
- Pub/sub — many queues, each subscriber gets every message
Common Use Cases
Fanout pub/sub fits:
- Live notifications and dashboards
- Cache invalidation across many nodes
- Broadcasting configuration changes
- Logging to multiple sinks
Messages Without Consumers
If no queue is bound to a fanout exchange when a message arrives, the message is simply discarded. Fanout does not store anything itself — queues do.
Scaling Subscribers
To scale pub/sub, just add more subscribers, each with its own temporary queue bound to the exchange. The fanout exchange handles fan-out automatically.
Quick Check
Test your pub/sub knowledge.
Recap
You learned the publish/subscribe pattern:
- Fanout exchanges broadcast to all bound queues
- The routing key is ignored
- Subscribers use temporary exclusive queues
- Each subscriber gets an independent copy of every message
This pattern is the foundation for notifications, cache invalidation, and live updates.
Sıkça Sorulan Sorular
“Fanout Değiş Tokuşlarıyla Yayınla/Abone Ol” dersi ücretsiz mi?
Evet — “Fanout Değiş Tokuşlarıyla Yayınla/Abone Ol” dersin tüm metni burada web'de ücretsiz olarak okunabilir. Etkileşimli olarak pratik yapmak (yerleşik kod editörü ve 7/24 yapay zeka koçu) ve RabbitMQ Messaging & Async Systems kursunun geri kalanını açmak için CoddyKit PRO'ya yükselt. RabbitMQ Messaging & Async Systems kursu toplamda 4 dersten oluşur.
“Fanout Değiş Tokuşlarıyla Yayınla/Abone Ol” dersinde ne öğreneceğim?
Fanout değiş tokuşları ve geçici kuyruklar üzerine kurulu RabbitMQ yayınla/abone ol modelini kullanarak iletileri aynı anda birçok tüketiciye yayınlamayı öğrenin. RabbitMQ Messaging & Async Systems ile uygulamalı kodu tarayıcıda doğrudan çalıştırarak pratik yaparsın ve 7/24 yapay zeka koçu dersi çalışırken sorularını yanıtlar.
RabbitMQ Messaging & Async Systems öğrenmeye başlamak için deneyim gerekli mi?
Önceden deneyim gerekmez. CoddyKit'te RabbitMQ Messaging & Async Systems, başlangıçtan ileri seviyeye kadar yapılandırıldığı için buradan başlayabilir veya başından başlayıp kendi hızında ilerleme yapabilirsin. Bu, 4 dersinin 4. dersidir.
“Fanout Değiş Tokuşlarıyla Yayınla/Abone Ol” dersi ne kadar sürer?
Çoğu CoddyKit dersi yaklaşık 5–10 dakika sürer. Her biri kısa ve etkileşimli olduğu için sabit ilerleme yaparsın ve web ile uygulama arasında tam olarak bıraktığın yerden devam edebilirsin.
Bu RabbitMQ Messaging & Async Systems dersinde kod yazıp çalıştırabilir miyim?
Evet. Her RabbitMQ Messaging & Async Systems dersi yerleşik bir kod editörü içerir, bu sayede tarayıcıda gerçek kod yazıp çalıştırabilir ve anlık yapay zeka geri bildirimi alırsın — yerel kurulum gerekli değildir.
Bu kursun tüm dersleri
- Merhaba Dünya: Basit Kuyruk
- İş Kuyrukları: Adil Dağıtım
- Mesaj Onayları ve Kalıcılık
- Fanout Değiş Tokuşlarıyla Yayınla/Abone Ol