Browse Source

Setup basic skeleton for project

master
Brett Langdon 14 years ago
commit
d2dab2fba1
5 changed files with 128 additions and 0 deletions
  1. +9
    -0
      .gitignore
  2. +8
    -0
      LICENSE
  3. +5
    -0
      README.md
  4. +41
    -0
      build.xml
  5. +65
    -0
      src/com/blangdon/flume/kestrel/KestrelSink.java

+ 9
- 0
.gitignore View File

@ -0,0 +1,9 @@
*.class
# Package Files #
*.jar
*.war
*.ear
*#*#
*~

+ 8
- 0
LICENSE View File

@ -0,0 +1,8 @@
The MIT License (MIT)
Copyright (c) 2012 Brett Langdon
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

+ 5
- 0
README.md View File

@ -0,0 +1,5 @@
Flume Kestrel Plugin
=======
## Overview
This plugins provides a Sink to be able to send events from Cloudera's Flume v0.9.4 to a Kestrel server.

+ 41
- 0
build.xml View File

@ -0,0 +1,41 @@
<?xml version="1.0"?>
<project name="flume-kestrel" default="jar">
<property name="javac.debug" value="on"/>
<property name="flume.base" value="/usr/lib/flume"/>
<path id="classpath">
<!-- in case we are running in dev env -->
<pathelement location="${flume.base}/build/classes"/>
<fileset dir="${flume.base}/lib">
<include name="**/google-collect*.jar" />
<include name="**/guava*.jar" />
<include name="**/log4j-*.jar" />
<include name="**/slf4j-*.jar" />
</fileset>
<!-- in case we are running in release env -->
<fileset dir="${flume.base}/lib">
<include name="flume-*.jar" />
<include name="krestrel/*.jar" />
</fileset>
<pathelement location="${flume.base}/lib/"/>
</path>
<target name="jar">
<mkdir dir="build"/>
<mkdir dir="build/classes"/>
<javac srcdir="./src/com/blangdon/flume/krestrel" destdir="build/classes" debug="${javac.debug}">
<classpath refid="classpath"/>
</javac>
<jar jarfile="flume-krestrel.jar" basedir="build/classes"/>
</target>
<target name="clean">
<echo message="Cleaning generated files and stuff"/>
<delete dir="build" />
<delete file="flume-krestrel.jar" />
</target>
</project>

+ 65
- 0
src/com/blangdon/flume/kestrel/KestrelSink.java View File

@ -0,0 +1,65 @@
package com.blangdon.flume.Kestrel;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import com.cloudera.flume.conf.Context;
import com.cloudera.flume.conf.SinkFactory.SinkBuilder;
import com.cloudera.flume.core.Event;
import com.cloudera.flume.core.EventSink;
import com.cloudera.util.Pair;
import com.google.common.base.Preconditions;
/**
* Sink that sends events to HornetQ queue
*/
public class KestrelSink extends EventSink.Base {
public KestrelSink(){
//constructor
}
@Override
public void open() throws IOException {
// Initialized the sink
}
@Override
public void append(Event e) throws IOException {
//send to Kestrel
}
@Override
public void close() throws IOException {
// Cleanup
}
public static SinkBuilder builder() {
return new SinkBuilder() {
// construct a new parameterized sink
@Override
public EventSink build(Context context, String... argv) {
Preconditions.checkArgument(argv.length > 1,
"usage: kestrelSink(queueName, server:port, [server2:port, server3:port,...])");
return new KestrelSink();
}
};
}
/**
* This is a special function used by the SourceFactory to pull in this class
* as a plugin sink.
*/
public static List<Pair<String, SinkBuilder>> getSinkBuilders() {
List<Pair<String, SinkBuilder>> builders =
new ArrayList<Pair<String, SinkBuilder>>();
builders.add(new Pair<String, SinkBuilder>("kestrelSink", builder()));
return builders;
}
}

Loading…
Cancel
Save