activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From neek <>
Subject Stomp message from PHP client, "Unsupported message type 'MapMessage'" from Java server
Date Sat, 06 Aug 2011 14:52:10 GMT
Hi all,

I'm trying to integrate a traditional e-commerce website in PHP with my
ActiveMQ java application.  What I thought would be a trivial test program
has turned into a non-starter.  My main app runs a broker within a single
VM, and has used the vm://localhost transport.  Now, I want to be able to
send messages in to ActiveMQ from PHP, over either the tcp:// or stomp://

I've a very simple ActiveMQ test class which starts a broker and a consumer. 
When my PHP client tries to send a MapMessage, the PHP sends without error
but the Java server logs:

     [java] WARNING: Exception occurred processing: 
     [java] SEND
     [java] amq-msg-type:MapMessage
     [java] transformation:jms-map-json
     [java] destination:/queue/integration/order_change
     [java] transformation-error:org/codehaus/jettison/mapped/Configuration
     [java] {"map":{"orders_id":"1058","status":"1","comments":""}}:
org.apache.activemq.transport.stomp.ProtocolException: Unsupported message
type 'MapMessage'

The PHP then logs an error containing the same java stack trace, so the
basic comms between PHP and Java seems to be working fine.  I'm pretty sure
the error lies on the Java side, not the PHP side.

The "map": ... bit is the correct data that I sent from the PHP, but it
seems to be rejected by the stomp transport.  From what I can see in the
ActiveMQ 5.5.0 source code, org.apache.activemq.transport.stomp container
support for MapMessages, and I got to this point by following documentation. 
So, I wonder what's wrong?

The java server is a very simple class which starts a thread and starts a
broker in it with:

BrokerService broker = BrokerFactory.createBroker(new

Do I need to do anything else to make the stomp transport be able to deal
with MapMessages?

I don't think it matters how my consumer is set up on the Java side since
the message is never hitting it.  It's identical to the way I set up a
consumer in my main app, with java sending MapMessages to java within the
same VM.

My PHP code looks like this:

try {
	$con = new Stomp("tcp://localhost:61616");
	// connect
	// send a message to the queue
	$body = array("map" => array("orders_id"=>$oID, "status"=>$status,
"comments" => $comments));
	$header = array('transformation' => 'jms-map-json');
	$mapMessage = new Stomp_Message_Map($body, $header);
	$con->send("/queue/integration/order_change", $mapMessage, array());
	// subscribe to the queue
	// receive a message from the queue
	$msg = $con->readFrame();

	// do what you want with the message
	if ( $msg != null) {
		echo "Received message with body '$msg->body'\n";
		// mark the message as received in the queue
	} else {
		error_log("Failed to receive a message");
} catch (Stomp_Exception $e) {
	error_log("StompException sending message: " . $e->getMessage() .
			" details: " . $e->getDetails());
// disconnect

I got to this point by starting at,
which links to two places.  I got the stompcli-php5-1.0-20080916.tar.gz 
from the site it links to, and built my PHP code using the
documentation at 
There seems to be some mismatch between the two, for example the
stompcli-php5 tarball contains a Stomp_Exception object but the
documentation says to use StompException.

Also, the book at
says to use tcp://localhost:61616 as the transport, but it seems that on the
java side listening on tcp://localhost:61616 fails (with a "Transport
failed: Unknown data type: 69" message) .. I must use
stomp://localhost:61616 as the URI on the server to make it work at all.  Is
the info at out of date or invalid in some way?

I've tried using the 1.0.0 client available from (which does define StompException
and StompMapMessage) but it just seems to timeout when sending the message. 
Their git repository URL doesn't respond for me so I cannot fetch their
source that way.

Thank you for any help or advice,

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

View raw message