@Override public ActiveMQMessage convertFrame(ProtocolConverter converter, StompFrame command) throws JMSException, ProtocolException { Map<String, String> headers = command.getHeaders(); ActiveMQMessage msg; String transformation = headers.get(Headers.TRANSFORMATION); if (headers.containsKey(Headers.CONTENT_LENGTH) || transformation.equals(Transformations.JMS_BYTE.toString())) { msg = super.convertFrame(converter, command); } else { HierarchicalStreamReader in; try { String text = new String(command.getContent(), "UTF-8"); switch (Transformations.getValue(transformation)) { case JMS_OBJECT_XML: in = new XppReader(new StringReader(text), XppFactory.createDefaultParser()); msg = createObjectMessage(in); break; case JMS_OBJECT_JSON: in = new JettisonMappedXmlDriver().createReader(new StringReader(text)); msg = createObjectMessage(in); break; case JMS_MAP_XML: in = new XppReader(new StringReader(text), XppFactory.createDefaultParser()); msg = createMapMessage(in); break; case JMS_MAP_JSON: in = new JettisonMappedXmlDriver().createReader(new StringReader(text)); msg = createMapMessage(in); break; default: throw new Exception("Unkown transformation: " + transformation); } } catch (Throwable e) { command.getHeaders().put(Headers.TRANSFORMATION_ERROR, e.getMessage()); msg = super.convertFrame(converter, command); } } copyStandardHeadersFromFrameToMessage(converter, command, msg, this); return msg; }