img
Figure 16-12. Sending a message in ActiveMQ
After the Send button is clicked, you will see the message output by the listener in STS's output
console:
INFO : com.apress.prospring3.ch16.jms.listener.SimpleMessageListener ­ Message received:
Testing message for Spring JMS Listener
You can see how easy it is to set up a JMS listener in Spring for remote communication. In a JEE
application server environment, you just need to configure the connection factory using JNDI lookup
within the Spring configuration file. No other code change is required.
Sending JMS Messages in Spring
Let's see how to send messages using JMS in Spring. We will use the handy
org.springframework.jms.core.JmsTemplate class for the purpose. First we will develop a MessageSender
interface and its implementation class, SimpleMessageSender. Listings 16-16 and 16-17 show the
interface and the class, respectively.
Search WWH :
Custom Search
Previous Page
Spring Framework 3 Topic Index
Next Page
Spring Framework 3 Bookmarks
Home