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

Built-In Transformers > Serializing and Deserializing Transformers

Serializing and Deserializing Transformers

Readers familiar with Java Message Service (JMS) will know that the messages must be serialized and deserialized when sent or received, respectively. The Payload Serializing transformer transforms a POJO to a byte array. It is represented below by payload-serializing-transformer:

<int:payload-serializing-transformer 
  input-channel="trades-in-channel" 
  output-channel="trades-out-channel">

</int:payload-serializing-transformer>

When a SerializableTrade is published onto the trades-in-channel, the transformer picks and converts the payload to bytes. The deserializing transformer is then used to read the bytes back to SerializableTrade.

The deserializing transformer works in exactly the opposite manner as its counterpart by deserializing the serialized payload to a POJO message. It is represented by payload-deserializing-transformer and reads a byte array. The following snippet demonstrates a deserializing transformer printing out the toString() of SerializableTrade onto the console by picking up the bytes from the trades-out-channel, the output channel of the Serializing Transformer.


  

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