Database Reference
In-Depth Information
Thrift Sink
The Thrift sink is largely identical to the Avro sink. It also requires a
hostname and a port and can be controlled with the same timeout behavior.
However, it does not support Avro's compression or security features:
agent_1.sinks.sink-1.type= thrift
agent_1.sinks.sink-1.hostname= localhost
agent_1.sinks.sink-1.port= 4141
Implementing Custom Sinks
When communicating with stream processing software, it may be necessary
to implement a custom sink. The process for implementing a custom sink
is similar to that for implementing a custom source. The custom sink class
extends the AbstractSink class and optionally implements the
Configurable interface.
The following example implements a Redis sink to match the Redis source
from earlier in the chapter. Rather than subscribing to a publish-subscribe
channel, the Redis sink publishes events to the channel. Thus, the
implementation begins with the same configuration as the Redis source:
public class RedisSink extends AbstractSink implements
Configurable {
String redisHost;
int redisPort;
String redisChannel;
Jedis jedis;
public void configure(Context context) {
redisHost = context.getString("redis-host",
"localhost");
redisPort = context.getInteger("redis-port",
6379);
redisChannel = context.getString("redis-channel",
"flume");
}
The start and stop methods are simpler in the implementation of the
sink because the process does not need to be asynchronous to the primary
thread:
Search WWH ::




Custom Search