JMS2.0规范中文版

修改接收的消息的值

当接收到消息时,它的报头字段值是可以改变的;然而,它的属性条目和它的身体是只读的,按照本章的规定。

对于只读的限制的理由是,它给JMS提供程序在如何实现收到的邮件管理更自由。例如,他们可能会返回一个引用驻留在一个内部消息缓冲区而不是被迫进行复印属性条目和身体值的报文对象。

消费者可以在调用任一clearBody或clearProperties方法,使身体或财产写入修改后收到的消息。如果消费者修改收到的消息,该消息随后被交还,交还该消息必须是原始的,未经修改的消息(除了头和属性由JMS提供者作为交还,如JMSRedelivered头的结果,修改和JMSXDeliveryCount属性)。

When a message is received, its header field values can be changed; however, its property entries and its body are read-only, as specified in this chapter. The rationale for the read-only restriction is that it gives JMS Providers more freedom in how they implement the management of received messages. For instance, they may return a message object that references property entries and body values that reside in an internal message buffer rather than being forced to make a copy. A consumer can modify a received message after calling either the clearBody or clearProperties method to make the body or properties writable. If the consumer modifies a received message, and the message is subsequently redelivered, the redelivered message must be the original, unmodified message (except for headers and properties modified by the JMS provider as a result of the redelivery, such as the JMSRedelivered header and the JMSXDeliveryCount property).