Google Professional Cloud Developer Question 59
Select 3Google Cloud PlatformYou are designing an e-commerce application that needs to process order events such as 'Order Placed', 'Order Shipped', and 'Order Delivered'. These events are generated by different microservices and must be processed asynchronously by downstream services such as inventory management, email notifications, and analytics. Which approach ensures a scalable, loosely coupled system while maintaining the ability to retry failed message deliveries?
- A
Use Pub/Sub to publish events, and configure subscribers for the inventory management, email notifications, and analytics services.
- B
Use a direct HTTP call from the order service to each downstream service to notify about the events.
- C
Use Eventarc to route events from the order service to the appropriate downstream services based on event types.
- D
Use a shared database table where the order service inserts event records, and downstream services poll for new events.
- E
Use Apache Kafka to publish events to topics dedicated to each downstream service.
Show answer and explanation
Correct answers: A, C, E
Explanation
To design a scalable and loosely coupled asynchronous system, options like Pub/Sub, Eventarc, and Apache Kafka are suitable because they decouple the producers and consumers, support retries, and handle high-throughput event processing. Direct HTTP calls and shared database polling introduce tight coupling, latency, and scalability challenges, making them unsuitable for this scenario.
- A. Correct.
Correct: Pub/Sub is a fully managed, scalable messaging service that enables asynchronous communication between services. It ensures loose coupling, scalability, and supports retry mechanisms for failed message deliveries.
- B. Incorrect.
Incorrect: Direct HTTP calls create tight coupling between services and do not handle retries or scalability effectively, which goes against the principles of loosely coupled asynchronous systems.
- C. Correct.
Correct: Eventarc is designed for event-driven architectures and can route events to downstream services based on filters, ensuring loose coupling and scalability.
- D. Incorrect.
Incorrect: Using a shared database table for event polling introduces tight coupling and latency, and it doesn't scale well for high-frequency or large-scale events.
- E. Correct.
Correct: Apache Kafka is a distributed event streaming platform that supports asynchronous communication, scalability, and durability, making it ideal for loosely coupled systems.