pecl-tools-stomp icon indicating copy to clipboard operation
pecl-tools-stomp copied to clipboard

Add content-length header only for messages containing zero byte

Open vitalif opened this issue 8 years ago • 0 comments

Hi!

Now php5-stomp always adds 'content-length' header to all messages being sent. This makes sending JMS "TextMessage" (including XML!) impossible, because most JMS/STOMP queues like OpenMQ or ActiveMQ decide whether the message is JMS "BytesMessage" or "TextMessage" based on the presence of 'content-length' header (as described here: http://activemq.apache.org/stomp.html and here: https://mq.java.net/4.4-content/stomp-funcspec.html). I.e. if it is there, the message is treated as bytes. So JMS can never decode messages sent from php5-stomp as XML, because it wants XML to be TextMessages.

And XML is obviously the thing that you want the most when connecting to a JMS queue via STOMP! :)

This pull request fixes this behaviour by making php5-stomp only add content-length header for messages with zero byte.

(https://bugs.php.net/bug.php?id=70280)

vitalif avatar Aug 18 '15 09:08 vitalif