Testing Streams connections

[Back to InfoSphere Streams]

1) In the previous section  step 6 involved creating a new composite, which has not been populated yet.

2) In the SPL graphical editor, add the public composite that was defined in step 11 as well as a ‘Custom as Sink’ operator to the composite canvas.BasicCanvas

3) Link them up

BasicCanvas2

4) Save and then right click -> Edit with SPL Editor (if not then the code will not reflect the state of the graphical editor.

5) Match the data type and the links to that defined in the TwitterConnector composite, add the printString line to the Custom operator so that the [text] component of the input stream will be printed to the console:
stream<completeTwitterStream> TwitterConnector_1_out0 =
TwitterConnector()
{
}


() as Custom_2 = Custom(TwitterConnector_1_out0)
{
logic
onTuple inputStream :
{
printString("The tweet is " + TwitterConnector_1_out0.text);
}
}

6) Save and then right click on the corresponding namespace/application entry in the project explorer -> select new -> standalone build

standAloneBuild

7) Right click on the  standalone build configuration and select build

8) Once complete, right click again on the standalone build and select Launch, select Apply then Launch:

configLaunch

9) Wait for a few seconds as the connection is established. The console will then be populated with a real time sample of the tweets coming through the website:

console

10) So there we have it! An infinite stream of tweets for you to play around with!

[Back to InfoSphere Streams]

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s