@Test public void shouldAddNewUTF8BytesMessageToStorage() throws JMSException { MockBytesMessage message = new MockBytesMessage(); message.writeBytes("my awesome message \uF609".getBytes(Charset.forName("UTF-8"))); message.reset(); sut.onMessage(message); Collection<SimpleMessage> resultInStorage = storage.getMessagesAfter(0); assertThat(resultInStorage).hasSize(1); SimpleMessage first = resultInStorage.iterator().next(); assertThat(first.getText()).isEqualTo("my awesome message \uF609"); assertThat(first.getProps()).isEmpty(); }
@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; }