Fix SpringJMS examples
This commit is contained in:
parent
6a7e380efd
commit
c4638f1b4a
|
@ -25,8 +25,8 @@ public class SampleListener implements MessageListener {
|
||||||
public void onMessage(Message message) {
|
public void onMessage(Message message) {
|
||||||
if (message instanceof TextMessage) {
|
if (message instanceof TextMessage) {
|
||||||
try {
|
try {
|
||||||
|
|
||||||
String msg = ((TextMessage) message).getText();
|
String msg = ((TextMessage) message).getText();
|
||||||
|
System.out.println("Received message: " + msg);
|
||||||
} catch (JMSException ex) {
|
} catch (JMSException ex) {
|
||||||
throw new RuntimeException(ex);
|
throw new RuntimeException(ex);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,24 +0,0 @@
|
||||||
package com.baeldung.spring.jms;
|
|
||||||
|
|
||||||
import org.junit.BeforeClass;
|
|
||||||
import org.junit.Test;
|
|
||||||
import org.springframework.context.ApplicationContext;
|
|
||||||
import org.springframework.context.support.ClassPathXmlApplicationContext;
|
|
||||||
|
|
||||||
public class DefaultTextMessageSenderTest {
|
|
||||||
|
|
||||||
private static SampleJmsMessageSender messageProducer;
|
|
||||||
|
|
||||||
@SuppressWarnings("resource")
|
|
||||||
@BeforeClass
|
|
||||||
public static void setUp() {
|
|
||||||
ApplicationContext applicationContext = new ClassPathXmlApplicationContext("classpath:EmbeddedActiveMQ.xml", "classpath:applicationContext.xml");
|
|
||||||
messageProducer = (SampleJmsMessageSender) applicationContext.getBean("SampleJmsMessageSender");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void testSimpleSend() {
|
|
||||||
messageProducer.simpleSend();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
Loading…
Reference in New Issue