Conversation
…t starts The broker has no notion of connection started state: it dispatches into any registered consumer's prefetch, and a never-started client just holds those messages in its dispatch channel. A competing consumer on a never-started connection therefore steals round-robined queue messages that no one will ever deliver (seen as the TCK core20 queueReceiveTests hang). With deferPrefetchUntilStarted enabled on the connection factory, queue consumers created before their connection has ever started register with prefetch zero, which the broker treats as no push credit. Connection.start() restores the configured prefetch through a ConsumerControl, and the broker's existing processConsumerControl path re-credits the subscription and wakes the destination. Pull sends and the async-consumer prefetch guard treat a deferred consumer by its configured value. A deferred consumer carries prefetch zero on the wire but sends no MessagePull, so it must not take the pull-consumer branch of receive(timeout)/receiveNoWait, which waits for the broker to signal the pull timeout that never comes. The pull-mode decision goes through isPullConsumer(), which excludes deferred consumers, so they use client-side timeouts like any push consumer (TCK core/queueConnection connNotStartedQueueTest). Pinned by UnstartedConnectionQueueDispatchTest. The flag is copied to the connection in configureConnection(), so factory subclasses that construct their own connection type inherit it. Opt-in (default false) to preserve the pre-start prefetch warmup behavior some applications rely on.
JmsTool creates competing queue consumers on connections it never starts, which parked round-robined messages in a held dispatch channel and hung core20/jmsconsumertests queueReceiveTests and core/queueConnection connNotStartedQueueTest. Once the shared-subscription TCK changes land, the queueReceiveTests entry they add to ts.jtx is no longer needed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Per the Jakarta specification, a connection that hasn't been started should not receive dispatched messages. Currently, ActiveMQ will dispatch messages for prefetch before the connection has been started.
The Jakarta specification has a test where consumers are mixed and one is not started on purpose. Currently, ActiveMQ would fail that test as messages are dispatched to a connection that has not been started.
This change provides configurable option to have prefetch wait until the connection has been explicitly started.