Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Slide DevCoach
Search
shabilla
April 11, 2024
0
10
Slide DevCoach
DevCoach 129 : Back-End | Membangun aplikasi modern dengan Message Queue
shabilla
April 11, 2024
Tweet
Share
More Decks by shabilla
See All by shabilla
Slide DevCoach #151
shabillarestu
0
44
Slide DevCoach
shabillarestu
0
42
Slide DevCoach
shabillarestu
0
25
Slide DevCoach
shabillarestu
0
24
Slide DevCoach
shabillarestu
0
19
Slide DevCoach
shabillarestu
0
13
Slide DevCoach
shabillarestu
0
22
Slide DevCoach
shabillarestu
0
19
Slide DevCoach
shabillarestu
0
22
Featured
See All Featured
The Myth of the Modular Monolith - Day 2 Keynote - Rails World 2024
eileencodes
22
2.6k
BBQ
matthewcrist
88
9.5k
GitHub's CSS Performance
jonrohan
1030
460k
Bash Introduction
62gerente
611
210k
Documentation Writing (for coders)
carmenintech
69
4.7k
Being A Developer After 40
akosma
90
590k
Why Our Code Smells
bkeepers
PRO
336
57k
実際に使うSQLの書き方 徹底解説 / pgcon21j-tutorial
soudai
177
52k
Music & Morning Musume
bryan
46
6.4k
Agile that works and the tools we love
rasmusluckow
328
21k
A Philosophy of Restraint
colly
203
16k
Fireside Chat
paigeccino
37
3.3k
Transcript
None
None
“Everything fails, all the time”. - Werner Vogels, CTO and
Vice President Amazon. Back-End
Agenda • Mengenal message queue • Mengenal RabbitMQ • Implementasi
message queue pada REST API Back-End
Back-End Message Queue
What is Message Queue? Message queue adalah bentuk komunikasi asynchronous
antar layanan (services) yang biasanya digunakan pada arsitektur microservices. Back-End
Back-End Apa contoh penerapannya di kehidupan sehari-hari?? 🤔
Why Message Queue? • Memisahkan (decoupling). • Keandalan (Reliability). •
Skalabilitas (Scalability). Back-End
Message Queue Use Case • Ecommerce: order process, shipping, invoice,
dll. • Financial services: transaction processing. • Analytics: user log. Back-End
When to Use Message Queue? • Pengguna Sudah Ribuan •
Asynchronous Proses • Microservices Arsitektur • Analytics Back-End
Back-End Message Queue Type
Point-to-point Point-to-point messaging adalah pola distribusi yang digunakan dalam message
queue. Point-to-point messaging memiliki hubungan one-to-one antara pengirim dan penerima pesan (disebut juga sebagai producer dan consumer). Back-End
Publish/subscribe Publish/subscribe adalah pola message queue yang memungkinkan pesan untuk
di-broadcast ke berbagai bagian sistem secara asinkron. Pesan apa pun yang di-publish ke suatu topic akan segera diterima oleh semua yang subscribe ke topik tersebut. Back-End
Message Queue Component Producer Queue Consumer
Back-End Rabbit MQ
RabbitMQ Back-End RabbitMQ adalah salah satu message broker open-source yang
populer digunakan. RabbitMQ dapat mendukung banyak protokol seperti AMQP, STOMP, MQTT, HTTP, dan WebSocket.
Install RabbitMQ Back-End docker pull rabbitmq:management docker run --name rabbitmq
-p 5672:5672 -p 15672:15672 -d rabbitmq:management
Back-End Demo RabbitMQ di REST API https://github.com/arasopraza/Demo-Developer-Coaching-129.git
Menghubungkan RabbitMQ const connection = await amqp.connect(process.env.RABBITMQ_SERVER); const channel =
await connection.createChannel(); await channel.assertQueue(queue, { durable: true, }); await channel.sendToQueue(queue, Buffer.from(message));
Menghubungkan Consumer ke RabbitMQ const connection = await amqp.connect(process.env.RABBITMQ_SERVER); const
channel = await connection.createChannel(); await channel.assertQueue('order:confirm', { durable: true, }); channel.consume('order:confirm', listener.listen, { noAck: true });
Feedback! Hadiah: • 2 Token Langganan Academy (30 Hari) *untuk
pengisi feedback terpilih! dicoding.id/devcoachfeedback
Thank You arasopraza
[email protected]
arasopraza Back-End arsyopraza