@ Override protected JsJmsMessage getMsgReference ( ) throws JMSException { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "getMsgReference" ) ; // If the body is read only, the contents should already be in the // JS message, so only do the copy over if we are in write mode. // SIB0121: ... and if the producer might modify the payload after it's been set if ( ! isBodyReadOnly ( ) && ! producerWontModifyPayloadAfterSet ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) SibTr . debug ( this , tc , "Body is writeable & producer hasn't promised not to modify the payload - attempt encoding" ) ; try { int encoding = integerEncoding | floatEncoding ; // NB bitwise or (|), not logical or (||) // check if JMS_IBM_Encoding has been set if ( propertyExists ( ApiJmsConstants . ENCODING_PROPERTY ) ) { encoding = getIntProperty ( ApiJmsConstants . ENCODING_PROPERTY ) ; } if ( bodySetInJsMsg && ( encoding == lastEncoding ) ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) SibTr . debug ( this , tc , "Body cached - encoding not necessary" ) ; } else { // flatten and encode the data streams byte [ ] encodedBody = _exportBody ( encoding ) ; // and set it into the Jetstream message jsBytesMsg . setBytes ( encodedBody ) ; lastEncoding = encoding ; bodySetInJsMsg = true ; } } catch ( JMSException e ) { // No FFDC code needed // d222942 review JMSException could be thrown by _exportBody if passed an unknown // value for encoding, or if there was an IO error handling the streams. These already // have good nls messages, so we should simply pass on, not wrap with a generic message. // Similarly, getIntProperty can throw a JMSException which can also be passed on. throw e ; } } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( this , tc , "getMsgReference" , jsBytesMsg ) ; return jsBytesMsg ; }
override the getMsgReference method of the parent class . We need to ensure that the message body is written into the JS message before returning the reference to it .