Text messages do not get the content-length header as you know that a string will not contain any nulls you can assume that the terminating null is the only one you will find in a text message. The bytes message does use the content length header as the payload could contain any number of nulls. The broker and the various clients use this distinction to determine when a message is text or bytes.
On Thu, 2007-04-05 at 14:36 +0800, Dingwen Yuan wrote: > Hi all, > > I am now coding a delphi control for stomp client. I noticed that under SEND > or MESSAGE frame, there exists a Header "content-length". But when I set the > this header of a SEND frame to byte count of the BODY, an error simply > occurred on a subscribing client, like follows: > > 2007-4-5 13:22:12 org.apache.activemq.transport.failover.FailoverTransport > handl > eTransportFailure > INFO: Transport failed, attempting to automatically reconnect due to: > java.io.EO > FException > java.io.EOFException > at java.io.DataInputStream.readInt(DataInputStream.java:375) > at > org.apache.activemq.openwire.OpenWireFormat.unmarshal(OpenWireFormat. > java:267) > at > org.apache.activemq.transport.tcp.TcpTransport.readCommand(TcpTranspo > rt.java:156) > at > org.apache.activemq.transport.tcp.TcpTransport.run(TcpTransport.java: > 136) > at java.lang.Thread.run(Thread.java:619) > > In addition, it seems text messages never contain this header. Is it so? When > do we use this header? > > Thanks! > > > > > > > Dingwen Yuan > 2007-04-05