@@ -456,7 +456,7 @@ An abstract class providing an interface for receiving data from Kafka. By imple
* Write a deserializer function which processes the data coming from Kafka,
* Stop the source manually when necessary with one of the close functions.
The implemented class must extend `KafkaSource`, for example: `KafkaSource<Tuple1<String>>`.
The implemented class must extend `KafkaSource`, for example: `KafkaSource<String>`.
##### Constructor
An example of an implementation of a constructor:
...
...
@@ -472,12 +472,12 @@ An example of an implementation of a deserializer:
~~~java
@Override
publicTuple1<String>deserialize(byte[]msg){
publicStringdeserialize(byte[]msg){
Strings=newString(msg);
if(s.equals("q")){
closeWithoutSend();
}
returnnewTuple1<String>(s);
returnnewString(s);
}
~~~
...
...
@@ -494,7 +494,7 @@ An abstract class providing an interface for sending data to Kafka. By implement
* Write a serializer function to send data in the desired form to Kafka,
* Stop the sink manually when necessary with one of the close functions.
The implemented class must extend `KafkaSink`, for example `KafkaSink<Tuple1<String>, String>`.
The implemented class must extend `KafkaSink`, for example `KafkaSink<String, String>`.
##### Constructor
An example of an implementation of a constructor:
...
...
@@ -510,11 +510,11 @@ An example of an implementation of a serializer:
~~~java
@Override
publicStringserialize(Tuple1<String>tuple){
if(tuple.f0.equals("q")){
publicStringserialize(Stringtuple){
if(tuple.equals("q")){
sendAndClose();
}
returntuple.f0;
returntuple;
}
~~~
...
...
@@ -524,8 +524,8 @@ The API provided is the [same](#kafka_source_close) as the one for `KafkaSource`
#### Building A Topology
To use a Kafka connector as a source in Flink call the `addSource()` function with a new instance of the class which extends `KafkaSource` as parameter:
@@ -567,7 +567,7 @@ An abstract class providing an interface for receiving data from Flume. By imple
* Write a deserializer function which processes the data coming from Flume,
* Stop the source manually when necessary with one of the close functions.
The implemented class must extend `FlumeSource` for example: `FlumeSource<Tuple1<String>>`
The implemented class must extend `FlumeSource` for example: `FlumeSource<String>`
##### Constructor
An example of an implementation of a constructor:
...
...
@@ -583,10 +583,9 @@ An example of an implementation of a deserializer:
~~~java
@Override
publicTuple1<String>deserialize(byte[]msg){
public String deserialize(byte[] msg) {
String s = (String) SerializationUtils.deserialize(msg);
Tuple1<String>out=newTuple1<String>();
out.f0=s;
String out = s;
if (s.equals("q")) {
closeWithoutSend();
}
...
...
@@ -607,7 +606,7 @@ An abstract class providing an interface for sending data to Flume. By implement
* Write a serializer function to send data in the desired form to Flume,
* Stop the sink manually when necessary with one of the close functions.
The implemented class must extend `FlumeSink`, for example `FlumeSink<Tuple1<String>, String>`.
The implemented class must extend `FlumeSink`, for example `FlumeSink<String, String>`.
##### Constructor
An example of an implementation of a constructor:
...
...
@@ -623,8 +622,8 @@ An example of an implementation of a serializer.
~~~java
@Override
publicbyte[]serialize(Tuple1<String>tuple){
if(tuple.f0.equals("q")){
public byte[] serialize(String tuple) {
if (tuple.equals("q")) {
try {
sendAndClose();
} catch (Exception e) {
...
...
@@ -632,7 +631,7 @@ public byte[] serialize(Tuple1<String> tuple) {
+ host, e);
}
}
returnSerializationUtils.serialize(tuple.f0);
return SerializationUtils.serialize(tuple);
}
~~~
...
...
@@ -642,8 +641,8 @@ The API provided is the [same](#flume_source_close) as the one for `FlumeSource`
#### Building A Topology
To use a Flume connector as a source in Flink call the `addSource()` function with a new instance of the class which extends `FlumeSource` as parameter:
~~~java
DataStream<Tuple1<String>>dataStream1=env
```java
DataStream<String> dataStream1 = env
.addSource(new MyFlumeSource("localhost", 41414))
.print();
~~~
...
...
@@ -655,8 +654,8 @@ The followings have to be provided for the `MyFlumeSource()` constructor in orde
Similarly to use a Flume connector as a sink in Flink call the `addSink()` function with a new instance of the class which extends `FlumeSink`
sudo docker run -p 127.0.0.1:5672:5672 -t -i flinkstreaming/flink-connectors-rabbitmq
~~~
Now a terminal started running from the image with all the necessary configurations to test run the RabbitMQ connector. The -p flag binds the localhost's and the Docker container's port so RabbitMQ can communicate with the application through this.
Now a terminal started running from the image with all the necessary configurations to test run the RabbitMQ connector. The -p flag binds the localhost's and the Docker container's ports so RabbitMQ can communicate with the application through these.
Now a terminal started running from the image with all the necessary configurations to test run the Kafka connector. The -p flag binds the localhost's and the Docker container's port so Kafka can communicate with the application through this.
Now a terminal started running from the image with all the necessary configurations to test run the Kafka connector. The -p flag binds the localhost's and the Docker container's ports so Kafka can communicate with the application through these.
First start a zookeeper in the background:
~~~batch
...
...
@@ -931,7 +929,7 @@ To run the container type:
sudo docker run -t -i flinkstreaming/flink-connectors-flume
~~~
Now a terminal started running from the image with all the necessary configurations to test run the Flume connector. The -p flag binds the localhost's and the Docker container's port so flume can communicate with the application through this.
Now a terminal started running from the image with all the necessary configurations to test run the Flume connector. The -p flag binds the localhost's and the Docker container's ports so flume can communicate with the application through these.