Parsing a common Internet data format

You can configure a Destination object to return a Java® object that contains data parsed from a standard format, such as JSON. To retrieve the data structure in a Java object, you should:
  1. Specify a MessageProcessor object when you invoke DestinationFactory.create...().
  2. Retrieve the response from your Destination.
  3. Extract the data from the Message object that is returned in the response.

Code sample

The following code sample demonstrates the three actions that are required to retrieve a Java object that contains a JSON data structure.


// Specify a MessageProcessor when you create your Destination
BlockingSenderDestination bsd = DestinationFactory(myContext, myURI,
                          new JSONMessageProcessor());

// Retrieve the response
Message response = bsd.sendReceive();

// Extract the Java object that contains the JSON data structure
Object payload = response.getObjectPayload();

Was this information helpful? Send us your comments.