CSI Message Queuing & Event-Driven Architecture 1 — Questions and Answers
Question 1: Which messaging pattern allows producers to publish messages to a topic that multiple consumers can independently subscribe to and receive?
- Point-to-point queue
- Publish/Subscribe (Correct answer)
- Request/Reply
- Dead letter routing
Correct answer: Publish/Subscribe
Publish/Subscribe (pub/sub) decouples producers from consumers by routing messages through a topic, allowing multiple independent subscribers to receive each message.
Question 2: In Apache Kafka, what is the primary role of a partition within a topic?
- To encrypt messages at rest
- To enable parallel processing and horizontal scalability (Correct answer)
- To filter duplicate messages automatically
- To convert message formats between producers and consumers
Correct answer: To enable parallel processing and horizontal scalability
Partitions divide a topic across multiple brokers, allowing consumers in a consumer group to process different partitions simultaneously, enabling horizontal scalability.
Question 3: What is the purpose of a Dead Letter Queue (DLQ) in a message queuing system?
- To store messages awaiting encryption
- To hold messages that failed processing after maximum retry attempts (Correct answer)
- To archive successfully processed messages for audit
- To stage messages before routing to multiple consumers
Correct answer: To hold messages that failed processing after maximum retry attempts
A DLQ captures messages that could not be successfully processed after exhausting retries, isolating them for inspection and preventing queue blockage.
Question 4: Which message delivery guarantee ensures that every message is delivered at least once but may result in duplicates?
- At-most-once delivery
- Exactly-once delivery
- At-least-once delivery (Correct answer)
- Best-effort delivery
Correct answer: At-least-once delivery
At-least-once delivery guarantees no message is lost by retrying on failure, but the trade-off is that consumers must handle potential duplicate messages idempotently.
Question 5: In event-driven architecture, what does the term 'event sourcing' refer to?
- Capturing events from external IoT sensors
- Storing state changes as an immutable sequence of events rather than the current state only (Correct answer)
- Routing events based on their source IP address
- Transforming events from one format to another at the broker level
Correct answer: Storing state changes as an immutable sequence of events rather than the current state only
Event sourcing persists each state change as an ordered, immutable event log, allowing system state to be reconstructed by replaying events from any point in time.
Question 6: What is the primary advantage of using an asynchronous messaging pattern over synchronous REST calls in a distributed system integration?
- Asynchronous messaging always provides faster response times
- It decouples sender and receiver, improving resilience when services are temporarily unavailable (Correct answer)
- Asynchronous systems require less security configuration
- It eliminates the need for message serialization
Correct answer: It decouples sender and receiver, improving resilience when services are temporarily unavailable
Asynchronous messaging decouples producers and consumers so that if the consumer is temporarily down, messages queue up and are processed when it recovers, increasing overall system resilience.
Question 7: Which of the following best describes a 'message broker' in an integration architecture?
- A firewall rule that filters integration traffic
- An intermediary that receives, routes, and delivers messages between applications (Correct answer)
- A protocol converter that transforms binary data to XML
- A load balancer that distributes REST API calls
Correct answer: An intermediary that receives, routes, and delivers messages between applications
A message broker is an intermediary component (e.g., RabbitMQ, ActiveMQ) that accepts messages from producers, applies routing logic, and delivers them to the appropriate consumers.
Which messaging pattern allows producers to publish messages to a topic that multiple consumers can independently subscribe to and receive?