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 @sendTo('destination')

Response management using @sendTo('destination') - Spring Tutorial

From the course: Spring: Messaging with JMS

Start my 1-month free trial

Response management using @sendTo('destination')

- [Instructor] Spring makes available some fun annotations that allow the default destination to be set along with the JmsListener. Going back to our WarehouseReceiver class, locate the receive method, and add SendTo annotation. We will supply it with a destination that we'll use in a WarehouseProcessing service. For now, right below the JmsListener, hit Enter, and type @SentTo("book.order.processed.queue") We'll make some changes in a moment to the warehouseProcesingService since we won't be sending a message from there anymore. But, for now, we need to address a couple of more issues. The @SendTo annotation, in order for this to work on a method, that method cannot return void. So, we'll need to rectify this by having the method return a ProcessedBookOrder. Change the void to ProcessedBookOrder. This object will be returned, as well, from the warehouseProcessingService method. So, while we're here, let's go ahead and change this runtime exception to an illegal argument exception…

Contents