jakartaee / jakartaee/messaging

Clarify how Message.receiveNoWait() is expected to behave

Open
#85 11 comments 0 reactions 0 assignees View on GitHub
jms21-forreview-minor Priority: Major Type: Improvement
Dominant language
Java
Stars
49
Forks
34
PR merge metrics
No merged PRs in 30d

Description

The javadoc for the java.jms.MessageConsumer method receiveNoWait() states that this method "Receives the next message if one is immediately available."

Several, if not most, JMS providers interpret the meaning of "immediately" (and "no wait") literally and only return a message is one is already available on the client. They do not attempt to contact the server to fetch a message from the server, even if there is one available.

This means that the effect of calling receiveNoWait() is unpredictable and experience suggests that developers are best advised never to use it.

It is proposed that the behaviour of this method should be clarified to state what it says above, and to recommend the use of the other receive methods in most cases.

_Edit_ Following comments, this issue has been broadened to consider all possible interpretations of this method. See [below](#action_366528)
#### Affected Versions
[1.1, 2.0]

Contributor guide

Open the contributing guide

Research direction

Start with the MessageConsumer.receiveNoWait() Javadoc and review the comment discussion, especially the broadened consideration of possible interpretations. Define the intended contract and recommendation for using the other receive methods, then update the Javadoc and verify that it accurately reflects the agreed behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
api, documentation
Issue type
Documentation
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.