Always send a body section - #73
Open
ansd wants to merge 1 commit into
Open
Conversation
… null A JMS Message created with Session.createMessage() carries no body, and the client encoded it as an AMQP message with no body section at all. AMQP 1.0 section 3.2 does not allow that: it lists every other section as "zero or one", but the body as one of three mandatory choices (one or more data sections, one or more amqp-sequence sections, or a single amqp-value section). The AMQP JMS Mapping is explicit about which of those a bodiless JMS Message maps to - section 3.2.4.7 states that "a Message is encoded as a single amqp-value section containing null". Brokers that enforce the requirement therefore reject every message sent by Session.createMessage(); RabbitMQ, for instance, refuses the transfer with amqp:decode-error "missing_amqp_message_body", which fails a range of Jakarta Messaging TCK tests. Supply the amqp-value null section when encoding a facade that has no body. The fix is applied at the encode step rather than by giving the facade a body, so that the facade keeps representing "this message has no body" (as hasBody() and the JMS Message body accessors rely on) and so that a bodiless message received from a peer also gains a conformant body when forwarded. The x-opt-jms-msg-type annotation continues to identify the message as a generic Message on receipt; without it, an amqp-value null body would be read back as a TextMessage per the mapping's section 3.3.4. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
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.
Always send a body section, encoding a bodiless Message as amqp-value null.
A JMS Message created with
Session.createMessage()carries no body, and the client encoded it as an AMQP message with no body section at all.AMQP 1.0 section 3.2 does not allow that: it lists every other section as "zero or one", but the body as one of three mandatory choices (one or more data sections, one or more amqp-sequence sections, or a single amqp-value section). The AMQP JMS Mapping is explicit about which of those a bodiless JMS Message maps to - section 3.2.4.7 states that "a Message is encoded as a single amqp-value section containing null".
Brokers that enforce the requirement therefore reject every message sent by
Session.createMessage(); RabbitMQ, for instance, refuses the transfer with `amqp:decode-error "missing_amqp_message_body".Supply the amqp-value null section when encoding a facade that has no body. The fix is applied at the encode step rather than by giving the facade a body, so that the facade keeps representing "this message has no body" (as
hasBody()and the JMS Message body accessors rely on) and so that a bodiless message received from a peer also gains a conformant body when forwarded.The
x-opt-jms-msg-typeannotation continues to identify the message as a generic Message on receipt; without it, an amqp-value null body would be read back as a TextMessage per the mapping's section 3.3.4.