@Override public Map<String, Object> getFields(Object o) throws OpenDataException { ActiveMQMapMessage m = (ActiveMQMapMessage)o; Map<String, Object> rc = super.getFields(o); try { rc.put(CompositeDataConstants.CONTENT_MAP, "" + m.getContentMap()); } catch (JMSException e) { rc.put(CompositeDataConstants.CONTENT_MAP, ""); } return rc; } }
@Override public Map<String, Object> getFields(Object o) throws OpenDataException { ActiveMQMapMessage m = (ActiveMQMapMessage)o; Map<String, Object> rc = super.getFields(o); try { rc.put(CompositeDataConstants.CONTENT_MAP, "" + m.getContentMap()); } catch (JMSException e) { rc.put(CompositeDataConstants.CONTENT_MAP, ""); } return rc; } }
@Override public Map<String, Object> getFields(Object o) throws OpenDataException { ActiveMQMapMessage m = (ActiveMQMapMessage)o; Map<String, Object> rc = super.getFields(o); try { rc.put(CompositeDataConstants.CONTENT_MAP, "" + m.getContentMap()); } catch (JMSException e) { rc.put(CompositeDataConstants.CONTENT_MAP, ""); } return rc; } }
@Override public Map<String, Object> getFields(Object o) throws OpenDataException { ActiveMQMapMessage m = (ActiveMQMapMessage)o; Map<String, Object> rc = super.getFields(o); try { rc.put(CompositeDataConstants.CONTENT_MAP, "" + m.getContentMap()); } catch (JMSException e) { rc.put(CompositeDataConstants.CONTENT_MAP, ""); } return rc; } }
@Override public Map<String, Object> getFields(Object o) throws OpenDataException { ActiveMQMapMessage m = (ActiveMQMapMessage)o; Map<String, Object> rc = super.getFields(o); try { rc.put(CompositeDataConstants.CONTENT_MAP, "" + m.getContentMap()); } catch (JMSException e) { rc.put(CompositeDataConstants.CONTENT_MAP, ""); } return rc; } }
@Override public <T> T getBody(final Class<T> c) throws JMSException { if (isBodyAssignableTo(c)) { return c.cast(ActiveMQMapMessage.class.isInstance(message) ? ActiveMQMapMessage.class.cast(message).getContentMap() : message /* unlikely */); } throw new MessageFormatException("Can't get the body with type " + c); }
/** * Return the underlying Map from the JMS MapMessage instance. * * @param message * the MapMessage whose underlying Map is requested. * * @return the underlying Map used to store the value in the given MapMessage. * * @throws JMSException if an error occurs in constructing or fetching the Map. */ public static Map<String, Object> getMapFromMessageBody(ActiveMQMapMessage message) throws JMSException { final HashMap<String, Object> map = new LinkedHashMap<String, Object>(); final Map<String, Object> contentMap = message.getContentMap(); if (contentMap != null) { for (Entry<String, Object> entry : contentMap.entrySet()) { Object value = entry.getValue(); if (value instanceof byte[]) { value = new Binary((byte[]) value); } map.put(entry.getKey(), value); } } return map; } }
/** * Return the underlying Map from the JMS MapMessage instance. * * @param message * the MapMessage whose underlying Map is requested. * * @return the underlying Map used to store the value in the given MapMessage. * * @throws JMSException if an error occurs in constructing or fetching the Map. */ public static Map<String, Object> getMapFromMessageBody(ActiveMQMapMessage message) throws JMSException { final HashMap<String, Object> map = new LinkedHashMap<String, Object>(); final Map<String, Object> contentMap = message.getContentMap(); if (contentMap != null) { for (Entry<String, Object> entry : contentMap.entrySet()) { Object value = entry.getValue(); if (value instanceof byte[]) { value = new Binary((byte[]) value); } map.put(entry.getKey(), value); } } return map; } }
if (receiverType.equals(Map.class)) { receiver.receive((T) m.getContentMap()); } else { throw new Exception("We received a ActiveMQMapMessage-message, so you have to use receiverType = java.util.Map to receive it");
@Override public String toString() { try { switch (message.getDataStructureType()) { case ActiveMQMessage.DATA_STRUCTURE_TYPE: return ""; case ActiveMQBlobMessage.DATA_STRUCTURE_TYPE: ActiveMQBlobMessage blob = (ActiveMQBlobMessage) message; return blob.getRemoteBlobUrl(); case ActiveMQMapMessage.DATA_STRUCTURE_TYPE: ActiveMQMapMessage map = (ActiveMQMapMessage)message; return map.getContentMap().toString(); case ActiveMQTextMessage.DATA_STRUCTURE_TYPE: ActiveMQTextMessage text = (ActiveMQTextMessage)message; return text.getText(); case ActiveMQBytesMessage.DATA_STRUCTURE_TYPE: case ActiveMQObjectMessage.DATA_STRUCTURE_TYPE: case ActiveMQStreamMessage.DATA_STRUCTURE_TYPE: ByteSequence data = message.getContent(); return "binary payload {length="+data.getLength()+", compressed="+message.isCompressed()+"}"; } } catch (JMSException e) { } return ""; } }
command.setContent(marshall((Serializable)msg.getContentMap(), headers.get(Stomp.Headers.TRANSFORMATION)) .getBytes("UTF-8"));
command.setContent(marshall((Serializable) msg.getContentMap(), headers.get(Headers.TRANSFORMATION)).getBytes("UTF-8"));
command.setContent(marshall((Serializable) msg.getContentMap(), headers.get(Headers.TRANSFORMATION)).getBytes("UTF-8"));
command.setContent(marshall((Serializable) msg.getContentMap(), headers.get(Headers.TRANSFORMATION)).getBytes("UTF-8"));
command.setContent(marshall((Serializable) msg.getContentMap(), headers.get(Headers.TRANSFORMATION)).getBytes("UTF-8"));
command.setContent(marshall((Serializable) msg.getContentMap(), headers.get(Headers.TRANSFORMATION)).getBytes("UTF-8"));
ActiveMQMapMessage msg = (ActiveMQMapMessage) message.copy(); msg.setReadOnlyBody(true); Map<String, Object> map = msg.getContentMap(); if (map != null) { result.payload(new Buffer(map.toString().getBytes("UTF-8")));
ActiveMQMapMessage msg = (ActiveMQMapMessage) message.copy(); msg.setReadOnlyBody(true); Map<String, Object> map = msg.getContentMap(); if (map != null) { result.payload(new Buffer(map.toString().getBytes("UTF-8")));
ActiveMQMapMessage msg = (ActiveMQMapMessage) message.copy(); msg.setReadOnlyBody(true); Map<String, Object> map = msg.getContentMap(); if (map != null) { result.payload(new Buffer(map.toString().getBytes("UTF-8")));
ActiveMQMapMessage msg = (ActiveMQMapMessage) message.copy(); msg.setReadOnlyBody(true); Map<String, Object> map = msg.getContentMap(); if (map != null) { result.payload(new Buffer(map.toString().getBytes("UTF-8")));