Wikimedia EventStreams Adapter Sample

Introduction

This topic describes how to run the sample application for the StreamBase® Wiki EventStreams Adapter, and demonstrate the processing of continuous streams of structured event data from EventStreams web service.

The sample, wikiSample.sbapp, demonstrates a complete process of parsing EventStreams and how to use the Control Port to control the connection and disconnection of streams.

Importing This Sample into StreamBase Studio

In StreamBase Studio, import this sample with the following steps:

  • From the top-level menu, select File>Import Samples and Community Content.

  • Enter Wiki to narrow the list of options.

  • Select Wikimedia EventStreams Adapter from the StreamBase Standard Adapters category.

  • Click Import Now.

StreamBase Studio creates a single project for the wiki adapter samples in your current Studio workspace.

Running the wiki Sample in StreamBase Studio

Run this sample in Studio as follows:

  1. In the Project Explorer view, open the sample you just loaded.

  2. Double-click to open the wikiSample.sbapp application.

  3. Make sure the application is the currently active tab in the EventFlow Editor, then click the Run button. This opens the SB Test/Debug perspective and starts the application.

  4. In the Output Streams view, look for different output streams.

  5. When done, press F9 or click the Stop Running Application button.

Control Port

Description

Use the control port is used to send action commands to the adapter. Tuples enqueued on this port cause the adapter to connect or disconnect to certain EventStream, and can control the data starting point.

Control Port Schema

  • Command, string, the command to send to the adapter.

    The values are:

    • Connect — Tells the adapter to connect to the URI specified in the input tuple.

    • Disconnect — Tells the adapter to disconnect from the URI specified in the input tuple (if a connection to that URI already exists).

  • EventStreamName, string. The EventStream Name to connect to.

    The values are:

    • page-create

    • page-move

    • page-delete

    • recentchange

    • revision-create

    • page-undelete

    • page-properties-change

  • Since, string.

    • If given, this timestamp will be used as the historical starting position in each the requested streams.

Sample Location

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_adapter_embedded_wiki

See Default Installation Directories for the default location of studio-workspace on your system.

streambase-install-dir/sample/adapter/embedded/wiki