activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From neek <>
Subject Format of stomp MapMessages from PHP? string works, long fails.
Date Sun, 07 Aug 2011 15:30:25 GMT
I'm not sure where to ask this question.. here or at fusesource, or at
xstream.  Quite a few libraries are responsible for marshalling the data and
I think it's xstream that actually needs the data format I'm talking about.

I've succeeded in sending a MapMessage from PHP to ActiveMQ via the stomp
protocol, as long as it only contains string datatypes.  e.g.:

$body = array('map' => array('entry' => array(
        array('string' => array('orders_id', '1234')),
        array('string' => array('status', '4'))

I do not know where the "map: { entry : [ ... etc" protocol is defined.  I
believe it's expected in xstream.  They don't appear on the receiving end in
the resulting MapMessage.

That map is received as a JMS MapMessage with orders_id => "1234" and status
=> "4".  Great.

My problem is that as soon as I try to send a non-string value, the message
parsing fails.  For example the most obvious change to make orders_id a long
instead of a string:

$body = array('map' => array('entry' => array(
        array('long' => array('orders_id', 1234)),
        array('string' => array('status', '4'))

This sends ok from PHP, but barfs in the Java server:

Aug 7, 2011 10:18:55 PM
org.apache.activemq.transport.stomp.ProtocolConverter handleException
WARNING: Exception occurred processing: 
transformation-error:For input string: "orders_id" : For input string:
---- Debugging information ----
message             : For input string: "orders_id"
cause-exception     : java.lang.NumberFormatException
cause-message       : For input string: "orders_id"
class               : java.util.HashMap
required-type       : java.lang.Long
path                : /map/entry/long
line number         : -1

org.apache.activemq.transport.stomp.ProtocolException: Unsupported message
type 'MapMessage'

It is taking the string "orders_id" (NOT the value "1234") and trying to
call Long.parseLong("orders_id") which of course throws

It seems that the processing of non-string fields no longer uses the "type:
{ key, value }" syntax.

Can anyone advise how to send non-string fields?

Just to mention,  I believe I can take the data type identifiers seen in
com/thoughtworks/xstream/ .. and the reference shows a MapMessage
that looks like this:


Yet, simply changing 'string' to 'long' in my example seems to completely
change the expected format.

For now I can pass strings and convert them myself in the consumer but this
is clearly not the right solution in the long term.


View this message in context:
Sent from the ActiveMQ - User mailing list archive at

View raw message