0
0
GCPcloud~30 mins

Message ordering in GCP - Mini Project: Build & Apply

Choose your learning style9 modes available
Message Ordering with Google Cloud Pub/Sub
📖 Scenario: You are building a messaging system where the order of messages is important. For example, a bank transaction system where deposits and withdrawals must be processed in the exact order they occur.
🎯 Goal: Set up a Google Cloud Pub/Sub topic and subscription that ensures messages are delivered in the order they were published.
📋 What You'll Learn
Create a Pub/Sub topic with message ordering enabled
Create a subscription to the topic with message ordering enabled
Publish messages with ordering keys
Ensure the subscription receives messages in the correct order
💡 Why This Matters
🌍 Real World
Message ordering is critical in systems like banking, inventory management, and event processing where the sequence of events affects the system state.
💼 Career
Understanding message ordering in Pub/Sub is essential for cloud engineers and developers building reliable, event-driven applications on Google Cloud.
Progress0 / 4 steps
1
Create a Pub/Sub topic with message ordering enabled
Create a Pub/Sub topic named bank-transactions with message ordering enabled by setting messageOrdering to true in the topic configuration.
GCP
Need a hint?

Use the gcloud pubsub topics create command with the --message-ordering flag.

2
Create a subscription with message ordering enabled
Create a subscription named bank-transactions-sub to the bank-transactions topic with message ordering enabled by setting --enable-message-ordering flag.
GCP
Need a hint?

Use the gcloud pubsub subscriptions create command with the --enable-message-ordering flag.

3
Publish messages with ordering keys
Publish two messages to the bank-transactions topic with the ordering key account-123. Use the --ordering-key=account-123 flag for both messages.
GCP
Need a hint?

Use the gcloud pubsub topics publish command with the --ordering-key flag for each message.

4
Configure subscription to acknowledge messages in order
Ensure the subscription bank-transactions-sub is configured to acknowledge messages in order by setting --enable-message-ordering and verify the subscription is ready to process ordered messages.
GCP
Need a hint?

Use gcloud pubsub subscriptions describe bank-transactions-sub to verify the subscription settings.