Contents
This sample demonstrates the use of the TIBCO StreamBase® Twitter input and output adapters. This sample demonstrates listening to the current user's Twitter stream; other streams are available.
In StreamBase Studio, import this sample with the following steps:
-
From the top-level menu, select
> . -
Enter
tw
to narrow the list of options. -
Select Twitter adapter from the StreamBase Standard Adapters category.
-
Click
.
StreamBase Studio creates a single project containing the sample files.
Edit the streambase.conf
file in the src/main/configurations
folder to add these four required values:
Please view the documentation on how to get OAuth credentials for Twitter API described in TIBCO StreamBase® Twitter Input Adapter:
-
consumerKey
-
consumerSecret
-
accessToken
-
accessTokenSecret
You must also configure the sample with appropriate OAuth tokens. See Twitter Input Adapter for instructions.
-
In the Project Explorer view, open the sample you just loaded.
If you see red marks on a project folder, wait a moment for the project to load its features.
If the red marks do not resolve themselves after a minute, select the project, right-click, and select
> from the context menu. -
Open the
src/main/eventflow/
folder.packageName
-
Open the
Twitter.sbapp
file and click the Run button. This opens the SB Test/Debug perspective and starts the module. -
In the Manual Input view, switch the stream to
ControlInput
, enteruser
into theCommand
field and then click to send the control tuple. -
In the Output Streams view, observe the
InputStatus
tuple which gives details about the connection to the User stream which this sample starts by default on application start up. -
In the Manual Input view, switch the stream to
ControlOutput
, entertweet
into theCommand
field and then a short status into theTweet\Status
field and then click to send the control tuple. -
In the Output Streams view, observe tuples emitted on the
OutputStatus
andTweets
output streams. -
Select the tuple emitted from the
Tweets
stream, then use the triangles next to the data fields displayed to analyze and understand their structure. -
Experiment with other commands on the
ControlOutput
andControlInput
streams as shown by notes included in the module. -
Press F9 or click the Terminate EventFlow Fragment button.
When you load the sample into StreamBase Studio, Studio copies the sample project's files to your Studio workspace, which is normally part of your home directory, with full access rights.
Important
Load this sample in StreamBase Studio, and thereafter use the Studio workspace copy of the sample to run and test it, even when running from the command prompt.
Using the workspace copy of the sample avoids permission problems. The default workspace location for this sample is:
studio-workspace
/sample_twitter
See Default Installation Directories for the default location of studio-workspace
on your system.