Streampipes function
StreamPipesFunction(function_definition=None)
¶
Bases: ABC
Abstract implementation of a StreamPipesFunction.
A StreamPipesFunction allows users to get the data of a StreamPipes data streams easily. It makes it possible to work with the live data in python and enables to use the powerful data analytics libraries there.
PARAMETER | DESCRIPTION |
---|---|
function_definition |
The definition of the function that contains metadata about the connected function
TYPE:
|
ATTRIBUTE | DESCRIPTION |
---|---|
output_collectors |
List of all output collectors which are created based on the provided function definitions.
TYPE:
|
add_output(stream_id, event)
¶
Send an event via an output data stream to StreamPipes.
PARAMETER | DESCRIPTION |
---|---|
stream_id |
The id of the output data stream
TYPE:
|
event |
The event which should be sent
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
None
|
|
getFunctionId()
¶
Returns the id of the function.
RETURNS | DESCRIPTION |
---|---|
function_id
|
Identification object of the StreamPipes function
TYPE:
|
onEvent(event, streamId)
abstractmethod
¶
Is called for every event of a data stream.
PARAMETER | DESCRIPTION |
---|---|
event |
The received event from the data stream.
TYPE:
|
streamId |
The id of the data stream which the event belongs to.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
None
|
|
onServiceStarted(context)
abstractmethod
¶
Is called when the function is started.
PARAMETER | DESCRIPTION |
---|---|
context |
The context in which the function is started.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
None
|
|
onServiceStopped()
abstractmethod
¶
Is called when the function is stopped.
RETURNS | DESCRIPTION |
---|---|
None
|
|
requiredStreamIds()
¶
Get the ids of the streams needed by the function.
RETURNS | DESCRIPTION |
---|---|
stream_ids
|
List of the stream ids
TYPE:
|
stop()
¶
Stops the function and disconnects from the output streams.