https://github.com/streamr-dev/streamr-flink
Streamr integration library for Apache Flink
https://github.com/streamr-dev/streamr-flink
Last synced: 3 months ago
JSON representation
Streamr integration library for Apache Flink
- Host: GitHub
- URL: https://github.com/streamr-dev/streamr-flink
- Owner: streamr-dev
- License: apache-2.0
- Created: 2019-09-16T11:35:21.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2019-09-16T12:18:52.000Z (over 6 years ago)
- Last Synced: 2025-03-16T03:45:44.892Z (about 1 year ago)
- Language: Java
- Size: 8.79 KB
- Stars: 0
- Watchers: 4
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Streamr Integeration library for Apache Flink
## How to use
Add this to your pom-xml file:
```
com.streamr.labs
streamr_flink
0.1
```
Import the Streamr subscriber or publisher for Flink with:
```
import com.streamr.labs.streamr_flink.StreamrPublish;
import com.streamr.labs.streamr_flink.StreamrSubscribe;
```
Example code:
``` java
final StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();
StreamrSubscribe streamrSub = new StreamrSubscribe("YOUR_STREAMR_API_KEY", "YOUR_SUB_STREAM_ID");
StreamrPublish streamPub = new StreamrPublish("YOUR_STREAMR_APIKEY", "YOUR_PUB_STREAM_ID");
DataStreamSource> tramDataSource = env.addSource(streamrSub);
// Filter the 6T trams.
DataStream> stream = tramDataSource.filter(new FilterFunction>() {
@Override
public boolean filter(Map s) throws Exception {
return (s.containsKey("desi") && s.get("desi").toString().contains("6"));
}
});
// Add the publish sink
stream.print();
stream.addSink(streamPub);
env.execute("Trams");
```
For more info go to https://github.com/streamr-dev/streamr-apache-flink-integration