Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.

  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

5. Transformers > Custom Transformers

Custom Transformers

Now that we have seen out-of-the-box transformers, it is time to see how we can create our own Transformers should the need arise.

Let us look at an example of a TradePublisher that will produce Trade messages with a Trade POJO as a payload. In the example, the consumer is not interested in receiving a Java Object but is expecting a name-value paired map. Can we tweak the TradePublisher to produce the Trade data compatible with that of a receiver? Yes, we can, but what if we have another receiver that may come up a few weeks later and be interested in consuming XML-formatted Trade messages?

Ideally, the producers should be unaware of consumers or their requirements. They only talk via an intermediary called message. This enables the applications to be decoupled, too. Our TradePublisher produces the Trades in a universal format—a POJO.


  

You are currently reading a PREVIEW of this book.

                                                                                                                    

Get instant access to over $1 million worth of books and videos.

  

Start a Free Trial


  
  • Safari Books Online
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint