From the course: Spring: Spring Integration
Unlock the full course today
Join today to access over 22,600 courses taught by industry experts or purchase this course individually.
Solution: Refactor a Spring Integration SubscribableChannel - Spring Tutorial
From the course: Spring: Spring Integration
Solution: Refactor a Spring Integration SubscribableChannel
(upbeat music) - [Instructor] Let's have a look now at one way to solve this refactoring code challenge. Starting in tech support.xml, where our channel is first configured, the first thing we need to do is instead of using the channel element from the Integration namespace, we need to use the PublishSubscribeChannel element. It's that simple. Now in our code references, we need to update the type that we're casting this reference to. So here in line 33, in the ViewService, instead of casting our resulting bean to a direct channel, we need to cast it to a PublishSubscribeChannel. The reason that works so handily for us is there in line 20, we have initialized our TechSupportChannel property to be an abstract subscribable channel, which is the parent of both PublishSubscribeChannels and direct channels. So it's just a simple matter of changing our cast there in line 33, and that does the trick. We have a similar…
Contents
-
-
-
-
(Locked)
Create a message in Spring Integration5m 16s
-
(Locked)
Create a channel in Spring Integration6m 32s
-
(Locked)
Choose the right channel for the job8m 48s
-
(Locked)
Challenge: Refactor a Spring Integration SubscribableChannel1m 7s
-
(Locked)
Solution: Refactor a Spring Integration SubscribableChannel2m 51s
-
(Locked)
-
-
-
-