Beyond default transformers

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> ...

Get Spring Integration Essentials now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.