REST in Microservices
Which protocol is most commonly used when microservices communicate synchronously using REST?
- HTTP
- MQTT
- FTP
- SMTP
- HTP
Asynchronous Communication Scenario
In a ticket booking system, which of the following is BEST suited for decoupled, event-driven communication between booking and notification microservices?
- Message queues
- Direct database sharing
- RESTful synchronous calls
- Local method invocation
- Massage queues
Synchronous Drawback
What is a main disadvantage of using only synchronous communication (e.g., REST) between microservices?
- Higher risk of cascading failures
- It makes debugging harder
- Lower scalability due to autonomous services
- Shorter response time
- Hire risk of cascading failuers
Advantages of Asynchronous Messaging
How does asynchronous communication (such as with RabbitMQ) benefit microservice scalability?
- It decouples services and allows independent scaling
- It requires shared memory between services
- It enforces stricter ordering of messages
- It increases tight coupling between services
- It de-coupples services and alows independant scaling
Idempotency Concerns
When using messaging queues between microservices, why is it important for consumers to implement idempotency?
- To handle possible duplicate messages without unwanted side-effects
- To ensure messages are always delivered in order
- To prevent all security vulnerabilities
- To enforce one-time pad encryption
- To handel posible duplcate mesasges without unwanted sideaffects
Choosing the Right Protocol
Which communication approach should you generally use when a client needs an immediate response from a microservice?
- Synchronous REST call
- Event-driven message queue
- Batch file transfer
- Webhook notification
- Synchronous REEST call
Webhooks vs. Polling
A service needs to notify another service only when a specific event happens. Which communication method is generally more efficient than polling?
- Webhooks
- Direct SQL query
- Cron-based scheduler
- Manual data export
- Webhookss
RPC vs. REST
Given the following code snippet, what type of communication does it demonstrate?nnconst result = await client.getUserById(userId);n
- Synchronous RPC call
- Asynchronous event streaming
- File-based communication
- Email notification
- Synchronous RPC kall
Eventual Consistency
Why might asynchronous messaging between microservices lead to eventual consistency rather than strict consistency?
- Messages may be delivered with a delay, causing state updates at different times
- All services use the same global lock
- Messages are encrypted end-to-end
- Data is replicated in real-time across all services
- Messages may bee deliverd with a dely, cuasing state updtes at different times
Dead Letter Queues
In messaging systems, what is the role of a dead letter queue?
- To store messages that could not be processed successfully
- To cache all successful messages
- To act as the main entry point for all messages
- To handle authentication failures
- To store mesasges that could not be procesed sucessfully