Skip to content
This repository has been archived by the owner on Feb 8, 2019. It is now read-only.

Commit

Permalink
Add documentation for injection
Browse files Browse the repository at this point in the history
  • Loading branch information
matthieumorel committed Mar 7, 2013
1 parent cb3c58a commit bad1e51
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 0 deletions.
37 changes: 37 additions & 0 deletions website/content/doc/0.6.0/event_injection.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
---
title: Inject events into S4
---

> How do we inject events into S4?
# Problem statement
There is a data stream somewhere. We want to inject that data into our S4 stream processing application.

The data stream can be almost anything: user clicks in a web application, alarms in a monitoring system, stock trade operations, even static data from a database or a file server.

# Requirements
* We must be able to connect to that stream of data
* We must be able to chunk the data and isolate events out of it

# Solutions
Currently S4 does not provide a specific abstraction for a source of event or an external data stream. This means that the connection to an external data source can be implemented arbitrarily. Typically, connections to external data sources are initiated in the App object itself, in the `start()` method.

## In a single application
Let us consider a single S4 application. The App class is instantiated on each node (for instantiating the local topology), and this has to be taken in consideration.
For instance, if we get the information from the twitter sprinker stream, given that the stream is provided through a single socket connection, we should connect only from one node. To ensure that, leader election through ZooKeeper is an option, but a much simpler one is simply to base this decision on the id of the partition, provided in the `App` class by `getReceiver().getPartitionId()`. In our example, we would initiate the connection only if we are in partition 0.

~~~
#!java
~~~


## Using an adapter application

In some cases the above solution is not practical: it introduces some load imbalance between the partitions, and the extraction of the




1 change: 1 addition & 0 deletions website/content/doc/0.6.0/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ S4 (Simple Scalable Streaming System) is a general-purpose, distributed, scalabl
* [Customize the platform and pass configuration parameters](configuration)
* Add [application dependencies](application_dependencies)
* [Dispatch events ](event_dispatch) within an application and between applications
* [Inject events](event_injection) into S4 applications

## Running S4
* [Commands](tools) for creating, running and managing applications
Expand Down

0 comments on commit bad1e51

Please sign in to comment.