Skip to content

ARTEMIS-6294 race b/w MQTT retained pub & sub - #6778

Open
jbertram wants to merge 1 commit into
apache:mainfrom
jbertram:ARTEMIS-6294
Open

jbertram wants to merge 1 commit into
apache:mainfrom
jbertram:ARTEMIS-6294

Conversation

@jbertram

@jbertram jbertram commented Oct 8, 2026

Copy link
Copy Markdown
Contributor

A retained message is routed to its retain queue asynchronously, so it initially sits in the queue's list of "intermediate" references pending delivery. Retain queues have no consumers, so the only thing which moves it into the main list of references is the queue's executor. If a client subscribes before that happens the broker must still find the retained message rather than silently skipping it. Therefore, the retained message manager flushes the intermediate references before iterating over the messages.

Assisted-by: Claude

}

@Override
public void flushIntermediateReferences() {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you need this operation public, I would rather rename doInternalPoll as flushIntermediateReferences and make it public. update all the method calls to that public method instead.

I would prefer this method to not be public on Queue interface though. However if this would mean adding a lot of code just for that, so leave it public, but rename the method instead of a one-on-one delegation.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Renamed doInternalPoll to flushIntermediateReferences.

A retained message is routed to its retain queue asynchronously, so it
initially sits in the queue's list of "intermediate" references pending
delivery. Retain queues have no consumers, so the only thing which moves
it into the main list of references is the queue's executor. If a client
subscribes before that happens the broker must still find the retained
message rather than silently skipping it. Therefore, the retained
message manager flushes the intermediate references before iterating
over the messages.

Assisted-by: Claude
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants