From the course: Spring: Messaging with JMS

Unlock this course with a free trial

Join today to access over 25,300 courses taught by industry experts.

Spring JMS basic connection, part 2

Spring JMS basic connection, part 2 - Spring Tutorial

From the course: Spring: Messaging with JMS

Spring JMS basic connection, part 2

- [Instructor] As I mentioned, we now need to add a listener class for listening to our queue called order queue. Springs make this so easy in listening to a message queue for messages. All you have to do is create a class and use a few spring JMS annotations. Let's do this now. We'll call our class ... The receiver class. And we'll annotate it ... With at component ... Which will cause this class to be added to the spring context as the application starts out. It subsequently allows other spring beans to find it. Inside of our class let's create a method called receive message. With a string message parameter. We'll annotate this method with at JMS listener. The JMS listener annotation can take several properties, but we'll provide two mandatory: the destination and the factory it will use. The destination will be the order queue which we specified earlier in sending a message to the application, dot Java class. The order queue is the queue that the JMS listener is being configured…

Contents