Return-Path: X-Original-To: apmail-activemq-users-archive@www.apache.org Delivered-To: apmail-activemq-users-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 2A6456A1D for ; Sat, 6 Aug 2011 14:52:37 +0000 (UTC) Received: (qmail 20412 invoked by uid 500); 6 Aug 2011 14:52:36 -0000 Delivered-To: apmail-activemq-users-archive@activemq.apache.org Received: (qmail 20336 invoked by uid 500); 6 Aug 2011 14:52:36 -0000 Mailing-List: contact users-help@activemq.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: users@activemq.apache.org Delivered-To: mailing list users@activemq.apache.org Received: (qmail 20328 invoked by uid 99); 6 Aug 2011 14:52:35 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 06 Aug 2011 14:52:35 +0000 X-ASF-Spam-Status: No, hits=1.3 required=5.0 tests=SPF_PASS,URI_HEX X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of neek@nickfenwick.com designates 216.139.236.26 as permitted sender) Received: from [216.139.236.26] (HELO sam.nabble.com) (216.139.236.26) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 06 Aug 2011 14:52:30 +0000 Received: from joe.nabble.com ([192.168.236.139]) by sam.nabble.com with esmtp (Exim 4.72) (envelope-from ) id 1QpiEU-00035U-63 for users@activemq.apache.org; Sat, 06 Aug 2011 07:52:10 -0700 Date: Sat, 6 Aug 2011 07:52:10 -0700 (PDT) From: neek To: users@activemq.apache.org Message-ID: <1312642330177-3723444.post@n4.nabble.com> Subject: Stomp message from PHP client, "Unsupported message type 'MapMessage'" from Java server MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit 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:// transport. 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] [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 URI("broker:stomp://localhost:61616")); broker.start(); 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 $con->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 $con->subscribe("/queue/test"); // 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 $con->ack($msg); } else { error_log("Failed to receive a message"); } } catch (Stomp_Exception $e) { error_log("StompException sending message: " . $e->getMessage() . " details: " . $e->getDetails()); } // disconnect $con->disconnect(); I got to this point by starting at http://activemq.apache.org/php.html, which links to two places. I got the stompcli-php5-1.0-20080916.tar.gz from the code.google.com site it links to, and built my PHP code using the documentation at http://stomp.fusesource.org/documentation/php/index.html. 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 http://stomp.fusesource.org/documentation/php/book.html 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: java.io.IOException: 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 stomp.fusesource.org out of date or invalid in some way? I've tried using the 1.0.0 client available from http://stomp.fusesource.org/download.html (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, Nick -- View this message in context: http://activemq.2283324.n4.nabble.com/Stomp-message-from-PHP-client-Unsupported-message-type-MapMessage-from-Java-server-tp3723444p3723444.html Sent from the ActiveMQ - User mailing list archive at Nabble.com.