February 2015
Intermediate to advanced
198 pages
4h 17m
English
Spring does not restrict us to use the transformer provided by the framework, we can define our own transformer and it's pretty straightforward. All we need to do is to define a Java class, which takes a particular input type, coverts it to an expected format and puts it onto the output channel. Let's take an example where we want to convert our feed in a format that can be written to DB; we can define a class, which takes a Message payload of type com.sun.syndication.feed.synd.SyndEntry and converts it to com.cpandey.siexample.pojo.SoFeed, which is a JPA entity:
import com.cpandey.siexample.pojo.SoFeed; import com.sun.syndication.feed.synd.SyndEntry; public class SoFeedDbTransformer { publicSoFeedtransformFeed(Message<SyndEntry> ...Read now
Unlock full access