After you have imported and partially set up this sample, then performed the appropriate setup instructions, you can run the sample by following the instructions in the Running the sample section below.
This topic also includes an example input test message and a corresponding output message, so that you can confirm that the sample has worked.
The test message used in running this sample is based on the following format:
<googleapinode>
<key>................................</key>
<querystring>What is the time in Australia?</querystring>
</googleapinode>
where the field <key> contains the alphanumeric key obtained via e-mail by registering for the Google API (see Setup instructions), and the field <querystring> contains the string to search for.
This sample uses the message flow GoogleAPINodeFlow. It contains one input queue called JAVACOMPUTE.GOOGLE.IN, and the message flow can transform and route the message to one of two output queues (JAVACOMPUTE.GOOGLE.OUT and JAVACOMPUTE.GOOGLE.FAILURE).
To run the sample:
If all the steps above have worked then the sample is complete. Take a look at the Java code in the message flow GoogleAPINodeFlow to see how the message transformation was achieved.
The output message from the sample should have the following format:
<googlesearchresult>
<resultelement>
<url>...</url>
<title>...</title>
<snippet>...</snippet>
<summary>...</summary>
</resultelement>
<resultelement>
<url>...</url>
<title>...</title>
<snippet>...</snippet>
<summary>...</summary>
</resultelement>
...
</googlesearchresult>