|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.s4.core.Stream<T>
public class Stream<T extends Event>
Stream
and ProcessingElement
objects represent the links and nodes in the application graph. A stream
sends an Event
object to ProcessingElement
instances located anywhere in a cluster.
Once a stream is instantiated, it is immutable.
To build an application, create stream objects using relevant methods in the App
class.
Field Summary | |
---|---|
protected Key<T> |
key
|
protected java.util.concurrent.BlockingQueue<EventMessage> |
queue
|
Constructor Summary | |
---|---|
Stream(App app)
Send events using a KeyFinder . |
Method Summary | |
---|---|
void |
close()
Stop and close this stream. |
App |
getApp()
|
Key<T> |
getKey()
|
java.lang.String |
getName()
|
Receiver |
getReceiver()
|
Sender |
getSender()
|
ProcessingElement[] |
getTargetPEs()
|
void |
put(Event event)
Sends an event. |
void |
receiveEvent(EventMessage event)
The low level Receiver object call this method when a new Event is available. |
Stream<T> |
register()
|
void |
run()
|
Stream<T> |
setKey(KeyFinder<T> keyFinder)
Define the key finder for this stream. |
Stream<T> |
setKey(java.lang.String keyName)
Define the key finder for this stream using a descriptor. |
Stream<T> |
setName(java.lang.String name)
Name the stream. |
Stream<T> |
setPE(ProcessingElement pe)
Send events from this stream to a PE. |
Stream<T> |
setPEs(ProcessingElement[] pes)
Send events from this stream to various PEs. |
void |
start()
Starting the stream starts the associated dequeuing thread. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected Key<T extends Event> key
protected final java.util.concurrent.BlockingQueue<EventMessage> queue
Constructor Detail |
---|
public Stream(App app)
KeyFinder
. The key finder extracts the value of the key which is used to determine
the target ClusterNode
for an event.
app
- we always register streams with the parent application.Method Detail |
---|
public void start()
Streamable
start
in interface Streamable
public Stream<T> setName(java.lang.String name)
name
- the stream name, default is an empty string.
public Stream<T> setKey(KeyFinder<T> keyFinder)
keyFinder
- a function to lookup the value of the key.
public Stream<T> setKey(java.lang.String keyName)
keyName
- a descriptor to lookup up the value of the key.
public Stream<T> setPE(ProcessingElement pe)
pe
- a target PE.
public Stream<T> setPEs(ProcessingElement[] pes)
pes
- a target PE array.
public void put(Event event)
put
in interface Streamable
event
- public void receiveEvent(EventMessage event)
Receiver
object call this method when a new Event
is available.
public java.lang.String getName()
getName
in interface Streamable
public Key<T> getKey()
public App getApp()
public ProcessingElement[] getTargetPEs()
public void close()
close
in interface Streamable
public Sender getSender()
public Receiver getReceiver()
public void run()
run
in interface java.lang.Runnable
public Stream<T> register()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |