@Test public void testCreateMapMessageValues() throws JMSException { MapMessage mapMessage = createMapMessage(); Map<String, String> mapMessageValues = JmsConsumer.createMapMessageValues(mapMessage); assertEquals("", 4, mapMessageValues.size()); assertEquals("", "Arnold", mapMessageValues.get(JmsConsumer.MAP_MESSAGE_PREFIX + "name")); assertEquals("", "97", mapMessageValues.get(JmsConsumer.MAP_MESSAGE_PREFIX + "age")); assertEquals("", "89686.564", mapMessageValues.get(JmsConsumer.MAP_MESSAGE_PREFIX + "xyz")); assertEquals("", "true", mapMessageValues.get(JmsConsumer.MAP_MESSAGE_PREFIX + "good")); }
public static Map<String, String> createMapMessageValues(final MapMessage mapMessage) throws JMSException { final Map<String, String> valueMap = new HashMap<>(); final Enumeration<?> enumeration = mapMessage.getMapNames(); while (enumeration.hasMoreElements()) { final String name = (String) enumeration.nextElement(); final Object value = mapMessage.getObject(name); if (value == null) { valueMap.put(MAP_MESSAGE_PREFIX + name, ""); } else { valueMap.put(MAP_MESSAGE_PREFIX + name, value.toString()); } } return valueMap; }
JmsConsumer extends AbstractProcessor { public static Map<String, String> createMapMessageValues(final MapMessage mapMessage) throws JMSException { final Map<String, String> valueMap = new HashMap<>(); final Enumeration<?> enumeration = mapMessage.getMapNames(); while (enumeration.hasMoreElements()) { final String name = (String) enumeration.nextElement(); final Object value = mapMessage.getObject(name); if (value == null) { valueMap.put(MAP_MESSAGE_PREFIX + name, ""); } else { valueMap.put(MAP_MESSAGE_PREFIX + name, value.toString()); } } return valueMap; } }
JmsConsumer extends AbstractProcessor { public static Map<String, String> createMapMessageValues(final MapMessage mapMessage) throws JMSException { final Map<String, String> valueMap = new HashMap<>(); final Enumeration<?> enumeration = mapMessage.getMapNames(); while (enumeration.hasMoreElements()) { final String name = (String) enumeration.nextElement(); final Object value = mapMessage.getObject(name); if (value == null) { valueMap.put(MAP_MESSAGE_PREFIX + name, ""); } else { valueMap.put(MAP_MESSAGE_PREFIX + name, value.toString()); } } return valueMap; } JmsConsumer(); }
JmsConsumer extends AbstractProcessor { public static Map<String, String> createMapMessageValues(final MapMessage mapMessage) throws JMSException { final Map<String, String> valueMap = new HashMap<>(); final Enumeration<?> enumeration = mapMessage.getMapNames(); while (enumeration.hasMoreElements()) { final String name = (String) enumeration.nextElement(); final Object value = mapMessage.getObject(name); if (value == null) { valueMap.put(MAP_MESSAGE_PREFIX + name, ""); } else { valueMap.put(MAP_MESSAGE_PREFIX + name, value.toString()); } } return valueMap; } JmsConsumer(); @Override Set<Relationship> getRelationships(); void consume(final ProcessContext context, final ProcessSession session, final WrappedMessageConsumer wrappedConsumer); static JmsProcessingSummary map2FlowFile(final ProcessContext context, final ProcessSession session, final Message message, final boolean addAttributes, ComponentLog logger); static Map<String, String> createMapMessageValues(final MapMessage mapMessage); }
JmsConsumer extends AbstractProcessor { public static Map<String, String> createMapMessageValues(final MapMessage mapMessage) throws JMSException { final Map<String, String> valueMap = new HashMap<>(); final Enumeration<?> enumeration = mapMessage.getMapNames(); while (enumeration.hasMoreElements()) { final String name = (String) enumeration.nextElement(); final Object value = mapMessage.getObject(name); if (value == null) { valueMap.put(MAP_MESSAGE_PREFIX + name, ""); } else { valueMap.put(MAP_MESSAGE_PREFIX + name, value.toString()); } } return valueMap; } JmsConsumer(); @Override Set<Relationship> getRelationships(); void consume(final ProcessContext context, final ProcessSession session, final WrappedMessageConsumer wrappedConsumer); static JmsProcessingSummary map2FlowFile(final ProcessContext context, final ProcessSession session, final Message message, final boolean addAttributes, ComponentLog logger); static Map<String, String> createMapMessageValues(final MapMessage mapMessage); static final String MAP_MESSAGE_PREFIX; static final Relationship REL_SUCCESS; }