ansd opened a new pull request, #73: URL: https://github.com/apache/qpid-jms/pull/73
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](https://docs.oasis-open.org/amqp/core/v1.0/os/amqp-core-messaging-v1.0-os.html#section-message-format) 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-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. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
