

















































































Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
A practice exam for rabbitmq asynchronous messaging with java and spring. It includes 28 questions with detailed explanations, covering topics such as amqp, message properties, exchanges, queues, and spring amqp integration. This exam is designed to test and reinforce understanding of rabbitmq concepts and their application in java and spring environments, making it a valuable resource for certification preparation and skill enhancement. The questions cover a range of topics, including message routing, queue management, and spring amqp configurations. The explanations offer insights into the correct answers and the underlying principles, aiding in a deeper understanding of rabbitmq and asynchronous messaging.
Typology: Exams
1 / 89
This page cannot be seen from the preview
Don't miss anything!


















































































Question 1. Which communication pattern is inherently synchronous? A) REST over HTTP B) AMQP publishing C) Kafka consumer groups D) WebSocket push notifications Answer: A Explanation: REST over HTTP follows a request‑response model where the client waits for the server’s reply, making it synchronous. Question 2. In asynchronous messaging, which benefit primarily improves system resilience? A) Lower latency B) Tight coupling of services C) Buffering of load spikes D) Immediate error propagation Answer: C Explanation: Buffering allows messages to be stored during spikes, preventing overload and enhancing resilience. Question 3. What does AMQP stand for? A) Asynchronous Message Queue Protocol B) Advanced Message Queuing Protocol C) Automated Messaging Query Procedure D) Applied Messaging Quality Platform Answer: B
Explanation: AMQP is the Advanced Message Queuing Protocol, a standardized wire‑level protocol for messaging. Question 4. Which part of an AMQP message carries user‑defined metadata such as content type? A) Header B) Payload C) Property D) Envelope Answer: C Explanation: Properties contain metadata like content type, delivery mode, and correlation ID. Question 5. Which broker is optimized for high‑throughput log aggregation rather than traditional queueing? A) RabbitMQ B) ActiveMQ C) Kafka D) HornetQ Answer: C Explanation: Kafka is designed for append‑only logs and high‑throughput streaming, differing from classic queue brokers. Question 6. In RabbitMQ, which component is responsible for persisting messages to disk when durability is required? A) Exchange B) Queue C) Binding
B) Exact string equality C) Regular‑expression match D) Wildcard pattern match Answer: B Explanation: Direct exchanges require an exact match between the binding key and the routing key. Question 10. Which wildcard character in a topic exchange matches zero or more words? A) * B)? C) # D) % Answer: C Explanation: The “#” wildcard matches zero or more words (segments) in a routing key. Question 11. In a topic exchange, the routing key “order.payment.completed” matches which binding pattern? A) order..completed B) .payment. C) order.# D) All of the above Answer: D Explanation: All three patterns satisfy the routing key: “” matches a single word, “#” matches any remainder.
Question 12. Which header exchange matching rule requires all specified headers to be present with matching values? A) any B) all C) exact D) none Answer: B Explanation: Setting x-match = "all" forces the message to contain every listed header with the exact value. Question 13. When a queue is declared as exclusive, who can access it? A) Any connection on the broker B) Only the declaring connection C) Only connections from the same virtual host D) Only administrative users Answer: B Explanation: Exclusive queues are limited to the connection that created them and are deleted when that connection closes. Question 14. What happens to a non‑durable queue when the RabbitMQ broker restarts? A) It is recreated automatically B) It persists with its messages C) It is lost along with its messages D) It becomes durable automatically Answer: C
Answer: D Explanation: Successful acknowledgment removes the message from the queue; it is not dead‑lettered. Question 18. How can you configure a per‑message TTL in RabbitMQ? A) Set the x-message-ttl argument on the queue B) Add the expiration property to the message C) Define x-queue-ttl on the exchange D) Use a delayed exchange plugin Answer: B Explanation: The expiration property (in milliseconds) on a message defines its individual TTL. Question 19. Which queue argument sets a TTL that applies to all messages in the queue? A) x-message-ttl B) x-expires C) x-queue-ttl D) x-dead-letter-ttl Answer: A Explanation: x-message-ttl on a queue defines a default TTL for every message that enters the queue. Question 20. In a RabbitMQ cluster, what is a “quorum queue”? A) A queue replicated to all nodes in the cluster B) A queue that uses the Raft consensus algorithm for durability C) A classic queue with mirrored copies
D) A temporary queue that disappears after use Answer: B Explanation: Quorum queues are backed by the Raft algorithm, providing strong consistency and fault tolerance. Question 21. Which management plugin feature allows you to view real‑time message rates? A) Shovel UI B) Federation UI C) Overview tab in the Management Console D) Policy editor Answer: C Explanation: The Overview tab displays publish/consume rates, connections, and node health in real time. Question 22. What does the auto-delete flag on a queue mean? A) The queue is deleted when the broker restarts B) The queue is removed when the last consumer unsubscribes C) The queue is deleted after a fixed time interval D) The queue is automatically recreated on demand Answer: B Explanation: auto-delete causes the queue to be deleted once there are no more consumers attached. Question 23. Which Spring Boot starter dependency provides RabbitMQ integration? A) spring-boot-starter-data-jpa
Question 26. How does Spring AMQP determine the default exchange when none is specified? A) Direct exchange named “default” B) The built‑in default exchange (“”) C) Fanout exchange named “default” D) It throws an IllegalArgumentException Answer: B Explanation: The empty string (“”) denotes the built‑in direct default exchange that routes by routing key to a queue of the same name. Question 27. Which MessageConverter implementation converts objects to JSON using Jackson? A) SimpleMessageConverter B) Jackson2JsonMessageConverter C) SerializingMessageConverter D) AvroMessageConverter Answer: B Explanation: Jackson2JsonMessageConverter leverages the Jackson library to map objects to/from JSON. Question 28. When using @RabbitListener, which attribute controls the number of concurrent consumer threads? A) concurrency B) prefetch C) maxConcurrentConsumers D) containerFactory Answer: A
Explanation: The concurrency attribute sets the initial number of consumer threads for the listener container. Question 29. Which annotation registers a method as a message listener for a specific queue? A) @RabbitHandler B) @RabbitListener C) @MessageMapping D) @QueueListener Answer: B Explanation: @RabbitListener marks a method (or class) to receive messages from the defined queues. Question 30. In a listener container, what does the prefetchCount property affect? A) Number of messages retrieved per batch from the broker B) Maximum number of concurrent listeners C) Size of the internal message buffer D) Delay before acknowledging a message Answer: A Explanation: prefetchCount limits how many unacknowledged messages a consumer can hold at once, controlling batch size. Question 31. Which acknowledgment mode must be set to enable manual ack in a Spring listener? A) AUTO B) MANUAL C) NONE
B) Transactional channel (channelTransacted = true) C) RabbitTemplate with setChannelTransacted(true) D) @Transactional on the sending method Answer: C Explanation: Enabling setChannelTransacted(true) makes the RabbitTemplate participate in the surrounding Spring transaction, sending only on commit. Question 35. Which exception type is typically thrown by a listener when a message cannot be processed and should be retried? A) AmqpRejectAndDontRequeueException B) ListenerExecutionFailedException C) MessageConversionException D) IllegalStateException Answer: B Explanation: ListenerExecutionFailedException signals a processing failure; with proper config it can trigger retries. Question 36. In a retry scenario, which Spring AMQP component defines the back‑off policy? A) RetryTemplate B) SimpleMessageListenerContainer C) RabbitTemplate D) AmqpTemplate Answer: A Explanation: RetryTemplate configures max attempts, back‑off intervals, and recovery callbacks for listener retries.
Question 37. What property on a queue definition enables the queue to be automatically deleted when it becomes empty? A) autoDelete B) expires C) exclusive D) durable Answer: B Explanation: The x-expires argument specifies the idle time after which an empty queue is removed. Question 38. Which RabbitMQ plugin provides delayed message delivery without using TTL and DLX? A) Shovel plugin B) Federation plugin C) Delayed Message Exchange plugin D) Management plugin Answer: C Explanation: The Delayed Message Exchange plugin adds a x-delayed-message exchange type that postpones delivery based on a header. Question 39. When implementing RPC over RabbitMQ, which header carries the identifier to match replies with requests? A) replyTo B) correlationId C) messageId D) type Answer: B
D) admin Answer: A Explanation: The configure permission allows a user to create, delete, or modify exchanges, queues, and bindings. Question 43. In a Spring integration test, which annotation starts an embedded RabbitMQ broker? A) @EmbeddedRabbitMQ B) @Testcontainers C) @RabbitListenerTest D) @RabbitBootTest Answer: B Explanation: Using Testcontainers with the RabbitMQ Docker image allows an embedded broker for tests. Question 44. Which Spring Boot property sets the default virtual host for RabbitMQ connections? A) spring.rabbitmq.host B) spring.rabbitmq.virtual-host C) spring.rabbitmq.username D) spring.rabbitmq.port Answer: B Explanation: spring.rabbitmq.virtual-host specifies the virtual host to which the ConnectionFactory connects. Question 45. What is the effect of setting publisher-returns to true in Spring AMQP? A) Enables publisher confirms
B) Allows the broker to return unroutable messages to the sender C) Forces all messages to be persistent D) Enables transaction support for producers Answer: B Explanation: Enabling returned messages lets the producer receive notifications when a mandatory publish cannot be routed. Question 46. Which method on RabbitTemplate is used to send a message without expecting a reply? A) convertAndSend B) sendAndReceive C) convertSendAndReceive D) receiveAndConvert Answer: A Explanation: convertAndSend performs a one‑way publish, converting the object and sending it to the exchange. Question 47. In a dead‑letter queue, which header indicates why the original message was dead‑lettered? A) x-death-reason B) x-original-reason C) x-death D) x-reject-cause Answer: C Explanation: The x-death header contains a list of dictionaries describing the reason (rejected, expired, etc.).
Explanation: maxConcurrentConsumers caps the number of consumer threads that the container can scale up to. Question 51. In RabbitMQ, what does the term “backing off” refer to in the context of a consumer? A) Reducing the prefetch count after a failure B) Pausing consumption for a period before retrying C) Switching to a different queue automatically D) Closing the channel and reopening it Answer: B Explanation: Back‑off strategies introduce delays between retry attempts to avoid overwhelming the broker. Question 52. Which AMQP 0‑ 9 ‑1 feature allows a producer to know that a message has been persisted to disk? A) Publisher confirms B) Transactional publishing C) Mandatory flag D) Immediate flag Answer: A Explanation: Publisher confirms are acknowledgments from the broker that a message has been safely stored. Question 53. Which Spring annotation enables detection of @RabbitListener annotations on beans? A) @EnableRabbit B) @ComponentScan
C) @Configuration D) @RabbitBootstrap Answer: A Explanation: @EnableRabbit activates the Rabbit listener infrastructure in the application context. Question 54. What is the default exchange type when you declare an exchange without specifying a type in Spring AMQP? A) direct B) fanout C) topic D) headers Answer: A Explanation: The default exchange type in RabbitMQ (and thus in Spring) is direct. Question 55. Which queue argument defines the maximum length of a queue in number of messages? A) x-max-length-bytes B) x-max-length C) x-queue-limit D) x-message-limit Answer: B Explanation: x-max-length sets a hard limit on the number of messages a queue can hold. Question 56. In a Spring @RabbitListener method, which parameter type can be used to obtain the raw com.rabbitmq.client.Channel?