1Z0-900 · Question #28
You are working with JMS publish-subscribe operations. What happens when a producer publishes a message to a topic for which a durable subscription exists but there are no subscribers available?
The correct answer is C. The publisher successfully sends a message, which will be consumed later, once there is a. Option C is correct because a durable subscription is specifically designed to persist messages on the broker even when no active subscriber is connected - this is its core purpose and what distinguishes it from a non-durable subscription. When the subscriber eventually…
Question
You are working with JMS publish-subscribe operations. What happens when a producer publishes a message to a topic for which a durable subscription exists but there are no subscribers available?
Options
- AThe publisher waits for a subscriber, who then consumes it. However, the publisher will time out if
- BThe publisher sends the message. However, it is never consumed because there wasn't anything
- CThe publisher successfully sends a message, which will be consumed later, once there is a
- DThe message publisher is immediately notified about the lack of subscribers and can decide for
How the community answered
(28 responses)- A4% (1)
- B4% (1)
- C86% (24)
- D7% (2)
Explanation
Option C is correct because a durable subscription is specifically designed to persist messages on the broker even when no active subscriber is connected - this is its core purpose and what distinguishes it from a non-durable subscription. When the subscriber eventually reconnects, the broker delivers all retained messages in order.
Why the distractors are wrong:
- A is wrong because the publisher is never blocked waiting for a subscriber; JMS pub-sub decouples producers and consumers entirely - the publish call returns immediately.
- B describes non-durable subscription behavior, where messages are indeed dropped if no subscriber is active; durable subscriptions exist precisely to prevent this.
- D is wrong because JMS does not notify publishers about subscriber availability; that would violate the loose coupling that is a fundamental principle of the pub-sub pattern.
Memory tip: Think of a durable subscription as a voicemail inbox - the caller (publisher) leaves a message and hangs up immediately; the recipient (subscriber) picks it up whenever they're available, even hours later.
Topics
Community Discussion
No community discussion yet for this question.