@Test public void shouldExtractOnlySpecifiedProperties() throws JMSException { TextMessage message = new MockTextMessage("test"); message.setStringProperty("propA", "valA"); message.setStringProperty("propB", "valB"); sut.onMessage(message); Collection<SimpleMessage> resultInStorage = storage.getMessagesAfter(0); assertThat(resultInStorage).hasSize(1); SimpleMessage first = resultInStorage.iterator().next(); assertThat(first.getText()).isEqualTo("test"); assertThat(first.getQueue()).isEqualTo("myQueue"); assertThat(first.getProps()).hasSize(1).contains(entry("propA", "valA")); }
@Override public void onMessage(Message msg) { logger.debug("received new message from queue '{}'", queue); String text = Exceptions.sneak().get(() -> extractTextFromMessage(msg)); SimpleMessage message = new SimpleMessage(text, queue, getMessageProperties(msg)); storage.addMessage(message); }
JmsMessageListener implements MessageListener { @Override public void onMessage(Message msg) { logger.debug("received new message from queue '{}'", queue); String text = Exceptions.sneak().get(() -> extractTextFromMessage(msg)); SimpleMessage message = new SimpleMessage(text, queue, getMessageProperties(msg)); storage.addMessage(message); } }
JmsMessageListener implements MessageListener { @Override public void onMessage(Message msg) { logger.debug("received new message from queue '{}'", queue); String text = Exceptions.sneak().get(() -> extractTextFromMessage(msg)); SimpleMessage message = new SimpleMessage(text, queue, getMessageProperties(msg)); storage.addMessage(message); } JmsMessageListener(String queue, LocalMessageStorage storage, List<String> propertiesToExtract,
			String encoding); }
JmsMessageListener implements MessageListener { @Override public void onMessage(Message msg) { logger.debug("received new message from queue '{}'", queue); String text = Exceptions.sneak().get(() -> extractTextFromMessage(msg)); SimpleMessage message = new SimpleMessage(text, queue, getMessageProperties(msg)); storage.addMessage(message); } JmsMessageListener(String queue, LocalMessageStorage storage, List<String> propertiesToExtract,
			String encoding); @Override void onMessage(Message msg); Map<String, String> getMessageProperties(Message msg); }
JmsMessageListener implements MessageListener { @Override public void onMessage(Message msg) { logger.debug("received new message from queue '{}'", queue); String text = Exceptions.sneak().get(() -> extractTextFromMessage(msg)); SimpleMessage message = new SimpleMessage(text, queue, getMessageProperties(msg)); storage.addMessage(message); } JmsMessageListener(String queue, LocalMessageStorage storage, List<String> propertiesToExtract,
			String encoding); @Override void onMessage(Message msg); Map<String, String> getMessageProperties(Message msg); static final String JMS_IBM_CHARACTER_SET; }