| Article: |
Asynchronous Messaging Made Easy With Spring JMS | |
| Subject: | Where is the message content set? | |
| Date: | 2006-02-24 05:38:35 | |
| From: | christopherharris | |
|
In the traditional JMS implementation, you create a message and set the text of the message.
|
||
Showing messages 1 through 2 of 2.
-
Mixed up examples
2008-07-21 13:18:12 DMHurst [View]
-
Where is the message content set?
2006-02-25 20:42:35 srinip [View]
You set the message details when calling send() method in JmsTemplate class. In the sample application, JmsSender class takes care of this task.



I was able to get the complex example to operate properly after converting the download to a MyEclipse project, but "Made Easy" it is not.
Much of the source code you include in the article is nowhere to be found in the loanapp example, namely where you show how complicated "sendMessage()" is in regular JMS, and how simple it is when using Spring 2 framework. The following code is nowhere to be found in the loanapp example:
public void send() {
try {
ClassPathXmlApplicationContext appContext = new ClassPathXmlApplicationContext(new String[] {
"spring-jms.xml"});
System.out.println("Classpath loaded");
JMSSender jmsSender = (JMSSender)appContext.getBean("jmsSender");
jmsSender.sendMesage();
System.out.println("Message sent using Spring JMS.");
} catch(Exception e) {
e.printStackTrace();
}
}
When readers are first learning this stuff, they want simple first and complicated second.