String message properties have a maximum size of 64 KB which is the UTF-8 limit

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

String message properties have a maximum size of 64 KB which is the UTF-8 limit

DouglasJD
QUOTE from earlier comment,
Ahh, that explains it. String message properties have a maximum size of 64 KB which is the UTF-8 limit. The body can have unlimited size but not a property. We miss to throw a JMSException if the size is > 64 KB. Will be fixed.


Questions 1,
Any enhancement in new version?

Questions 2,

If we send as an object, will it has limitation of 64 KB?


Below is a handling method in ObjectOutputStream. It seems no problem to handle String more than 64KB when send as an object.

     * Writes given string to stream, using standard or long UTF format
     * depending on string length.
     */
    private void writeString(String str, boolean unshared) throws IOException {
        handles.assign(unshared ? null : str);
        long utflen = bout.getUTFLength(str);
        if (utflen <= 0xFFFF) {
            bout.writeByte(TC_STRING);
            bout.writeUTF(str, utflen);
        } else {
            bout.writeByte(TC_LONGSTRING);
            bout.writeLongUTF(str, utflen);
        }
    }
Reply | Threaded
Open this post in threaded view
|

Re: String message properties have a maximum size of 64 KB which is the UTF-8 limit

IIT Software
Administrator
Message properties are limited to 64 KB due to UTF-8. We throw a JMSException if the string is greater.

You can transfer larger strings if you put it into the message body of a TextMessage.
Reply | Threaded
Open this post in threaded view
|

Re: String message properties have a maximum size of 64 KB which is the UTF-8 limit

DouglasJD
How is an Object Message in which one String value is larger than 64K.
ObjectMessage message = jmsSession.createObjectMessage();
 message.setObject(obj);  
Reply | Threaded
Open this post in threaded view
|

Re: String message properties have a maximum size of 64 KB which is the UTF-8 limit

IIT Software
Administrator
An Object is a Serializable for which ObjectOutput/InputStreams are used to create a byte stream of unlimited length. So they can be of course larger. You have to use ObjectMessage then.
Reply | Threaded
Open this post in threaded view
|

Re: String message properties have a maximum size of 64 KB which is the UTF-8 limit

DouglasJD
Thanks For your help.