From the course: Spring: Messaging with JMS
Unlock the full course today
Join today to access over 22,600 courses taught by industry experts or purchase this course individually.
Response management using JmsResponse - Spring Tutorial
From the course: Spring: Messaging with JMS
Response management using JmsResponse
- [Instructor] Let's look at dynamic destination strategies by using Spring's JMS response object. Using the JMS response object, we can compute the destination response at runtime, making this a dynamic process. The JMS response object requires a JMS listener annotation to work properly. And using it offers us the ability to look at our order state, custom header property, and decide which queue to send the message to. Open up the WarehouseReceiver class and go the receive method. We will wrap the message ProcessedBookOrder with a JMS response, so we'll do it like so. We'll type Jms Response. Again, we'll wrap this in the carat brackets. Because we are gonna be using Spring's JMS response object for dynamically setting our destinations, we will not need the @SendTo annotation anymore, so we'll just remove that. From the previous videos, we added the MessageHeaders parameter to demonstrate multiple ways of accessing headers for a given message. We're not using this anymore as well, so…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.