You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nifi.apache.org by mc...@apache.org on 2015/07/14 23:17:19 UTC

[01/13] incubator-nifi git commit: Moved the source/sink stoppign to @OnStopped methods

Repository: incubator-nifi
Updated Branches:
  refs/heads/develop 483b3dddf -> 6f3039c8c


Moved the source/sink stoppign to @OnStopped methods

* Made the spoolDirectory test stronger

Signed-off-by: Matt Gilman <ma...@gmail.com>


Project: http://git-wip-us.apache.org/repos/asf/incubator-nifi/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-nifi/commit/c4dd1e65
Tree: http://git-wip-us.apache.org/repos/asf/incubator-nifi/tree/c4dd1e65
Diff: http://git-wip-us.apache.org/repos/asf/incubator-nifi/diff/c4dd1e65

Branch: refs/heads/develop
Commit: c4dd1e65b1be905dc712f1907ff1156e60d02a79
Parents: 3af73c9
Author: Joey Echeverria <jo...@gmail.com>
Authored: Wed Jun 10 14:18:42 2015 -0700
Committer: Matt Gilman <ma...@gmail.com>
Committed: Tue Jul 14 14:50:16 2015 -0400

----------------------------------------------------------------------
 .../processors/flume/FlumeSinkProcessor.java    |  9 ++++---
 .../processors/flume/FlumeSourceProcessor.java  | 25 ++++++--------------
 .../flume/FlumeSourceProcessorTest.java         | 24 +++++++++++++++----
 3 files changed, 31 insertions(+), 27 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/c4dd1e65/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/src/main/java/org/apache/nifi/processors/flume/FlumeSinkProcessor.java
----------------------------------------------------------------------
diff --git a/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/src/main/java/org/apache/nifi/processors/flume/FlumeSinkProcessor.java b/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/src/main/java/org/apache/nifi/processors/flume/FlumeSinkProcessor.java
index e385921..9ec1b07 100644
--- a/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/src/main/java/org/apache/nifi/processors/flume/FlumeSinkProcessor.java
+++ b/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/src/main/java/org/apache/nifi/processors/flume/FlumeSinkProcessor.java
@@ -28,7 +28,7 @@ import org.apache.flume.conf.Configurables;
 import org.apache.nifi.annotation.documentation.CapabilityDescription;
 import org.apache.nifi.annotation.documentation.Tags;
 import org.apache.nifi.annotation.lifecycle.OnScheduled;
-import org.apache.nifi.annotation.lifecycle.OnUnscheduled;
+import org.apache.nifi.annotation.lifecycle.OnStopped;
 
 import org.apache.nifi.components.PropertyDescriptor;
 import org.apache.nifi.components.Validator;
@@ -124,15 +124,14 @@ public class FlumeSinkProcessor extends AbstractFlumeProcessor {
         }
     }
 
-    @OnUnscheduled
-    public void unScheduled() {
+    @OnStopped
+    public void stopped() {
         sink.stop();
         channel.stop();
     }
 
     @Override
-    public void onTrigger(final ProcessContext context,
-            final ProcessSession session) throws ProcessException {
+    public void onTrigger(final ProcessContext context, final ProcessSession session) throws ProcessException {
 
         channel.setSession(session);
         try {

http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/c4dd1e65/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/src/main/java/org/apache/nifi/processors/flume/FlumeSourceProcessor.java
----------------------------------------------------------------------
diff --git a/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/src/main/java/org/apache/nifi/processors/flume/FlumeSourceProcessor.java b/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/src/main/java/org/apache/nifi/processors/flume/FlumeSourceProcessor.java
index 3ded208..1ebf05c 100644
--- a/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/src/main/java/org/apache/nifi/processors/flume/FlumeSourceProcessor.java
+++ b/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/src/main/java/org/apache/nifi/processors/flume/FlumeSourceProcessor.java
@@ -33,7 +33,6 @@ import org.apache.nifi.annotation.documentation.CapabilityDescription;
 import org.apache.nifi.annotation.documentation.Tags;
 import org.apache.nifi.annotation.lifecycle.OnScheduled;
 import org.apache.nifi.annotation.lifecycle.OnStopped;
-import org.apache.nifi.annotation.lifecycle.OnUnscheduled;
 
 import org.apache.nifi.components.PropertyDescriptor;
 import org.apache.nifi.components.Validator;
@@ -93,7 +92,6 @@ public class FlumeSourceProcessor extends AbstractFlumeProcessor {
     private final AtomicReference<ProcessSessionFactory> sessionFactoryRef = new AtomicReference<>(null);
     private final AtomicReference<EventDrivenSourceRunner> runnerRef = new AtomicReference<>(null);
     private final AtomicReference<NifiSessionFactoryChannel> eventDrivenSourceChannelRef = new AtomicReference<>(null);
-    private final AtomicReference<Boolean> stopping = new AtomicReference<>(false);
 
     @Override
     protected void init(final ProcessorInitializationContext context) {
@@ -114,7 +112,6 @@ public class FlumeSourceProcessor extends AbstractFlumeProcessor {
     @OnScheduled
     public void onScheduled(final SchedulingContext context) {
         try {
-            stopping.set(false);
             source = SOURCE_FACTORY.create(
                 context.getProperty(SOURCE_NAME)
                 .getValue(),
@@ -142,9 +139,8 @@ public class FlumeSourceProcessor extends AbstractFlumeProcessor {
         }
     }
 
-    @OnUnscheduled
-    public void unScheduled() {
-        stopping.set(true);
+    @OnStopped
+    public void stopped() {
         if (source instanceof PollableSource) {
             source.stop();
         } else {
@@ -160,10 +156,6 @@ public class FlumeSourceProcessor extends AbstractFlumeProcessor {
                 eventDrivenSourceChannelRef.compareAndSet(eventDrivenSourceChannel, null);
             }
         }
-    }
-
-    @OnStopped
-    public void stopped() {
         sessionFactoryRef.set(null);
     }
 
@@ -176,14 +168,11 @@ public class FlumeSourceProcessor extends AbstractFlumeProcessor {
             if (old == null) {
                 runnerRef.set(new EventDrivenSourceRunner());
                 eventDrivenSourceChannelRef.set(new NifiSessionFactoryChannel(sessionFactoryRef.get(), SUCCESS));
-                eventDrivenSourceChannelRef.get()
-                    .start();
-                source.setChannelProcessor(new ChannelProcessor(new NifiChannelSelector(
-                    eventDrivenSourceChannelRef.get())));
-                runnerRef.get()
-                    .setSource(source);
-                runnerRef.get()
-                    .start();
+                eventDrivenSourceChannelRef.get().start();
+                source.setChannelProcessor(new ChannelProcessor(
+                    new NifiChannelSelector(eventDrivenSourceChannelRef.get())));
+                runnerRef.get().setSource(source);
+                runnerRef.get().start();
             }
         }
     }

http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/c4dd1e65/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/src/test/java/org/apache/nifi/processors/flume/FlumeSourceProcessorTest.java
----------------------------------------------------------------------
diff --git a/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/src/test/java/org/apache/nifi/processors/flume/FlumeSourceProcessorTest.java b/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/src/test/java/org/apache/nifi/processors/flume/FlumeSourceProcessorTest.java
index 32feb1e..bf32095 100644
--- a/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/src/test/java/org/apache/nifi/processors/flume/FlumeSourceProcessorTest.java
+++ b/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/src/test/java/org/apache/nifi/processors/flume/FlumeSourceProcessorTest.java
@@ -22,6 +22,7 @@ import java.io.IOException;
 import java.util.Collection;
 import java.util.HashSet;
 import java.util.List;
+import java.util.concurrent.TimeUnit;
 import org.apache.flume.sink.NullSink;
 import org.apache.flume.source.AvroSource;
 
@@ -126,9 +127,24 @@ public class FlumeSourceProcessorTest {
         runner.setProperty(FlumeSourceProcessor.SOURCE_TYPE, "spooldir");
         runner.setProperty(FlumeSinkProcessor.FLUME_CONFIG,
             "tier1.sources.src-1.spoolDir = " + spoolDirectory.getAbsolutePath());
-        runner.run();
-        // No data will be transfered because of how quickly the test runner
-        // starts shutting down
-        runner.assertTransferCount(FlumeSourceProcessor.SUCCESS, 0);
+        runner.run(1, false, true);
+        // Because the spool directory source is an event driven source, it may take some time for flow files to get
+        // produced. I'm willing to wait up to 5 seconds, but will bail out early if possible. If it takes longer than
+        // that then there is likely a bug.
+        int numWaits = 10;
+        while (runner.getFlowFilesForRelationship(FlumeSourceProcessor.SUCCESS).size() < 4 && --numWaits > 0) {
+            try {
+                TimeUnit.MILLISECONDS.sleep(500);
+            } catch (InterruptedException ex) {
+                logger.warn("Sleep interrupted");
+            }
+        }
+        runner.shutdown();
+        runner.assertTransferCount(FlumeSourceProcessor.SUCCESS, 4);
+        int i = 1;
+        for (MockFlowFile flowFile : runner.getFlowFilesForRelationship(FlumeSourceProcessor.SUCCESS)) {
+            flowFile.assertContentEquals("record " + i);
+            i++;
+        }
     }
 }


[03/13] incubator-nifi git commit: Added processors that can run Flume sources and Flume sinks.

Posted by mc...@apache.org.
Added processors that can run Flume sources and Flume sinks.

Signed-off-by: Matt Gilman <ma...@gmail.com>


Project: http://git-wip-us.apache.org/repos/asf/incubator-nifi/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-nifi/commit/b251ab44
Tree: http://git-wip-us.apache.org/repos/asf/incubator-nifi/tree/b251ab44
Diff: http://git-wip-us.apache.org/repos/asf/incubator-nifi/diff/b251ab44

Branch: refs/heads/develop
Commit: b251ab44258a840c5bacd973776b26dacbdbbbc2
Parents: 483b3dd
Author: Joey Echeverria <jo...@cloudera.com>
Authored: Wed Jan 28 16:30:49 2015 -0800
Committer: Matt Gilman <ma...@gmail.com>
Committed: Tue Jul 14 14:50:16 2015 -0400

----------------------------------------------------------------------
 .../nifi-flume-bundle/nifi-flume-nar/pom.xml    |  31 ++++
 .../nifi-flume-processors/pom.xml               | 126 +++++++++++++
 .../flume/AbstractFlumeProcessor.java           | 134 ++++++++++++++
 .../processors/flume/FlumeSinkProcessor.java    | 157 ++++++++++++++++
 .../processors/flume/FlumeSourceProcessor.java  | 178 +++++++++++++++++++
 .../nifi/processors/flume/NifiChannel.java      |  31 ++++
 .../processors/flume/NifiChannelSelector.java   |  55 ++++++
 .../nifi/processors/flume/NifiTransaction.java  |  40 +++++
 .../processors/flume/util/FlowFileEvent.java    | 114 ++++++++++++
 .../flume/util/FlowFileEventConstants.java      |  25 +++
 .../org.apache.nifi.processor.Processor         |  16 ++
 .../processors/flume/AbstractFlumeTest.java     |  35 ++++
 .../flume/FlumeSinkProcessorTest.java           | 154 ++++++++++++++++
 .../flume/FlumeSourceProcessorTest.java         | 140 +++++++++++++++
 .../src/test/resources/core-site-broken.xml     |  25 +++
 .../src/test/resources/core-site.xml            |  25 +++
 .../src/test/resources/testdata/records.txt     |   4 +
 nifi/nifi-nar-bundles/nifi-flume-bundle/pom.xml |  39 ++++
 nifi/nifi-nar-bundles/pom.xml                   |   1 +
 19 files changed, 1330 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/b251ab44/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-nar/pom.xml
----------------------------------------------------------------------
diff --git a/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-nar/pom.xml b/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-nar/pom.xml
new file mode 100644
index 0000000..c5333b6
--- /dev/null
+++ b/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-nar/pom.xml
@@ -0,0 +1,31 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+      http://www.apache.org/licenses/LICENSE-2.0
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+-->
+    <modelVersion>4.0.0</modelVersion>
+    <parent>
+        <groupId>org.apache.nifi</groupId>
+        <artifactId>nifi-flume-bundle</artifactId>
+        <version>0.0.1-incubating-SNAPSHOT</version>
+    </parent>
+    <artifactId>nifi-flume-nar</artifactId>
+    <version>0.0.1-incubating-SNAPSHOT</version>
+    <packaging>nar</packaging>
+    <dependencies>
+        <dependency>
+            <groupId>org.apache.nifi</groupId>
+            <artifactId>nifi-flume-processors</artifactId>
+        </dependency>
+    </dependencies>
+</project>

http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/b251ab44/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/pom.xml
----------------------------------------------------------------------
diff --git a/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/pom.xml b/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/pom.xml
new file mode 100644
index 0000000..54636ca
--- /dev/null
+++ b/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/pom.xml
@@ -0,0 +1,126 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <!--
+      Licensed to the Apache Software Foundation (ASF) under one or more
+      contributor license agreements.  See the NOTICE file distributed with
+      this work for additional information regarding copyright ownership.
+      The ASF licenses this file to You under the Apache License, Version 2.0
+      (the "License"); you may not use this file except in compliance with
+      the License.  You may obtain a copy of the License at
+          http://www.apache.org/licenses/LICENSE-2.0
+      Unless required by applicable law or agreed to in writing, software
+      distributed under the License is distributed on an "AS IS" BASIS,
+      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+      See the License for the specific language governing permissions and
+      limitations under the License.
+    -->
+    <modelVersion>4.0.0</modelVersion>
+    <parent>
+        <groupId>org.apache.nifi</groupId>
+        <artifactId>nifi-flume-bundle</artifactId>
+        <version>0.0.1-incubating-SNAPSHOT</version>
+    </parent>
+    <artifactId>nifi-flume-processors</artifactId>
+    <packaging>jar</packaging>
+    <dependencies>
+        <dependency>
+            <groupId>org.apache.nifi</groupId>
+            <artifactId>nifi-api</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.nifi</groupId>
+            <artifactId>nifi-utils</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.nifi</groupId>
+            <artifactId>nifi-processor-utils</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.nifi</groupId>
+            <artifactId>nifi-flowfile-packager</artifactId>
+        </dependency>
+        <dependency> 
+            <groupId>org.apache.flume</groupId> 
+            <artifactId>flume-ng-sdk</artifactId> 
+            <version>1.5.2</version>
+        </dependency> 
+        <dependency> 
+            <groupId>org.apache.flume</groupId> 
+            <artifactId>flume-ng-core</artifactId> 
+            <version>1.5.2</version>
+            <exclusions>
+                <exclusion>
+                    <groupId>org.slf4j</groupId>
+                    <artifactId>slf4j-log4j12</artifactId>
+                </exclusion>
+            </exclusions>
+        </dependency> 
+
+        <!-- Flume Sources -->
+        <dependency> 
+            <groupId>org.apache.flume.flume-ng-sources</groupId> 
+            <artifactId>flume-twitter-source</artifactId> 
+            <version>1.5.2</version>
+        </dependency> 
+        <dependency> 
+            <groupId>org.apache.flume.flume-ng-sources</groupId> 
+            <artifactId>flume-jms-source</artifactId> 
+            <version>1.5.2</version>
+        </dependency> 
+        <dependency> 
+            <groupId>org.apache.flume.flume-ng-sources</groupId> 
+            <artifactId>flume-scribe-source</artifactId> 
+            <version>1.5.2</version>
+        </dependency> 
+
+        <!-- Flume Sinks -->
+        <dependency> 
+            <groupId>org.apache.flume.flume-ng-sinks</groupId> 
+            <artifactId>flume-hdfs-sink</artifactId> 
+            <version>1.5.2</version>
+        </dependency> 
+
+        <!-- HDFS sink dependencies -->
+        <dependency> 
+            <groupId>org.apache.hadoop</groupId> 
+            <artifactId>hadoop-common</artifactId> 
+            <scope>provided</scope> 
+        </dependency> 
+        <dependency> 
+            <groupId>org.apache.hadoop</groupId> 
+            <artifactId>hadoop-hdfs</artifactId> 
+            <scope>provided</scope> 
+        </dependency>
+        
+        <dependency> 
+            <groupId>org.apache.flume.flume-ng-sinks</groupId> 
+            <artifactId>flume-irc-sink</artifactId> 
+            <version>1.5.2</version>
+        </dependency> 
+        <dependency> 
+            <groupId>org.apache.flume.flume-ng-sinks</groupId> 
+            <artifactId>flume-ng-elasticsearch-sink</artifactId> 
+            <version>1.5.2</version>
+        </dependency> 
+        <dependency> 
+            <groupId>org.apache.flume.flume-ng-sinks</groupId> 
+            <artifactId>flume-ng-hbase-sink</artifactId> 
+            <version>1.5.2</version>
+        </dependency> 
+        <dependency> 
+            <groupId>org.apache.flume.flume-ng-sinks</groupId> 
+            <artifactId>flume-ng-morphline-solr-sink</artifactId> 
+            <version>1.5.2</version>
+        </dependency> 
+
+        <dependency>
+            <groupId>org.apache.nifi</groupId>
+            <artifactId>nifi-mock</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+          <groupId>org.slf4j</groupId>
+          <artifactId>slf4j-simple</artifactId>
+          <scope>test</scope>
+        </dependency>
+    </dependencies>
+</project>

http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/b251ab44/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/src/main/java/org/apache/nifi/processors/flume/AbstractFlumeProcessor.java
----------------------------------------------------------------------
diff --git a/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/src/main/java/org/apache/nifi/processors/flume/AbstractFlumeProcessor.java b/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/src/main/java/org/apache/nifi/processors/flume/AbstractFlumeProcessor.java
new file mode 100644
index 0000000..5c608d5
--- /dev/null
+++ b/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/src/main/java/org/apache/nifi/processors/flume/AbstractFlumeProcessor.java
@@ -0,0 +1,134 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.nifi.processors.flume;
+
+import com.google.common.collect.Maps;
+import java.io.IOException;
+import java.io.OutputStream;
+import java.io.StringReader;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import java.util.Map;
+import java.util.Properties;
+import org.apache.flume.Context;
+import org.apache.flume.Event;
+import org.apache.flume.SinkFactory;
+import org.apache.flume.Source;
+import org.apache.flume.SourceFactory;
+import org.apache.flume.sink.DefaultSinkFactory;
+import org.apache.flume.source.DefaultSourceFactory;
+
+import org.apache.nifi.components.PropertyDescriptor;
+import org.apache.nifi.components.ValidationContext;
+import org.apache.nifi.components.ValidationResult;
+import org.apache.nifi.components.Validator;
+import org.apache.nifi.flowfile.FlowFile;
+import org.apache.nifi.processor.AbstractProcessor;
+import org.apache.nifi.processor.ProcessSession;
+import org.apache.nifi.processor.Relationship;
+import org.apache.nifi.processor.io.OutputStreamCallback;
+import static org.apache.nifi.processors.flume.FlumeSourceProcessor.FLUME_CONFIG;
+import org.apache.nifi.processors.flume.util.FlowFileEvent;
+
+/**
+ * This is a base class that is helpful when building processors interacting
+ * with Flume.
+ */
+public abstract class AbstractFlumeProcessor extends AbstractProcessor {
+  protected static final SourceFactory SOURCE_FACTORY = new DefaultSourceFactory();
+  protected static final SinkFactory SINK_FACTORY = new DefaultSinkFactory();
+
+  protected static Event flowFileToEvent(FlowFile flowFile, ProcessSession session) {
+    return new FlowFileEvent(flowFile, session);
+  }
+
+  protected static void transferEvent(final Event event, ProcessSession session,
+      Relationship relationship) {
+    FlowFile flowFile = session.create();
+    flowFile = session.putAllAttributes(flowFile, event.getHeaders());
+
+    flowFile = session.write(flowFile, new OutputStreamCallback() {
+      @Override
+      public void process(final OutputStream out) throws IOException {
+        out.write(event.getBody());
+      }
+    });
+
+    session.getProvenanceReporter().create(flowFile);
+    session.transfer(flowFile, relationship);
+  }
+
+  protected static Validator createSourceValidator() {
+    return new Validator() {
+      @Override
+      public ValidationResult validate(final String subject, final String value, final ValidationContext context) {
+        String reason = null;
+        try {
+          FlumeSourceProcessor.SOURCE_FACTORY.create("NiFi Source", value);
+        } catch (Exception ex) {
+          reason = ex.getLocalizedMessage();
+          reason = Character.toLowerCase(reason.charAt(0)) + reason.substring(1);
+        }
+        return new ValidationResult.Builder().subject(subject).input(value).explanation(reason).valid(reason == null).build();
+      }
+    };
+  }
+
+  protected static Validator createSinkValidator() {
+    return new Validator() {
+      @Override
+      public ValidationResult validate(final String subject, final String value, final ValidationContext context) {
+        String reason = null;
+        try {
+          FlumeSinkProcessor.SINK_FACTORY.create("NiFi Sink", value);
+        } catch (Exception ex) {
+          reason = ex.getLocalizedMessage();
+          reason = Character.toLowerCase(reason.charAt(0)) + reason.substring(1);
+        }
+        return new ValidationResult.Builder().subject(subject).input(value).explanation(reason).valid(reason == null).build();
+      }
+    };
+  }
+
+  protected static Context getFlumeContext(String flumeConfig, String prefix) {
+    Properties flumeProperties = new Properties();
+    if (flumeConfig != null) {
+      try {
+        flumeProperties.load(new StringReader(flumeConfig));
+      } catch (IOException ex) {
+        throw new RuntimeException(ex);
+      }
+    }
+    Map<String, String> parameters = Maps.newHashMap();
+    for (String property : flumeProperties.stringPropertyNames()) {
+      parameters.put(property, flumeProperties.getProperty(property));
+    }
+    return new Context(new Context(parameters).getSubProperties(prefix));
+  }
+
+  protected static Context getFlumeSourceContext(String flumeConfig,
+      String agentName, String sourceName) {
+    return getFlumeContext(flumeConfig, agentName + ".sources." + sourceName + ".");
+  }
+
+  protected static Context getFlumeSinkContext(String flumeConfig,
+      String agentName, String sinkName) {
+    return getFlumeContext(flumeConfig, agentName + ".sinks." + sinkName + ".");
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/b251ab44/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/src/main/java/org/apache/nifi/processors/flume/FlumeSinkProcessor.java
----------------------------------------------------------------------
diff --git a/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/src/main/java/org/apache/nifi/processors/flume/FlumeSinkProcessor.java b/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/src/main/java/org/apache/nifi/processors/flume/FlumeSinkProcessor.java
new file mode 100644
index 0000000..4603d18
--- /dev/null
+++ b/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/src/main/java/org/apache/nifi/processors/flume/FlumeSinkProcessor.java
@@ -0,0 +1,157 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.nifi.processors.flume;
+
+import com.google.common.base.Throwables;
+import com.google.common.collect.ImmutableList;
+import com.google.common.collect.ImmutableSet;
+import java.util.List;
+import java.util.Set;
+import org.apache.flume.Context;
+import org.apache.flume.EventDeliveryException;
+import org.apache.flume.Sink;
+import org.apache.flume.Transaction;
+import org.apache.flume.channel.MemoryChannel;
+import org.apache.flume.conf.Configurables;
+
+import org.apache.nifi.components.PropertyDescriptor;
+import org.apache.nifi.components.Validator;
+import org.apache.nifi.flowfile.FlowFile;
+import org.apache.nifi.processor.ProcessContext;
+import org.apache.nifi.processor.ProcessSession;
+import org.apache.nifi.processor.ProcessorInitializationContext;
+import org.apache.nifi.processor.Relationship;
+import org.apache.nifi.processor.SchedulingContext;
+import org.apache.nifi.processor.annotation.CapabilityDescription;
+import org.apache.nifi.processor.annotation.OnScheduled;
+import org.apache.nifi.processor.annotation.OnUnscheduled;
+import org.apache.nifi.processor.annotation.Tags;
+import org.apache.nifi.processor.exception.ProcessException;
+import org.apache.nifi.processor.util.StandardValidators;
+import org.apache.nifi.processors.flume.util.FlowFileEvent;
+
+/**
+ * This processor runs a Flume sink 
+ */
+@Tags({"flume", "hadoop", "get", "sink" })
+@CapabilityDescription("Generate FlowFile data from a Flume sink")
+public class FlumeSinkProcessor extends AbstractFlumeProcessor {
+
+  private Sink sink;
+  private MemoryChannel channel;
+
+  public static final PropertyDescriptor SINK_TYPE = new PropertyDescriptor.Builder()
+      .name("Sink Type")
+      .description("The fully-qualified name of the Sink class")
+      .required(true)
+      .addValidator(createSinkValidator())
+      .build();
+  public static final PropertyDescriptor AGENT_NAME = new PropertyDescriptor.Builder()
+      .name("Agent Name")
+      .description("The name of the agent used in the Flume sink configuration")
+      .required(true)
+      .defaultValue("tier1")
+      .addValidator(StandardValidators.NON_EMPTY_VALIDATOR)
+      .build();
+  public static final PropertyDescriptor SOURCE_NAME = new PropertyDescriptor.Builder()
+      .name("Sink Name")
+      .description("The name of the sink used in the Flume sink configuration")
+      .required(true)
+      .defaultValue("sink-1")
+      .addValidator(StandardValidators.NON_EMPTY_VALIDATOR)
+      .build();
+  public static final PropertyDescriptor FLUME_CONFIG = new PropertyDescriptor.Builder()
+      .name("Flume Configuration")
+      .description("The Flume configuration for the sink copied from the flume.properties file")
+      .required(true)
+      .defaultValue("")
+      .addValidator(Validator.VALID)
+      .build();
+
+  public static final Relationship SUCCESS = new Relationship.Builder().name("success").build();
+  public static final Relationship FAILURE = new Relationship.Builder().name("failure").build();
+
+  private List<PropertyDescriptor> descriptors;
+  private Set<Relationship> relationships;
+
+
+  @Override
+  protected void init(final ProcessorInitializationContext context) {
+    this.descriptors = ImmutableList.of(SINK_TYPE, AGENT_NAME, SOURCE_NAME, FLUME_CONFIG);
+    this.relationships = ImmutableSet.of();
+  }
+
+  @Override
+  protected List<PropertyDescriptor> getSupportedPropertyDescriptors() {
+    return descriptors;
+  }
+
+  @Override
+  public Set<Relationship> getRelationships() {
+    return relationships;
+  }
+
+  @OnScheduled
+  public void onScheduled(final SchedulingContext context) {
+    channel = new MemoryChannel();
+    Configurables.configure(channel, new Context());
+    channel.start();
+
+    sink = SINK_FACTORY.create(context.getProperty(SOURCE_NAME).getValue(),
+        context.getProperty(SINK_TYPE).getValue());
+    sink.setChannel(channel);
+
+    String flumeConfig = context.getProperty(FLUME_CONFIG).getValue();
+    String agentName = context.getProperty(AGENT_NAME).getValue();
+    String sinkName = context.getProperty(SOURCE_NAME).getValue();
+    Configurables.configure(sink,
+        getFlumeSinkContext(flumeConfig, agentName, sinkName) );
+
+    sink.start();
+  }
+
+  @OnUnscheduled
+  public void unScheduled() {
+    sink.stop();
+    channel.stop();
+  }
+
+  @Override
+  public void onTrigger(final ProcessContext context,
+      final ProcessSession session) throws ProcessException {
+    FlowFile flowFile = session.get();
+
+    Transaction transaction = channel.getTransaction();
+    try {
+      transaction.begin();
+      channel.put(new FlowFileEvent(flowFile, session));
+      transaction.commit();
+    } catch (Throwable th) {
+      transaction.rollback();
+      throw Throwables.propagate(th);
+    } finally {
+      transaction.close();
+    }
+
+    try {
+      sink.process();
+      session.transfer(flowFile, SUCCESS);
+    } catch (EventDeliveryException ex) {
+      session.transfer(flowFile, FAILURE);
+    }
+  }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/b251ab44/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/src/main/java/org/apache/nifi/processors/flume/FlumeSourceProcessor.java
----------------------------------------------------------------------
diff --git a/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/src/main/java/org/apache/nifi/processors/flume/FlumeSourceProcessor.java b/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/src/main/java/org/apache/nifi/processors/flume/FlumeSourceProcessor.java
new file mode 100644
index 0000000..8b8388c
--- /dev/null
+++ b/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/src/main/java/org/apache/nifi/processors/flume/FlumeSourceProcessor.java
@@ -0,0 +1,178 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.nifi.processors.flume;
+
+import com.google.common.collect.ImmutableList;
+import com.google.common.collect.ImmutableSet;
+import java.util.List;
+import java.util.Set;
+import org.apache.flume.Context;
+import org.apache.flume.Event;
+import org.apache.flume.EventDeliveryException;
+import org.apache.flume.EventDrivenSource;
+import org.apache.flume.PollableSource;
+import org.apache.flume.Source;
+import org.apache.flume.SourceRunner;
+import org.apache.flume.Transaction;
+import org.apache.flume.channel.ChannelProcessor;
+import org.apache.flume.channel.MemoryChannel;
+import org.apache.flume.conf.Configurables;
+import org.apache.flume.source.EventDrivenSourceRunner;
+
+import org.apache.nifi.components.PropertyDescriptor;
+import org.apache.nifi.components.Validator;
+import org.apache.nifi.processor.ProcessContext;
+import org.apache.nifi.processor.ProcessSession;
+import org.apache.nifi.processor.ProcessorInitializationContext;
+import org.apache.nifi.processor.Relationship;
+import org.apache.nifi.processor.SchedulingContext;
+import org.apache.nifi.processor.annotation.CapabilityDescription;
+import org.apache.nifi.processor.annotation.OnScheduled;
+import org.apache.nifi.processor.annotation.OnUnscheduled;
+import org.apache.nifi.processor.annotation.Tags;
+import org.apache.nifi.processor.exception.ProcessException;
+import org.apache.nifi.processor.util.StandardValidators;
+
+/**
+ * This processor runs a Flume source 
+ */
+@Tags({"flume", "hadoop", "get", "source" })
+@CapabilityDescription("Generate FlowFile data from a Flume source")
+public class FlumeSourceProcessor extends AbstractFlumeProcessor {
+  
+  private Source source;
+  private SourceRunner runner;
+  private MemoryChannel channel;
+
+  public static final PropertyDescriptor SOURCE_TYPE = new PropertyDescriptor.Builder()
+      .name("Source Type")
+      .description("The fully-qualified name of the Source class")
+      .required(true)
+      .addValidator(createSourceValidator())
+      .build();
+  public static final PropertyDescriptor AGENT_NAME = new PropertyDescriptor.Builder()
+      .name("Agent Name")
+      .description("The name of the agent used in the Flume source configuration")
+      .required(true)
+      .defaultValue("tier1")
+      .addValidator(StandardValidators.NON_EMPTY_VALIDATOR)
+      .build();
+  public static final PropertyDescriptor SOURCE_NAME = new PropertyDescriptor.Builder()
+      .name("Source Name")
+      .description("The name of the source used in the Flume source configuration")
+      .required(true)
+      .defaultValue("src-1")
+      .addValidator(StandardValidators.NON_EMPTY_VALIDATOR)
+      .build();
+  public static final PropertyDescriptor FLUME_CONFIG = new PropertyDescriptor.Builder()
+      .name("Flume Configuration")
+      .description("The Flume configuration for the source copied from the flume.properties file")
+      .required(true)
+      .defaultValue("")
+      .addValidator(Validator.VALID)
+      .build();
+
+  public static final Relationship SUCCESS = new Relationship.Builder().name("success").build();
+
+  private List<PropertyDescriptor> descriptors;
+  private Set<Relationship> relationships;
+
+
+  @Override
+  protected void init(final ProcessorInitializationContext context) {
+    this.descriptors = ImmutableList.of(SOURCE_TYPE, AGENT_NAME, SOURCE_NAME, FLUME_CONFIG);
+    this.relationships = ImmutableSet.of(SUCCESS);
+  }
+
+  @Override
+  protected List<PropertyDescriptor> getSupportedPropertyDescriptors() {
+    return descriptors;
+  }
+
+  @Override
+  public Set<Relationship> getRelationships() {
+    return relationships;
+  }
+
+  @OnScheduled
+  public void onScheduled(final SchedulingContext context) {
+    source = SOURCE_FACTORY.create(
+        context.getProperty(SOURCE_NAME).getValue(),
+        context.getProperty(SOURCE_TYPE).getValue());
+    
+    String flumeConfig = context.getProperty(FLUME_CONFIG).getValue();
+    String agentName = context.getProperty(AGENT_NAME).getValue();
+    String sourceName = context.getProperty(SOURCE_NAME).getValue();
+    Configurables.configure(source,
+        getFlumeSourceContext(flumeConfig, agentName, sourceName) );
+
+    if (source instanceof EventDrivenSource) {
+      runner = new EventDrivenSourceRunner();
+      channel = new MemoryChannel();
+      Configurables.configure(channel, new Context());
+      channel.start();
+      source.setChannelProcessor(new ChannelProcessor(new NifiChannelSelector(channel)));
+      runner.setSource(source);
+      runner.start();
+    } 
+  }
+
+  @OnUnscheduled
+  public void unScheduled() {
+    if (runner != null) {
+      runner.stop();
+    }
+    if (channel != null) {
+      channel.stop();
+    }
+  }
+
+  @Override
+  public void onTrigger(final ProcessContext context,
+      final ProcessSession session) throws ProcessException {
+    if (source instanceof EventDrivenSource) {
+      onEventDrivenTrigger(context, session);
+    } else if (source instanceof PollableSource) {
+      onPollableTrigger((PollableSource)source, context, session);
+    }
+  }
+
+  public void onPollableTrigger(final PollableSource pollableSource,
+      final ProcessContext context, final ProcessSession session)
+      throws ProcessException {
+    try {
+      pollableSource.setChannelProcessor(new ChannelProcessor(
+          new NifiChannelSelector(new NifiChannel(session, SUCCESS))));
+      pollableSource.start();
+      pollableSource.process();
+      pollableSource.stop();
+    } catch (EventDeliveryException ex) {
+      throw new ProcessException("Error processing pollable source", ex);
+    }
+  }
+
+  public void onEventDrivenTrigger(final ProcessContext context, final ProcessSession session) {
+    Transaction transaction = channel.getTransaction();
+    transaction.begin();
+
+    Event event = channel.take();
+    if (event != null) {
+      transferEvent(event, session, SUCCESS);
+    }
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/b251ab44/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/src/main/java/org/apache/nifi/processors/flume/NifiChannel.java
----------------------------------------------------------------------
diff --git a/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/src/main/java/org/apache/nifi/processors/flume/NifiChannel.java b/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/src/main/java/org/apache/nifi/processors/flume/NifiChannel.java
new file mode 100644
index 0000000..ac8dbe2
--- /dev/null
+++ b/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/src/main/java/org/apache/nifi/processors/flume/NifiChannel.java
@@ -0,0 +1,31 @@
+
+package org.apache.nifi.processors.flume;
+
+import org.apache.flume.Context;
+import org.apache.flume.channel.BasicChannelSemantics;
+import org.apache.flume.channel.BasicTransactionSemantics;
+import org.apache.nifi.processor.ProcessSession;
+import org.apache.nifi.processor.Relationship;
+
+
+public class NifiChannel extends BasicChannelSemantics {
+  private final ProcessSession session;
+  private final Relationship relationship;
+
+  public NifiChannel(ProcessSession session, Relationship relationship) {
+    this.session = session;
+    this.relationship = relationship;
+  }
+
+  @Override
+  protected BasicTransactionSemantics createTransaction() {
+    return new NifiTransaction(session, relationship);
+  }
+
+  @Override
+  public void configure(Context context) {
+    throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
+  }
+
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/b251ab44/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/src/main/java/org/apache/nifi/processors/flume/NifiChannelSelector.java
----------------------------------------------------------------------
diff --git a/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/src/main/java/org/apache/nifi/processors/flume/NifiChannelSelector.java b/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/src/main/java/org/apache/nifi/processors/flume/NifiChannelSelector.java
new file mode 100644
index 0000000..792678b
--- /dev/null
+++ b/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/src/main/java/org/apache/nifi/processors/flume/NifiChannelSelector.java
@@ -0,0 +1,55 @@
+
+package org.apache.nifi.processors.flume;
+
+import com.google.common.collect.ImmutableList;
+import java.util.List;
+import org.apache.flume.Channel;
+import org.apache.flume.ChannelSelector;
+import org.apache.flume.Context;
+import org.apache.flume.Event;
+
+
+public class NifiChannelSelector implements ChannelSelector {
+  private String name;
+  private final List<Channel> requiredChannels;
+  private final List<Channel> optionalChannels;
+
+  public NifiChannelSelector(Channel channel) {
+    requiredChannels = ImmutableList.of(channel);
+    optionalChannels = ImmutableList.of();
+  }
+
+  @Override
+  public List<Channel> getRequiredChannels(Event event) {
+    return requiredChannels;
+  }
+
+  @Override
+  public List<Channel> getOptionalChannels(Event event) {
+    return optionalChannels;
+  }
+
+  @Override
+  public List<Channel> getAllChannels() {
+    return requiredChannels;
+  }
+
+  @Override
+  public void setChannels(List<Channel> channels) {
+    throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
+  }
+
+  @Override
+  public String getName() {
+    return name;
+  }
+
+  @Override
+  public void setName(String name) {
+    this.name = name;
+  }
+
+  @Override
+  public void configure(Context context) {
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/b251ab44/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/src/main/java/org/apache/nifi/processors/flume/NifiTransaction.java
----------------------------------------------------------------------
diff --git a/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/src/main/java/org/apache/nifi/processors/flume/NifiTransaction.java b/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/src/main/java/org/apache/nifi/processors/flume/NifiTransaction.java
new file mode 100644
index 0000000..3d6a647
--- /dev/null
+++ b/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/src/main/java/org/apache/nifi/processors/flume/NifiTransaction.java
@@ -0,0 +1,40 @@
+
+package org.apache.nifi.processors.flume;
+
+import org.apache.flume.Event;
+import org.apache.flume.channel.BasicTransactionSemantics;
+import org.apache.nifi.processor.ProcessSession;
+import org.apache.nifi.processor.Relationship;
+
+
+class NifiTransaction extends BasicTransactionSemantics {
+  private final ProcessSession session;
+  private final Relationship relationship;
+
+  public NifiTransaction(ProcessSession session, Relationship relationship) {
+    this.session = session;
+    this.relationship = relationship;
+  }
+
+  @Override
+  protected void doPut(Event event) throws InterruptedException {
+    AbstractFlumeProcessor.transferEvent(event, session, relationship);
+  }
+
+  @Override
+  protected Event doTake() throws InterruptedException {
+    throw new UnsupportedOperationException("Only put supported");
+  }
+
+  @Override
+  protected void doCommit() throws InterruptedException {
+    session.commit();
+  }
+
+  @Override
+  protected void doRollback() throws InterruptedException {
+    session.rollback();
+  }
+
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/b251ab44/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/src/main/java/org/apache/nifi/processors/flume/util/FlowFileEvent.java
----------------------------------------------------------------------
diff --git a/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/src/main/java/org/apache/nifi/processors/flume/util/FlowFileEvent.java b/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/src/main/java/org/apache/nifi/processors/flume/util/FlowFileEvent.java
new file mode 100644
index 0000000..c3531ca
--- /dev/null
+++ b/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/src/main/java/org/apache/nifi/processors/flume/util/FlowFileEvent.java
@@ -0,0 +1,114 @@
+
+package org.apache.nifi.processors.flume.util;
+
+import com.google.common.collect.Maps;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.Arrays;
+import java.util.Map;
+import org.apache.flume.Event;
+import org.apache.nifi.flowfile.FlowFile;
+import org.apache.nifi.processor.ProcessSession;
+import org.apache.nifi.processor.io.InputStreamCallback;
+
+import static org.apache.nifi.processors.flume.util.FlowFileEventConstants.*;
+import org.apache.nifi.stream.io.BufferedInputStream;
+import org.apache.nifi.stream.io.StreamUtils;
+
+public class FlowFileEvent implements Event {
+
+  private final FlowFile flowFile;
+  private final ProcessSession session;
+
+  private final Map<String, String> headers;
+  private boolean headersLoaded;
+
+  private final Object bodyLock;
+  private byte[] body;
+  private boolean bodyLoaded;
+
+  public FlowFileEvent(FlowFile flowFile, ProcessSession session) {
+    this.flowFile = flowFile;
+    this.session = session;
+
+    headers = Maps.newHashMap();
+    bodyLock = new Object();
+    bodyLoaded = false;
+  }
+
+  @Override
+  public Map<String, String> getHeaders() {
+    if (!headersLoaded) {
+      synchronized (headers) {
+        if (headersLoaded) {
+          return headers;
+        }
+
+        headers.putAll(flowFile.getAttributes());
+        headers.put(ENTRY_DATE_HEADER, Long.toString(flowFile.getEntryDate()));
+        headers.put(ID_HEADER, Long.toString(flowFile.getId()));
+        headers.put(LAST_QUEUE_DATE_HEADER, Long.toString(flowFile.getLastQueueDate()));
+        int i = 0;
+        for (String lineageIdentifier : flowFile.getLineageIdentifiers()) {
+          headers.put(LINEAGE_IDENTIFIERS_HEADER + "." + i, lineageIdentifier);
+          i++;
+        }
+        headers.put(LINEAGE_START_DATE_HEADER, Long.toString(flowFile.getLineageStartDate()));
+        headers.put(SIZE_HEADER, Long.toString(flowFile.getSize()));
+        
+        headersLoaded = true;
+      }
+    }
+    return headers;
+  }
+
+  @Override
+  public void setHeaders(Map<String, String> headers) {
+    synchronized (this.headers) {
+      this.headers.clear();
+      this.headers.putAll(headers);
+      headersLoaded = true;
+    }
+  }
+
+  @Override
+  public byte[] getBody() {
+    if (bodyLoaded) {
+      return body;
+    }
+
+    synchronized (bodyLock ) {
+      if (!bodyLoaded) {
+        if (flowFile.getSize() > Integer.MAX_VALUE) {
+          throw new RuntimeException("Can't get body of Event because the backing FlowFile is too large (" + flowFile.getSize() + " bytes)");
+        }
+    
+        final ByteArrayOutputStream baos = new ByteArrayOutputStream((int) flowFile.getSize());
+        session.read(flowFile, new InputStreamCallback() {
+
+          @Override
+          public void process(InputStream in) throws IOException {
+            try (BufferedInputStream input = new BufferedInputStream(in)) {
+              StreamUtils.copy(in, baos);
+            }
+            baos.close();
+          }
+        });
+
+        body = baos.toByteArray();
+        bodyLoaded = true;
+      }
+    }
+
+    return body;
+  }
+
+  @Override
+  public void setBody(byte[] body) {
+    synchronized (bodyLock) {
+      this.body = Arrays.copyOf(body, body.length);
+      bodyLoaded = true;
+    }
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/b251ab44/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/src/main/java/org/apache/nifi/processors/flume/util/FlowFileEventConstants.java
----------------------------------------------------------------------
diff --git a/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/src/main/java/org/apache/nifi/processors/flume/util/FlowFileEventConstants.java b/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/src/main/java/org/apache/nifi/processors/flume/util/FlowFileEventConstants.java
new file mode 100644
index 0000000..c13f0ef
--- /dev/null
+++ b/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/src/main/java/org/apache/nifi/processors/flume/util/FlowFileEventConstants.java
@@ -0,0 +1,25 @@
+
+package org.apache.nifi.processors.flume.util;
+
+
+public class FlowFileEventConstants {
+
+  // FlowFile#getEntryDate();
+  public static final String ENTRY_DATE_HEADER = "nifi.entry.date";
+
+  // FlowFile#getId();
+  public static final String ID_HEADER = "nifi.id";
+
+  // FlowFile#getLastQueueDate();
+  public static final String LAST_QUEUE_DATE_HEADER = "nifi.last.queue.date";
+
+  // FlowFile#getLineageIdentifiers();
+  public static final String LINEAGE_IDENTIFIERS_HEADER = "nifi.lineage.identifiers";
+
+  // FlowFile#getLineageStartDate();
+  public static final String LINEAGE_START_DATE_HEADER = "nifi.lineage.start.date";
+
+  // FlowFile#getSize();
+  public static final String SIZE_HEADER = "nifi.size";
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/b251ab44/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/src/main/resources/META-INF/services/org.apache.nifi.processor.Processor
----------------------------------------------------------------------
diff --git a/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/src/main/resources/META-INF/services/org.apache.nifi.processor.Processor b/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/src/main/resources/META-INF/services/org.apache.nifi.processor.Processor
new file mode 100644
index 0000000..fae8727
--- /dev/null
+++ b/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/src/main/resources/META-INF/services/org.apache.nifi.processor.Processor
@@ -0,0 +1,16 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+org.apache.nifi.processors.flume.FlumeSourceProcessor
+org.apache.nifi.processors.flume.FlumeSinkProcessor

http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/b251ab44/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/src/test/java/org/apache/nifi/processors/flume/AbstractFlumeTest.java
----------------------------------------------------------------------
diff --git a/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/src/test/java/org/apache/nifi/processors/flume/AbstractFlumeTest.java b/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/src/test/java/org/apache/nifi/processors/flume/AbstractFlumeTest.java
new file mode 100644
index 0000000..87b056a
--- /dev/null
+++ b/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/src/test/java/org/apache/nifi/processors/flume/AbstractFlumeTest.java
@@ -0,0 +1,35 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.nifi.processors.flume;
+
+import org.junit.BeforeClass;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class AbstractFlumeTest {
+
+    private static Logger logger;
+
+    @BeforeClass
+    public static void setUpClass() {
+        System.setProperty("org.slf4j.simpleLogger.defaultLogLevel", "info");
+        System.setProperty("org.slf4j.simpleLogger.showDateTime", "true");
+        System.setProperty("org.slf4j.simpleLogger.log.nifi.processors.flume", "debug");
+        logger = LoggerFactory.getLogger(AbstractFlumeTest.class);
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/b251ab44/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/src/test/java/org/apache/nifi/processors/flume/FlumeSinkProcessorTest.java
----------------------------------------------------------------------
diff --git a/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/src/test/java/org/apache/nifi/processors/flume/FlumeSinkProcessorTest.java b/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/src/test/java/org/apache/nifi/processors/flume/FlumeSinkProcessorTest.java
new file mode 100644
index 0000000..4f2cef7
--- /dev/null
+++ b/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/src/test/java/org/apache/nifi/processors/flume/FlumeSinkProcessorTest.java
@@ -0,0 +1,154 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.nifi.processors.flume;
+
+import java.io.File;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+import java.io.FileInputStream;
+import java.io.FilenameFilter;
+import java.io.IOException;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+import org.apache.commons.io.filefilter.HiddenFileFilter;
+import org.apache.flume.sink.NullSink;
+import org.apache.flume.source.AvroSource;
+
+import org.apache.nifi.components.ValidationResult;
+import org.apache.nifi.flowfile.attributes.CoreAttributes;
+import org.apache.nifi.processor.ProcessContext;
+import org.apache.nifi.util.MockProcessContext;
+import org.apache.nifi.util.TestRunner;
+import org.apache.nifi.util.TestRunners;
+import org.apache.nifi.util.file.FileUtils;
+
+import org.junit.Assert;
+import org.junit.Ignore;
+import org.junit.Test;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class FlumeSinkProcessorTest {
+
+  private static final Logger logger =
+      LoggerFactory.getLogger(FlumeSinkProcessorTest.class);
+  
+    @Test
+    public void testValidators() {
+        TestRunner runner = TestRunners.newTestRunner(FlumeSinkProcessor.class);
+        Collection<ValidationResult> results;
+        ProcessContext pc;
+
+        results = new HashSet<>();
+        runner.enqueue(new byte[0]);
+        pc = runner.getProcessContext();
+        if (pc instanceof MockProcessContext) {
+            results = ((MockProcessContext) pc).validate();
+        }
+        Assert.assertEquals(1, results.size());
+        for (ValidationResult vr : results) {
+            logger.error(vr.toString());
+            Assert.assertTrue(vr.toString().contains("is invalid because Sink Type is required"));
+        }
+
+        // non-existent class
+        results = new HashSet<>();
+        runner.setProperty(FlumeSinkProcessor.SINK_TYPE, "invalid.class.name");
+        runner.enqueue(new byte[0]);
+        pc = runner.getProcessContext();
+        if (pc instanceof MockProcessContext) {
+            results = ((MockProcessContext) pc).validate();
+        }
+        Assert.assertEquals(1, results.size());
+        for (ValidationResult vr : results) {
+            logger.error(vr.toString());
+            Assert.assertTrue(vr.toString().contains("is invalid because unable to load sink"));
+        }
+
+        // class doesn't implement Sink
+        results = new HashSet<>();
+        runner.setProperty(FlumeSinkProcessor.SINK_TYPE, AvroSource.class.getName());
+        runner.enqueue(new byte[0]);
+        pc = runner.getProcessContext();
+        if (pc instanceof MockProcessContext) {
+            results = ((MockProcessContext) pc).validate();
+        }
+        Assert.assertEquals(1, results.size());
+        for (ValidationResult vr : results) {
+            logger.error(vr.toString());
+            Assert.assertTrue(vr.toString().contains("is invalid because unable to create sink"));
+        }
+
+        results = new HashSet<>();
+        runner.setProperty(FlumeSinkProcessor.SINK_TYPE, NullSink.class.getName());
+        runner.enqueue(new byte[0]);
+        pc = runner.getProcessContext();
+        if (pc instanceof MockProcessContext) {
+            results = ((MockProcessContext) pc).validate();
+        }
+        Assert.assertEquals(0, results.size());
+    }
+
+
+    @Test
+    public void testNullSink() throws IOException {
+        TestRunner runner = TestRunners.newTestRunner(FlumeSinkProcessor.class);
+        runner.setProperty(FlumeSinkProcessor.SINK_TYPE, NullSink.class.getName());
+        FileInputStream fis = new FileInputStream("src/test/resources/testdata/records.txt");
+        Map<String, String> attributes = new HashMap<>();
+        attributes.put(CoreAttributes.FILENAME.key(), "records.txt");
+        runner.enqueue(fis, attributes);
+        runner.run();
+        fis.close();
+    }
+    
+    @Test
+    public void testHdfsSink() throws IOException {
+        File destDir = new File("target/hdfs");
+        if (destDir.exists()) {
+          FileUtils.deleteFilesInDir(destDir, null, logger);
+        } else {
+          destDir.mkdirs();
+        }
+
+        TestRunner runner = TestRunners.newTestRunner(FlumeSinkProcessor.class);
+        runner.setProperty(FlumeSinkProcessor.SINK_TYPE, "hdfs");
+        runner.setProperty(FlumeSinkProcessor.FLUME_CONFIG,
+            "tier1.sinks.sink-1.hdfs.path = " + destDir.toURI().toString() + "\n" +
+            "tier1.sinks.sink-1.hdfs.fileType = DataStream\n" +
+            "tier1.sinks.sink-1.hdfs.serializer = TEXT\n" +
+            "tier1.sinks.sink-1.serializer.appendNewline = false"
+        );
+        FileInputStream fis = new FileInputStream("src/test/resources/testdata/records.txt");
+        Map<String, String> attributes = new HashMap<>();
+        attributes.put(CoreAttributes.FILENAME.key(), "records.txt");
+        runner.enqueue(fis, attributes);
+        runner.run();
+        fis.close();
+
+        File[] files = destDir.listFiles((FilenameFilter)HiddenFileFilter.VISIBLE);
+        assertEquals("Unexpected number of destination files.", 1, files.length);
+        File dst = files[0];
+        byte[] expectedMd5 = FileUtils.computeMd5Digest(new File("src/test/resources/testdata/records.txt"));
+        byte[] actualMd5 = FileUtils.computeMd5Digest(dst);
+        Assert.assertArrayEquals("Destination file doesn't match source data", expectedMd5, actualMd5);
+    }
+ 
+}

http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/b251ab44/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/src/test/java/org/apache/nifi/processors/flume/FlumeSourceProcessorTest.java
----------------------------------------------------------------------
diff --git a/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/src/test/java/org/apache/nifi/processors/flume/FlumeSourceProcessorTest.java b/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/src/test/java/org/apache/nifi/processors/flume/FlumeSourceProcessorTest.java
new file mode 100644
index 0000000..bbcf116
--- /dev/null
+++ b/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/src/test/java/org/apache/nifi/processors/flume/FlumeSourceProcessorTest.java
@@ -0,0 +1,140 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.nifi.processors.flume;
+
+
+import java.io.File;
+import java.io.IOException;
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.List;
+import org.apache.flume.sink.NullSink;
+import org.apache.flume.source.AvroSource;
+
+import org.apache.nifi.components.ValidationResult;
+import org.apache.nifi.processor.ProcessContext;
+import org.apache.nifi.util.MockFlowFile;
+import org.apache.nifi.util.MockProcessContext;
+import org.apache.nifi.util.TestRunner;
+import org.apache.nifi.util.TestRunners;
+import org.apache.nifi.util.file.FileUtils;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class FlumeSourceProcessorTest {
+
+  private static final Logger logger =
+      LoggerFactory.getLogger(FlumeSourceProcessorTest.class);
+
+
+    @Test
+    public void testValidators() {
+        TestRunner runner = TestRunners.newTestRunner(FlumeSourceProcessor.class);
+        Collection<ValidationResult> results;
+        ProcessContext pc;
+
+        results = new HashSet<>();
+        runner.enqueue(new byte[0]);
+        pc = runner.getProcessContext();
+        if (pc instanceof MockProcessContext) {
+            results = ((MockProcessContext) pc).validate();
+        }
+        Assert.assertEquals(1, results.size());
+        for (ValidationResult vr : results) {
+            logger.error(vr.toString());
+            Assert.assertTrue(vr.toString().contains("is invalid because Source Type is required"));
+        }
+
+        // non-existent class
+        results = new HashSet<>();
+        runner.setProperty(FlumeSourceProcessor.SOURCE_TYPE, "invalid.class.name");
+        runner.enqueue(new byte[0]);
+        pc = runner.getProcessContext();
+        if (pc instanceof MockProcessContext) {
+            results = ((MockProcessContext) pc).validate();
+        }
+        Assert.assertEquals(1, results.size());
+        for (ValidationResult vr : results) {
+            logger.error(vr.toString());
+            Assert.assertTrue(vr.toString().contains("is invalid because unable to load source"));
+        }
+
+        // class doesn't implement Source
+        results = new HashSet<>();
+        runner.setProperty(FlumeSourceProcessor.SOURCE_TYPE, NullSink.class.getName());
+        runner.enqueue(new byte[0]);
+        pc = runner.getProcessContext();
+        if (pc instanceof MockProcessContext) {
+            results = ((MockProcessContext) pc).validate();
+        }
+        Assert.assertEquals(1, results.size());
+        for (ValidationResult vr : results) {
+            logger.error(vr.toString());
+            Assert.assertTrue(vr.toString().contains("is invalid because unable to create source"));
+        }
+
+        results = new HashSet<>();
+        runner.setProperty(FlumeSourceProcessor.SOURCE_TYPE, AvroSource.class.getName());
+        runner.enqueue(new byte[0]);
+        pc = runner.getProcessContext();
+        if (pc instanceof MockProcessContext) {
+            results = ((MockProcessContext) pc).validate();
+        }
+        Assert.assertEquals(0, results.size());
+    }
+
+    @Test
+    public void testSequenceSource() {
+        TestRunner runner = TestRunners.newTestRunner(FlumeSourceProcessor.class);
+        runner.setProperty(FlumeSourceProcessor.SOURCE_TYPE, "seq");
+        runner.run();
+        List<MockFlowFile> flowFiles = runner.getFlowFilesForRelationship(FlumeSourceProcessor.SUCCESS);
+        Assert.assertEquals(1, flowFiles.size());
+        for (MockFlowFile flowFile : flowFiles) {
+          logger.error(flowFile.toString());
+            Assert.assertEquals(1, flowFile.getSize());
+        }
+    }
+
+    @Test
+    public void testSourceWithConfig() throws IOException {
+        File spoolDirectory = new File("target/spooldir");
+        if (spoolDirectory.exists()) {
+          FileUtils.deleteFilesInDir(spoolDirectory, null, logger);
+        } else {
+          spoolDirectory.mkdirs();
+        }
+        File src = new File("src/test/resources/testdata/records.txt");
+        File dst = new File(spoolDirectory, "records.txt");
+        FileUtils.copyFile(src, dst, false, false, logger);
+
+        TestRunner runner = TestRunners.newTestRunner(FlumeSourceProcessor.class);
+        runner.setProperty(FlumeSourceProcessor.SOURCE_TYPE, "spooldir");
+        runner.setProperty(FlumeSinkProcessor.FLUME_CONFIG,
+            "tier1.sources.src-1.spoolDir = " + spoolDirectory.getAbsolutePath());
+        runner.run();
+        List<MockFlowFile> flowFiles = runner.getFlowFilesForRelationship(FlumeSourceProcessor.SUCCESS);
+        Assert.assertEquals(1, flowFiles.size());
+        for (MockFlowFile flowFile : flowFiles) {
+            Assert.assertEquals(8, flowFile.getSize());
+            flowFile.assertContentEquals("record 1");
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/b251ab44/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/src/test/resources/core-site-broken.xml
----------------------------------------------------------------------
diff --git a/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/src/test/resources/core-site-broken.xml b/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/src/test/resources/core-site-broken.xml
new file mode 100644
index 0000000..e06a193
--- /dev/null
+++ b/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/src/test/resources/core-site-broken.xml
@@ -0,0 +1,25 @@
+<?xml version="1.0"?>
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+      http://www.apache.org/licenses/LICENSE-2.0
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+-->
+<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
+
+<!-- Put site-specific property overrides in this file. -->
+
+<configuration>
+    <property>
+        <name>fs.default.name</name>
+        <value>hdfs://localhost:65535</value>
+    </property>
+</configuration>

http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/b251ab44/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/src/test/resources/core-site.xml
----------------------------------------------------------------------
diff --git a/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/src/test/resources/core-site.xml b/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/src/test/resources/core-site.xml
new file mode 100644
index 0000000..5e3b55c
--- /dev/null
+++ b/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/src/test/resources/core-site.xml
@@ -0,0 +1,25 @@
+<?xml version="1.0"?>
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+      http://www.apache.org/licenses/LICENSE-2.0
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+-->
+<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
+
+<!-- Put site-specific property overrides in this file. -->
+
+<configuration>
+    <property>
+        <name>fs.defaultFS</name>
+        <value>file:///</value>
+    </property>
+</configuration>

http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/b251ab44/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/src/test/resources/testdata/records.txt
----------------------------------------------------------------------
diff --git a/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/src/test/resources/testdata/records.txt b/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/src/test/resources/testdata/records.txt
new file mode 100644
index 0000000..5a809ee
--- /dev/null
+++ b/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/src/test/resources/testdata/records.txt
@@ -0,0 +1,4 @@
+record 1
+record 2
+record 3
+record 4

http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/b251ab44/nifi/nifi-nar-bundles/nifi-flume-bundle/pom.xml
----------------------------------------------------------------------
diff --git a/nifi/nifi-nar-bundles/nifi-flume-bundle/pom.xml b/nifi/nifi-nar-bundles/nifi-flume-bundle/pom.xml
new file mode 100644
index 0000000..dc9ec69
--- /dev/null
+++ b/nifi/nifi-nar-bundles/nifi-flume-bundle/pom.xml
@@ -0,0 +1,39 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <!--
+      Licensed to the Apache Software Foundation (ASF) under one or more
+      contributor license agreements.  See the NOTICE file distributed with
+      this work for additional information regarding copyright ownership.
+      The ASF licenses this file to You under the Apache License, Version 2.0
+      (the "License"); you may not use this file except in compliance with
+      the License.  You may obtain a copy of the License at
+          http://www.apache.org/licenses/LICENSE-2.0
+      Unless required by applicable law or agreed to in writing, software
+      distributed under the License is distributed on an "AS IS" BASIS,
+      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+      See the License for the specific language governing permissions and
+      limitations under the License.
+    -->
+    <modelVersion>4.0.0</modelVersion>
+    <parent>
+        <groupId>org.apache.nifi</groupId>
+        <artifactId>nifi-nar-bundles</artifactId>
+        <version>0.0.1-incubating-SNAPSHOT</version>
+    </parent>
+    <artifactId>nifi-flume-bundle</artifactId>
+    <version>0.0.1-incubating-SNAPSHOT</version>
+    <packaging>pom</packaging>
+    <description>A bundle of processors that run Flume sources/sinks</description>
+    <modules>
+        <module>nifi-flume-processors</module>
+        <module>nifi-flume-nar</module>
+    </modules>
+    <dependencyManagement>
+        <dependencies>
+            <dependency>
+                <groupId>org.apache.nifi</groupId>
+                <artifactId>nifi-flume-processors</artifactId>
+                <version>0.0.1-incubating-SNAPSHOT</version>
+            </dependency>
+        </dependencies>
+    </dependencyManagement>
+</project>

http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/b251ab44/nifi/nifi-nar-bundles/pom.xml
----------------------------------------------------------------------
diff --git a/nifi/nifi-nar-bundles/pom.xml b/nifi/nifi-nar-bundles/pom.xml
index b9be570..29a5e49 100644
--- a/nifi/nifi-nar-bundles/pom.xml
+++ b/nifi/nifi-nar-bundles/pom.xml
@@ -41,6 +41,7 @@
         <module>nifi-hl7-bundle</module>
         <module>nifi-language-translation-bundle</module>
         <module>nifi-mongodb-bundle</module>
+        <module>nifi-flume-bundle</module>
     </modules>
     <dependencyManagement>
         <dependencies>


[08/13] incubator-nifi git commit: Fixed a couple of checkstyle violations

Posted by mc...@apache.org.
Fixed a couple of checkstyle violations

Signed-off-by: Matt Gilman <ma...@gmail.com>


Project: http://git-wip-us.apache.org/repos/asf/incubator-nifi/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-nifi/commit/2a3deed5
Tree: http://git-wip-us.apache.org/repos/asf/incubator-nifi/tree/2a3deed5
Diff: http://git-wip-us.apache.org/repos/asf/incubator-nifi/diff/2a3deed5

Branch: refs/heads/develop
Commit: 2a3deed573b5d44bc79a49ea4bbdc5a49d4ebecd
Parents: e7e15fa
Author: Joey Echeverria <jo...@gmail.com>
Authored: Sun Jul 12 19:08:32 2015 -0700
Committer: Matt Gilman <ma...@gmail.com>
Committed: Tue Jul 14 14:50:17 2015 -0400

----------------------------------------------------------------------
 .../java/org/apache/nifi/processors/flume/ExecuteFlumeSink.java   | 3 ++-
 .../java/org/apache/nifi/processors/flume/ExecuteFlumeSource.java | 3 ++-
 2 files changed, 4 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/2a3deed5/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/src/main/java/org/apache/nifi/processors/flume/ExecuteFlumeSink.java
----------------------------------------------------------------------
diff --git a/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/src/main/java/org/apache/nifi/processors/flume/ExecuteFlumeSink.java b/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/src/main/java/org/apache/nifi/processors/flume/ExecuteFlumeSink.java
index 94251b4..57e0278 100644
--- a/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/src/main/java/org/apache/nifi/processors/flume/ExecuteFlumeSink.java
+++ b/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/src/main/java/org/apache/nifi/processors/flume/ExecuteFlumeSink.java
@@ -50,7 +50,8 @@ public class ExecuteFlumeSink extends AbstractFlumeProcessor {
 
     public static final PropertyDescriptor SINK_TYPE = new PropertyDescriptor.Builder()
             .name("Sink Type")
-            .description("The component type name for the sink. For some sinks, this is a short, symbolic name (e.g. hdfs). For others, it's the fully-qualified name of the Sink class. See the Flume User Guide for details.")
+            .description("The component type name for the sink. For some sinks, this is a short, symbolic name (e.g. hdfs)."
+                    + " For others, it's the fully-qualified name of the Sink class. See the Flume User Guide for details.")
             .required(true)
             .addValidator(createSinkValidator())
             .build();

http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/2a3deed5/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/src/main/java/org/apache/nifi/processors/flume/ExecuteFlumeSource.java
----------------------------------------------------------------------
diff --git a/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/src/main/java/org/apache/nifi/processors/flume/ExecuteFlumeSource.java b/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/src/main/java/org/apache/nifi/processors/flume/ExecuteFlumeSource.java
index fa4fbe6..70f82cc 100644
--- a/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/src/main/java/org/apache/nifi/processors/flume/ExecuteFlumeSource.java
+++ b/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/src/main/java/org/apache/nifi/processors/flume/ExecuteFlumeSource.java
@@ -56,7 +56,8 @@ public class ExecuteFlumeSource extends AbstractFlumeProcessor {
 
     public static final PropertyDescriptor SOURCE_TYPE = new PropertyDescriptor.Builder()
         .name("Source Type")
-        .description("The component type name for the source. For some sources, this is a short, symbolic name (e.g. spooldir). For others, it's the fully-qualified name of the Source class. See the Flume User Guide for details.")
+        .description("The component type name for the source. For some sources, this is a short, symbolic name"
+                + " (e.g. spooldir). For others, it's the fully-qualified name of the Source class. See the Flume User Guide for details.")
         .required(true)
         .addValidator(createSourceValidator())
         .build();


[02/13] incubator-nifi git commit: Updated with Ryan's feedback:

Posted by mc...@apache.org.
Updated with Ryan's feedback:

* Moved away from any reliance on MemoryChannels in favor of
  modeling the ProcessSession/Relationship as the channel directly
  in all cases.
* Fixed version numbers in nifi-flume-* pom files.

Signed-off-by: Matt Gilman <ma...@gmail.com>


Project: http://git-wip-us.apache.org/repos/asf/incubator-nifi/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-nifi/commit/3af73c9b
Tree: http://git-wip-us.apache.org/repos/asf/incubator-nifi/tree/3af73c9b
Diff: http://git-wip-us.apache.org/repos/asf/incubator-nifi/diff/3af73c9b

Branch: refs/heads/develop
Commit: 3af73c9b824f5131eac9ea37045daec88b33a293
Parents: 419f945
Author: Joey Echeverria <jo...@gmail.com>
Authored: Wed Jun 10 12:49:50 2015 -0700
Committer: Matt Gilman <ma...@gmail.com>
Committed: Tue Jul 14 14:50:16 2015 -0400

----------------------------------------------------------------------
 .../nifi-flume-bundle/nifi-flume-nar/pom.xml    |   4 +-
 .../nifi-flume-processors/pom.xml               |   2 +-
 .../flume/AbstractFlumeProcessor.java           | 192 +++++++++++--------
 .../processors/flume/FlumeSinkProcessor.java    |  69 ++-----
 .../processors/flume/FlumeSourceProcessor.java  | 190 +++++++++---------
 .../nifi/processors/flume/NifiChannel.java      |  45 -----
 .../processors/flume/NifiSessionChannel.java    |  47 +++++
 .../flume/NifiSessionFactoryChannel.java        |  51 +++++
 .../flume/NifiSinkSessionChannel.java           |  49 +++++
 .../processors/flume/NifiSinkTransaction.java   |  71 +++++++
 .../nifi/processors/flume/NifiTransaction.java  |  55 +++---
 .../flume/FlumeSinkProcessorTest.java           |   3 +-
 .../flume/FlumeSourceProcessorTest.java         |   9 +-
 .../src/test/resources/log4j.properties         |   4 +-
 .../src/test/resources/simplelogger.properties  |   1 +
 nifi/nifi-nar-bundles/nifi-flume-bundle/pom.xml |   4 +-
 16 files changed, 482 insertions(+), 314 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/3af73c9b/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-nar/pom.xml
----------------------------------------------------------------------
diff --git a/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-nar/pom.xml b/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-nar/pom.xml
index 36a5170..c07cedf 100644
--- a/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-nar/pom.xml
+++ b/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-nar/pom.xml
@@ -17,10 +17,10 @@
     <parent>
         <groupId>org.apache.nifi</groupId>
         <artifactId>nifi-flume-bundle</artifactId>
-        <version>0.1.0-incubating-SNAPSHOT</version>
+        <version>0.2.0-incubating-SNAPSHOT</version>
     </parent>
     <artifactId>nifi-flume-nar</artifactId>
-    <version>0.1.0-incubating-SNAPSHOT</version>
+    <version>0.2.0-incubating-SNAPSHOT</version>
     <packaging>nar</packaging>
     <dependencies>
         <dependency>

http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/3af73c9b/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/pom.xml
----------------------------------------------------------------------
diff --git a/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/pom.xml b/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/pom.xml
index b0e730c..1dad25f 100644
--- a/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/pom.xml
+++ b/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/pom.xml
@@ -17,7 +17,7 @@
     <parent>
         <groupId>org.apache.nifi</groupId>
         <artifactId>nifi-flume-bundle</artifactId>
-        <version>0.1.0-incubating-SNAPSHOT</version>
+        <version>0.2.0-incubating-SNAPSHOT</version>
     </parent>
     <artifactId>nifi-flume-processors</artifactId>
     <packaging>jar</packaging>

http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/3af73c9b/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/src/main/java/org/apache/nifi/processors/flume/AbstractFlumeProcessor.java
----------------------------------------------------------------------
diff --git a/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/src/main/java/org/apache/nifi/processors/flume/AbstractFlumeProcessor.java b/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/src/main/java/org/apache/nifi/processors/flume/AbstractFlumeProcessor.java
index a831000..83ae9e1 100644
--- a/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/src/main/java/org/apache/nifi/processors/flume/AbstractFlumeProcessor.java
+++ b/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/src/main/java/org/apache/nifi/processors/flume/AbstractFlumeProcessor.java
@@ -33,96 +33,128 @@ import org.apache.nifi.components.ValidationContext;
 import org.apache.nifi.components.ValidationResult;
 import org.apache.nifi.components.Validator;
 import org.apache.nifi.flowfile.FlowFile;
-import org.apache.nifi.processor.AbstractProcessor;
+import org.apache.nifi.processor.AbstractSessionFactoryProcessor;
+import org.apache.nifi.processor.ProcessContext;
 import org.apache.nifi.processor.ProcessSession;
+import org.apache.nifi.processor.ProcessSessionFactory;
 import org.apache.nifi.processor.Relationship;
+import org.apache.nifi.processor.exception.ProcessException;
 import org.apache.nifi.processor.io.OutputStreamCallback;
 import org.apache.nifi.processors.flume.util.FlowFileEvent;
 
 /**
- * This is a base class that is helpful when building processors interacting
- * with Flume.
+ * This is a base class that is helpful when building processors interacting with Flume.
  */
-public abstract class AbstractFlumeProcessor extends AbstractProcessor {
-  protected static final SourceFactory SOURCE_FACTORY = new DefaultSourceFactory();
-  protected static final SinkFactory SINK_FACTORY = new DefaultSinkFactory();
-
-  protected static Event flowFileToEvent(FlowFile flowFile, ProcessSession session) {
-    return new FlowFileEvent(flowFile, session);
-  }
-
-  protected static void transferEvent(final Event event, ProcessSession session,
-      Relationship relationship) {
-    FlowFile flowFile = session.create();
-    flowFile = session.putAllAttributes(flowFile, event.getHeaders());
-
-    flowFile = session.write(flowFile, new OutputStreamCallback() {
-      @Override
-      public void process(final OutputStream out) throws IOException {
-        out.write(event.getBody());
-      }
-    });
-
-    session.getProvenanceReporter().create(flowFile);
-    session.transfer(flowFile, relationship);
-  }
-
-  protected static Validator createSourceValidator() {
-    return new Validator() {
-      @Override
-      public ValidationResult validate(final String subject, final String value, final ValidationContext context) {
-        String reason = null;
-        try {
-          FlumeSourceProcessor.SOURCE_FACTORY.create("NiFi Source", value);
-        } catch (Exception ex) {
-          reason = ex.getLocalizedMessage();
-          reason = Character.toLowerCase(reason.charAt(0)) + reason.substring(1);
+public abstract class AbstractFlumeProcessor extends AbstractSessionFactoryProcessor {
+
+    protected static final SourceFactory SOURCE_FACTORY = new DefaultSourceFactory();
+    protected static final SinkFactory SINK_FACTORY = new DefaultSinkFactory();
+
+    protected static Event flowFileToEvent(FlowFile flowFile, ProcessSession session) {
+        return new FlowFileEvent(flowFile, session);
+    }
+
+    protected static void transferEvent(final Event event, ProcessSession session,
+        Relationship relationship) {
+        FlowFile flowFile = session.create();
+        flowFile = session.putAllAttributes(flowFile, event.getHeaders());
+
+        flowFile = session.write(flowFile, new OutputStreamCallback() {
+            @Override
+            public void process(final OutputStream out) throws IOException {
+                out.write(event.getBody());
+            }
+        });
+
+        session.getProvenanceReporter()
+            .create(flowFile);
+        session.transfer(flowFile, relationship);
+    }
+
+    protected static Validator createSourceValidator() {
+        return new Validator() {
+            @Override
+            public ValidationResult validate(final String subject, final String value, final ValidationContext context) {
+                String reason = null;
+                try {
+                    FlumeSourceProcessor.SOURCE_FACTORY.create("NiFi Source", value);
+                } catch (Exception ex) {
+                    reason = ex.getLocalizedMessage();
+                    reason = Character.toLowerCase(reason.charAt(0)) + reason.substring(1);
+                }
+                return new ValidationResult.Builder().subject(subject)
+                    .input(value)
+                    .explanation(reason)
+                    .valid(reason == null)
+                    .build();
+            }
+        };
+    }
+
+    protected static Validator createSinkValidator() {
+        return new Validator() {
+            @Override
+            public ValidationResult validate(final String subject, final String value, final ValidationContext context) {
+                String reason = null;
+                try {
+                    FlumeSinkProcessor.SINK_FACTORY.create("NiFi Sink", value);
+                } catch (Exception ex) {
+                    reason = ex.getLocalizedMessage();
+                    reason = Character.toLowerCase(reason.charAt(0)) + reason.substring(1);
+                }
+                return new ValidationResult.Builder().subject(subject)
+                    .input(value)
+                    .explanation(reason)
+                    .valid(reason == null)
+                    .build();
+            }
+        };
+    }
+
+    protected static Context getFlumeContext(String flumeConfig, String prefix) {
+        Properties flumeProperties = new Properties();
+        if (flumeConfig != null) {
+            try {
+                flumeProperties.load(new StringReader(flumeConfig));
+            } catch (IOException ex) {
+                throw new RuntimeException(ex);
+            }
         }
-        return new ValidationResult.Builder().subject(subject).input(value).explanation(reason).valid(reason == null).build();
-      }
-    };
-  }
-
-  protected static Validator createSinkValidator() {
-    return new Validator() {
-      @Override
-      public ValidationResult validate(final String subject, final String value, final ValidationContext context) {
-        String reason = null;
-        try {
-          FlumeSinkProcessor.SINK_FACTORY.create("NiFi Sink", value);
-        } catch (Exception ex) {
-          reason = ex.getLocalizedMessage();
-          reason = Character.toLowerCase(reason.charAt(0)) + reason.substring(1);
+        Map<String, String> parameters = Maps.newHashMap();
+        for (String property : flumeProperties.stringPropertyNames()) {
+            parameters.put(property, flumeProperties.getProperty(property));
         }
-        return new ValidationResult.Builder().subject(subject).input(value).explanation(reason).valid(reason == null).build();
-      }
-    };
-  }
-
-  protected static Context getFlumeContext(String flumeConfig, String prefix) {
-    Properties flumeProperties = new Properties();
-    if (flumeConfig != null) {
-      try {
-        flumeProperties.load(new StringReader(flumeConfig));
-      } catch (IOException ex) {
-        throw new RuntimeException(ex);
-      }
+        return new Context(new Context(parameters).getSubProperties(prefix));
     }
-    Map<String, String> parameters = Maps.newHashMap();
-    for (String property : flumeProperties.stringPropertyNames()) {
-      parameters.put(property, flumeProperties.getProperty(property));
+
+    protected static Context getFlumeSourceContext(String flumeConfig,
+        String agentName, String sourceName) {
+        return getFlumeContext(flumeConfig, agentName + ".sources." + sourceName + ".");
+    }
+
+    protected static Context getFlumeSinkContext(String flumeConfig,
+        String agentName, String sinkName) {
+        return getFlumeContext(flumeConfig, agentName + ".sinks." + sinkName + ".");
     }
-    return new Context(new Context(parameters).getSubProperties(prefix));
-  }
-
-  protected static Context getFlumeSourceContext(String flumeConfig,
-      String agentName, String sourceName) {
-    return getFlumeContext(flumeConfig, agentName + ".sources." + sourceName + ".");
-  }
-
-  protected static Context getFlumeSinkContext(String flumeConfig,
-      String agentName, String sinkName) {
-    return getFlumeContext(flumeConfig, agentName + ".sinks." + sinkName + ".");
-  }
+
+    /*
+     * Borrowed from AbstractProcessor. The FlumeSourceProcessor needs to implement this directly
+     * to handle event driven sources, but it's marked final in AbstractProcessor.
+     */
+    @Override
+    public void onTrigger(final ProcessContext context, final ProcessSessionFactory sessionFactory) throws ProcessException {
+        final ProcessSession session = sessionFactory.createSession();
+        try {
+            onTrigger(context, session);
+            session.commit();
+        } catch (final Throwable t) {
+            getLogger()
+                .error("{} failed to process due to {}; rolling back session", new Object[]{this, t});
+            session.rollback(true);
+            throw t;
+        }
+    }
+
+    public abstract void onTrigger(final ProcessContext context, final ProcessSession session) throws ProcessException;
 
 }

http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/3af73c9b/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/src/main/java/org/apache/nifi/processors/flume/FlumeSinkProcessor.java
----------------------------------------------------------------------
diff --git a/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/src/main/java/org/apache/nifi/processors/flume/FlumeSinkProcessor.java b/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/src/main/java/org/apache/nifi/processors/flume/FlumeSinkProcessor.java
index 0ffd4f1..e385921 100644
--- a/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/src/main/java/org/apache/nifi/processors/flume/FlumeSinkProcessor.java
+++ b/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/src/main/java/org/apache/nifi/processors/flume/FlumeSinkProcessor.java
@@ -19,16 +19,12 @@ package org.apache.nifi.processors.flume;
 import com.google.common.base.Throwables;
 import com.google.common.collect.ImmutableList;
 import com.google.common.collect.ImmutableSet;
-import com.google.common.collect.Lists;
 import java.util.List;
 import java.util.Set;
 import org.apache.flume.Context;
 import org.apache.flume.EventDeliveryException;
 import org.apache.flume.Sink;
-import org.apache.flume.Transaction;
-import org.apache.flume.channel.MemoryChannel;
 import org.apache.flume.conf.Configurables;
-import org.apache.jasper.compiler.JspUtil;
 import org.apache.nifi.annotation.documentation.CapabilityDescription;
 import org.apache.nifi.annotation.documentation.Tags;
 import org.apache.nifi.annotation.lifecycle.OnScheduled;
@@ -36,7 +32,6 @@ import org.apache.nifi.annotation.lifecycle.OnUnscheduled;
 
 import org.apache.nifi.components.PropertyDescriptor;
 import org.apache.nifi.components.Validator;
-import org.apache.nifi.flowfile.FlowFile;
 import org.apache.nifi.processor.ProcessContext;
 import org.apache.nifi.processor.ProcessSession;
 import org.apache.nifi.processor.ProcessorInitializationContext;
@@ -44,18 +39,14 @@ import org.apache.nifi.processor.Relationship;
 import org.apache.nifi.processor.SchedulingContext;
 import org.apache.nifi.processor.exception.ProcessException;
 import org.apache.nifi.processor.util.StandardValidators;
-import org.apache.nifi.processors.flume.util.FlowFileEvent;
 
 /**
  * This processor runs a Flume sink
  */
 @Tags({"flume", "hadoop", "get", "sink"})
-@CapabilityDescription("Generate FlowFile data from a Flume sink")
+@CapabilityDescription("Write FlowFile data to a Flume sink")
 public class FlumeSinkProcessor extends AbstractFlumeProcessor {
 
-    private Sink sink;
-    private MemoryChannel channel;
-
     public static final PropertyDescriptor SINK_TYPE = new PropertyDescriptor.Builder()
             .name("Sink Type")
             .description("The fully-qualified name of the Sink class")
@@ -83,24 +74,19 @@ public class FlumeSinkProcessor extends AbstractFlumeProcessor {
             .defaultValue("")
             .addValidator(Validator.VALID)
             .build();
-    public static final PropertyDescriptor BATCH_SIZE = new PropertyDescriptor.Builder()
-            .name("Batch Size")
-            .description("The number of FlowFiles to process in a single batch")
-            .required(true)
-            .defaultValue("100")
-            .addValidator(StandardValidators.INTEGER_VALIDATOR)
-            .build();
 
     public static final Relationship SUCCESS = new Relationship.Builder().name("success").build();
     public static final Relationship FAILURE = new Relationship.Builder().name("failure").build();
 
     private List<PropertyDescriptor> descriptors;
     private Set<Relationship> relationships;
-    private int batchSize;
+
+    private volatile Sink sink;
+    private volatile NifiSinkSessionChannel channel;
 
     @Override
     protected void init(final ProcessorInitializationContext context) {
-        this.descriptors = ImmutableList.of(SINK_TYPE, AGENT_NAME, SOURCE_NAME, FLUME_CONFIG, BATCH_SIZE);
+        this.descriptors = ImmutableList.of(SINK_TYPE, AGENT_NAME, SOURCE_NAME, FLUME_CONFIG);
         this.relationships = ImmutableSet.of(SUCCESS, FAILURE);
     }
 
@@ -116,14 +102,9 @@ public class FlumeSinkProcessor extends AbstractFlumeProcessor {
 
     @OnScheduled
     public void onScheduled(final SchedulingContext context) {
-        batchSize = context.getProperty(BATCH_SIZE).asInteger();
-
         try {
-            channel = new MemoryChannel();
-            Context memoryChannelContext = new Context();
-            memoryChannelContext.put("capacity", String.valueOf(batchSize*10));
-            memoryChannelContext.put("transactionCapacity", String.valueOf(batchSize*10));
-            Configurables.configure(channel, memoryChannelContext);
+            channel = new NifiSinkSessionChannel(SUCCESS, FAILURE);
+            Configurables.configure(channel, new Context());
             channel.start();
 
             sink = SINK_FACTORY.create(context.getProperty(SOURCE_NAME).getValue(),
@@ -152,42 +133,14 @@ public class FlumeSinkProcessor extends AbstractFlumeProcessor {
     @Override
     public void onTrigger(final ProcessContext context,
             final ProcessSession session) throws ProcessException {
-        List<FlowFile> flowFiles = Lists.newArrayListWithExpectedSize(batchSize);
-        for (int i = 0; i < batchSize; i++) {
-            FlowFile flowFile = session.get();
-            if (flowFile == null) {
-              break;
-            }
-
-            flowFiles.add(flowFile);
-        }
 
-        Transaction transaction = channel.getTransaction();
+        channel.setSession(session);
         try {
-            transaction.begin();
-            for (FlowFile flowFile : flowFiles) {
-                channel.put(new FlowFileEvent(flowFile, session));
-            }
-            transaction.commit();
-        } catch (Throwable th) {
-            transaction.rollback();
-            throw Throwables.propagate(th);
-        } finally {
-            transaction.close();
-        }
-
-        try {
-            Sink.Status status;
-            do {
-              status = sink.process();
-            } while(status == Sink.Status.READY);
-            for (FlowFile flowFile : flowFiles) {
-                session.transfer(flowFile, SUCCESS);
+            if (sink.process() == Sink.Status.BACKOFF) {
+                context.yield();
             }
         } catch (EventDeliveryException ex) {
-            for (FlowFile flowFile : flowFiles) {
-                session.transfer(flowFile, FAILURE);
-            }
+            throw new ProcessException("Flume event delivery failed", ex);
         }
     }
 }

http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/3af73c9b/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/src/main/java/org/apache/nifi/processors/flume/FlumeSourceProcessor.java
----------------------------------------------------------------------
diff --git a/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/src/main/java/org/apache/nifi/processors/flume/FlumeSourceProcessor.java b/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/src/main/java/org/apache/nifi/processors/flume/FlumeSourceProcessor.java
index 19551e6..3ded208 100644
--- a/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/src/main/java/org/apache/nifi/processors/flume/FlumeSourceProcessor.java
+++ b/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/src/main/java/org/apache/nifi/processors/flume/FlumeSourceProcessor.java
@@ -21,27 +21,25 @@ import com.google.common.collect.ImmutableList;
 import com.google.common.collect.ImmutableSet;
 import java.util.List;
 import java.util.Set;
-import org.apache.flume.Context;
-import org.apache.flume.Event;
+import java.util.concurrent.atomic.AtomicReference;
 import org.apache.flume.EventDeliveryException;
 import org.apache.flume.EventDrivenSource;
 import org.apache.flume.PollableSource;
 import org.apache.flume.Source;
-import org.apache.flume.SourceRunner;
-import org.apache.flume.Transaction;
 import org.apache.flume.channel.ChannelProcessor;
-import org.apache.flume.channel.MemoryChannel;
 import org.apache.flume.conf.Configurables;
 import org.apache.flume.source.EventDrivenSourceRunner;
 import org.apache.nifi.annotation.documentation.CapabilityDescription;
 import org.apache.nifi.annotation.documentation.Tags;
 import org.apache.nifi.annotation.lifecycle.OnScheduled;
+import org.apache.nifi.annotation.lifecycle.OnStopped;
 import org.apache.nifi.annotation.lifecycle.OnUnscheduled;
 
 import org.apache.nifi.components.PropertyDescriptor;
 import org.apache.nifi.components.Validator;
 import org.apache.nifi.processor.ProcessContext;
 import org.apache.nifi.processor.ProcessSession;
+import org.apache.nifi.processor.ProcessSessionFactory;
 import org.apache.nifi.processor.ProcessorInitializationContext;
 import org.apache.nifi.processor.Relationship;
 import org.apache.nifi.processor.SchedulingContext;
@@ -55,43 +53,48 @@ import org.apache.nifi.processor.util.StandardValidators;
 @CapabilityDescription("Generate FlowFile data from a Flume source")
 public class FlumeSourceProcessor extends AbstractFlumeProcessor {
 
-    private Source source;
-    private SourceRunner runner;
-    private MemoryChannel channel;
-
     public static final PropertyDescriptor SOURCE_TYPE = new PropertyDescriptor.Builder()
-            .name("Source Type")
-            .description("The fully-qualified name of the Source class")
-            .required(true)
-            .addValidator(createSourceValidator())
-            .build();
+        .name("Source Type")
+        .description("The fully-qualified name of the Source class")
+        .required(true)
+        .addValidator(createSourceValidator())
+        .build();
     public static final PropertyDescriptor AGENT_NAME = new PropertyDescriptor.Builder()
-            .name("Agent Name")
-            .description("The name of the agent used in the Flume source configuration")
-            .required(true)
-            .defaultValue("tier1")
-            .addValidator(StandardValidators.NON_EMPTY_VALIDATOR)
-            .build();
+        .name("Agent Name")
+        .description("The name of the agent used in the Flume source configuration")
+        .required(true)
+        .defaultValue("tier1")
+        .addValidator(StandardValidators.NON_EMPTY_VALIDATOR)
+        .build();
     public static final PropertyDescriptor SOURCE_NAME = new PropertyDescriptor.Builder()
-            .name("Source Name")
-            .description("The name of the source used in the Flume source configuration")
-            .required(true)
-            .defaultValue("src-1")
-            .addValidator(StandardValidators.NON_EMPTY_VALIDATOR)
-            .build();
+        .name("Source Name")
+        .description("The name of the source used in the Flume source configuration")
+        .required(true)
+        .defaultValue("src-1")
+        .addValidator(StandardValidators.NON_EMPTY_VALIDATOR)
+        .build();
     public static final PropertyDescriptor FLUME_CONFIG = new PropertyDescriptor.Builder()
-            .name("Flume Configuration")
-            .description("The Flume configuration for the source copied from the flume.properties file")
-            .required(true)
-            .defaultValue("")
-            .addValidator(Validator.VALID)
-            .build();
+        .name("Flume Configuration")
+        .description("The Flume configuration for the source copied from the flume.properties file")
+        .required(true)
+        .defaultValue("")
+        .addValidator(Validator.VALID)
+        .build();
 
-    public static final Relationship SUCCESS = new Relationship.Builder().name("success").build();
+    public static final Relationship SUCCESS = new Relationship.Builder().name("success")
+        .build();
 
     private List<PropertyDescriptor> descriptors;
     private Set<Relationship> relationships;
 
+    private volatile Source source;
+
+    private final NifiSessionChannel pollableSourceChannel = new NifiSessionChannel(SUCCESS);
+    private final AtomicReference<ProcessSessionFactory> sessionFactoryRef = new AtomicReference<>(null);
+    private final AtomicReference<EventDrivenSourceRunner> runnerRef = new AtomicReference<>(null);
+    private final AtomicReference<NifiSessionFactoryChannel> eventDrivenSourceChannelRef = new AtomicReference<>(null);
+    private final AtomicReference<Boolean> stopping = new AtomicReference<>(false);
+
     @Override
     protected void init(final ProcessorInitializationContext context) {
         this.descriptors = ImmutableList.of(SOURCE_TYPE, AGENT_NAME, SOURCE_NAME, FLUME_CONFIG);
@@ -111,81 +114,90 @@ public class FlumeSourceProcessor extends AbstractFlumeProcessor {
     @OnScheduled
     public void onScheduled(final SchedulingContext context) {
         try {
+            stopping.set(false);
             source = SOURCE_FACTORY.create(
-                    context.getProperty(SOURCE_NAME).getValue(),
-                    context.getProperty(SOURCE_TYPE).getValue());
-
-            String flumeConfig = context.getProperty(FLUME_CONFIG).getValue();
-            String agentName = context.getProperty(AGENT_NAME).getValue();
-            String sourceName = context.getProperty(SOURCE_NAME).getValue();
+                context.getProperty(SOURCE_NAME)
+                .getValue(),
+                context.getProperty(SOURCE_TYPE)
+                .getValue());
+
+            String flumeConfig = context.getProperty(FLUME_CONFIG)
+                .getValue();
+            String agentName = context.getProperty(AGENT_NAME)
+                .getValue();
+            String sourceName = context.getProperty(SOURCE_NAME)
+                .getValue();
             Configurables.configure(source,
-                    getFlumeSourceContext(flumeConfig, agentName, sourceName));
-
-            if (source instanceof EventDrivenSource) {
-                runner = new EventDrivenSourceRunner();
-                channel = new MemoryChannel();
-                Configurables.configure(channel, new Context());
-                channel.start();
-                source.setChannelProcessor(new ChannelProcessor(new NifiChannelSelector(channel)));
-                runner.setSource(source);
-                runner.start();
+                getFlumeSourceContext(flumeConfig, agentName, sourceName));
+
+            if (source instanceof PollableSource) {
+                source.setChannelProcessor(new ChannelProcessor(
+                    new NifiChannelSelector(pollableSourceChannel)));
+                source.start();
             }
         } catch (Throwable th) {
-            getLogger().error("Error creating source", th);
+            getLogger()
+                .error("Error creating source", th);
             throw Throwables.propagate(th);
         }
     }
 
     @OnUnscheduled
     public void unScheduled() {
-        if (runner != null) {
-            runner.stop();
-        }
-        if (channel != null) {
-            channel.stop();
+        stopping.set(true);
+        if (source instanceof PollableSource) {
+            source.stop();
+        } else {
+            EventDrivenSourceRunner runner = runnerRef.get();
+            if (runner != null) {
+                runner.stop();
+                runnerRef.compareAndSet(runner, null);
+            }
+
+            NifiSessionFactoryChannel eventDrivenSourceChannel = eventDrivenSourceChannelRef.get();
+            if (eventDrivenSourceChannel != null) {
+                eventDrivenSourceChannel.stop();
+                eventDrivenSourceChannelRef.compareAndSet(eventDrivenSourceChannel, null);
+            }
         }
     }
 
-    @Override
-    public void onTrigger(final ProcessContext context,
-            final ProcessSession session) throws ProcessException {
-        if (source instanceof EventDrivenSource) {
-            onEventDrivenTrigger(context, session);
-        } else if (source instanceof PollableSource) {
-            onPollableTrigger((PollableSource) source, context, session);
-        }
+    @OnStopped
+    public void stopped() {
+        sessionFactoryRef.set(null);
     }
 
-    public void onPollableTrigger(final PollableSource pollableSource,
-            final ProcessContext context, final ProcessSession session)
-            throws ProcessException {
-        try {
-            pollableSource.setChannelProcessor(new ChannelProcessor(
-                    new NifiChannelSelector(new NifiChannel(session, SUCCESS))));
-            pollableSource.start();
-            pollableSource.process();
-            pollableSource.stop();
-        } catch (EventDeliveryException ex) {
-            throw new ProcessException("Error processing pollable source", ex);
+    @Override
+    public void onTrigger(ProcessContext context, ProcessSessionFactory sessionFactory) throws ProcessException {
+        if (source instanceof PollableSource) {
+            super.onTrigger(context, sessionFactory);
+        } else if (source instanceof EventDrivenSource) {
+            ProcessSessionFactory old = sessionFactoryRef.getAndSet(sessionFactory);
+            if (old == null) {
+                runnerRef.set(new EventDrivenSourceRunner());
+                eventDrivenSourceChannelRef.set(new NifiSessionFactoryChannel(sessionFactoryRef.get(), SUCCESS));
+                eventDrivenSourceChannelRef.get()
+                    .start();
+                source.setChannelProcessor(new ChannelProcessor(new NifiChannelSelector(
+                    eventDrivenSourceChannelRef.get())));
+                runnerRef.get()
+                    .setSource(source);
+                runnerRef.get()
+                    .start();
+            }
         }
     }
 
-    public void onEventDrivenTrigger(final ProcessContext context, final ProcessSession session) {
-        Transaction transaction = channel.getTransaction();
-        transaction.begin();
-
-        try {
-            Event event = channel.take();
-            if (event != null) {
-                transferEvent(event, session, SUCCESS);
+    @Override
+    public void onTrigger(final ProcessContext context, final ProcessSession session) throws ProcessException {
+        if (source instanceof PollableSource) {
+            PollableSource pollableSource = (PollableSource) source;
+            try {
+                pollableSourceChannel.setSession(session);
+                pollableSource.process();
+            } catch (EventDeliveryException ex) {
+                throw new ProcessException("Error processing pollable source", ex);
             }
-            transaction.commit();
-        } catch (Throwable th) {
-            transaction.rollback();
-            throw Throwables.propagate(th);
-        } finally {
-            transaction.close();
         }
     }
-
 }

http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/3af73c9b/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/src/main/java/org/apache/nifi/processors/flume/NifiChannel.java
----------------------------------------------------------------------
diff --git a/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/src/main/java/org/apache/nifi/processors/flume/NifiChannel.java b/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/src/main/java/org/apache/nifi/processors/flume/NifiChannel.java
deleted file mode 100644
index c4d3bef..0000000
--- a/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/src/main/java/org/apache/nifi/processors/flume/NifiChannel.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.nifi.processors.flume;
-
-import org.apache.flume.Context;
-import org.apache.flume.channel.BasicChannelSemantics;
-import org.apache.flume.channel.BasicTransactionSemantics;
-import org.apache.nifi.processor.ProcessSession;
-import org.apache.nifi.processor.Relationship;
-
-
-public class NifiChannel extends BasicChannelSemantics {
-  private final ProcessSession session;
-  private final Relationship relationship;
-
-  public NifiChannel(ProcessSession session, Relationship relationship) {
-    this.session = session;
-    this.relationship = relationship;
-  }
-
-  @Override
-  protected BasicTransactionSemantics createTransaction() {
-    return new NifiTransaction(session, relationship);
-  }
-
-  @Override
-  public void configure(Context context) {
-  }
-
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/3af73c9b/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/src/main/java/org/apache/nifi/processors/flume/NifiSessionChannel.java
----------------------------------------------------------------------
diff --git a/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/src/main/java/org/apache/nifi/processors/flume/NifiSessionChannel.java b/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/src/main/java/org/apache/nifi/processors/flume/NifiSessionChannel.java
new file mode 100644
index 0000000..4c111af
--- /dev/null
+++ b/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/src/main/java/org/apache/nifi/processors/flume/NifiSessionChannel.java
@@ -0,0 +1,47 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.nifi.processors.flume;
+
+import org.apache.flume.Context;
+import org.apache.flume.channel.BasicChannelSemantics;
+import org.apache.flume.channel.BasicTransactionSemantics;
+import org.apache.nifi.processor.ProcessSession;
+import org.apache.nifi.processor.Relationship;
+
+public class NifiSessionChannel extends BasicChannelSemantics {
+
+    private ProcessSession session;
+    private final Relationship relationship;
+
+    public NifiSessionChannel(Relationship relationship) {
+        this.relationship = relationship;
+    }
+
+    public void setSession(ProcessSession session) {
+        this.session = session;
+    }
+
+    @Override
+    protected BasicTransactionSemantics createTransaction() {
+        return new NifiTransaction(session, relationship);
+    }
+
+    @Override
+    public void configure(Context context) {
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/3af73c9b/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/src/main/java/org/apache/nifi/processors/flume/NifiSessionFactoryChannel.java
----------------------------------------------------------------------
diff --git a/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/src/main/java/org/apache/nifi/processors/flume/NifiSessionFactoryChannel.java b/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/src/main/java/org/apache/nifi/processors/flume/NifiSessionFactoryChannel.java
new file mode 100644
index 0000000..bc56587
--- /dev/null
+++ b/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/src/main/java/org/apache/nifi/processors/flume/NifiSessionFactoryChannel.java
@@ -0,0 +1,51 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.nifi.processors.flume;
+
+import org.apache.flume.ChannelFullException;
+import org.apache.flume.Context;
+import org.apache.flume.channel.BasicChannelSemantics;
+import org.apache.flume.channel.BasicTransactionSemantics;
+import org.apache.flume.lifecycle.LifecycleState;
+import org.apache.nifi.processor.ProcessSessionFactory;
+import org.apache.nifi.processor.Relationship;
+
+public class NifiSessionFactoryChannel extends BasicChannelSemantics {
+
+    private final ProcessSessionFactory sessionFactory;
+    private final Relationship relationship;
+
+    public NifiSessionFactoryChannel(ProcessSessionFactory sessionFactory, Relationship relationship) {
+        this.sessionFactory = sessionFactory;
+        this.relationship = relationship;
+    }
+
+    @Override
+    protected BasicTransactionSemantics createTransaction() {
+        LifecycleState lifecycleState = getLifecycleState();
+        if (lifecycleState == LifecycleState.STOP) {
+            throw new ChannelFullException("Can't write to a stopped channel");
+            //return null;
+        }
+        return new NifiTransaction(sessionFactory.createSession(), relationship);
+    }
+
+    @Override
+    public void configure(Context context) {
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/3af73c9b/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/src/main/java/org/apache/nifi/processors/flume/NifiSinkSessionChannel.java
----------------------------------------------------------------------
diff --git a/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/src/main/java/org/apache/nifi/processors/flume/NifiSinkSessionChannel.java b/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/src/main/java/org/apache/nifi/processors/flume/NifiSinkSessionChannel.java
new file mode 100644
index 0000000..5621b6d
--- /dev/null
+++ b/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/src/main/java/org/apache/nifi/processors/flume/NifiSinkSessionChannel.java
@@ -0,0 +1,49 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.nifi.processors.flume;
+
+import org.apache.flume.Context;
+import org.apache.flume.channel.BasicChannelSemantics;
+import org.apache.flume.channel.BasicTransactionSemantics;
+import org.apache.nifi.processor.ProcessSession;
+import org.apache.nifi.processor.Relationship;
+
+public class NifiSinkSessionChannel extends BasicChannelSemantics {
+
+    private ProcessSession session;
+    private final Relationship success;
+    private final Relationship failure;
+
+    public NifiSinkSessionChannel(Relationship success, Relationship failure) {
+        this.success = success;
+        this.failure = failure;
+    }
+
+    public void setSession(ProcessSession session) {
+        this.session = session;
+    }
+
+    @Override
+    protected BasicTransactionSemantics createTransaction() {
+        return new NifiSinkTransaction(session, success, failure);
+    }
+
+    @Override
+    public void configure(Context context) {
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/3af73c9b/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/src/main/java/org/apache/nifi/processors/flume/NifiSinkTransaction.java
----------------------------------------------------------------------
diff --git a/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/src/main/java/org/apache/nifi/processors/flume/NifiSinkTransaction.java b/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/src/main/java/org/apache/nifi/processors/flume/NifiSinkTransaction.java
new file mode 100644
index 0000000..837652f
--- /dev/null
+++ b/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/src/main/java/org/apache/nifi/processors/flume/NifiSinkTransaction.java
@@ -0,0 +1,71 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.nifi.processors.flume;
+
+import java.util.ArrayList;
+import java.util.List;
+import org.apache.flume.Event;
+import org.apache.flume.channel.BasicTransactionSemantics;
+import org.apache.nifi.flowfile.FlowFile;
+import org.apache.nifi.processor.ProcessSession;
+import org.apache.nifi.processor.Relationship;
+import org.apache.nifi.processors.flume.util.FlowFileEvent;
+
+
+class NifiSinkTransaction extends BasicTransactionSemantics {
+  private final ProcessSession session;
+  private final Relationship success;
+  private final Relationship failure;
+  private final List<FlowFile> flowFiles;
+
+  public NifiSinkTransaction(ProcessSession session, Relationship success, Relationship failure) {
+    this.session = session;
+    this.success = success;
+    this.failure = failure;
+    this.flowFiles = new ArrayList<>();
+  }
+
+  @Override
+  protected void doPut(Event event) throws InterruptedException {
+    AbstractFlumeProcessor.transferEvent(event, session, success);
+  }
+
+  @Override
+  protected Event doTake() throws InterruptedException {
+      FlowFile flowFile = session.get();
+      if (flowFile == null) {
+          return null;
+      }
+      flowFiles.add(flowFile);
+
+      return new FlowFileEvent(flowFile, session);
+  }
+
+  @Override
+  protected void doCommit() throws InterruptedException {
+      session.transfer(flowFiles, success);
+      session.commit();
+  }
+
+  @Override
+  protected void doRollback() throws InterruptedException {
+      session.transfer(flowFiles, failure);
+      session.commit();
+  }
+
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/3af73c9b/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/src/main/java/org/apache/nifi/processors/flume/NifiTransaction.java
----------------------------------------------------------------------
diff --git a/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/src/main/java/org/apache/nifi/processors/flume/NifiTransaction.java b/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/src/main/java/org/apache/nifi/processors/flume/NifiTransaction.java
index 37c8a50..8de50ec 100644
--- a/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/src/main/java/org/apache/nifi/processors/flume/NifiTransaction.java
+++ b/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/src/main/java/org/apache/nifi/processors/flume/NifiTransaction.java
@@ -21,35 +21,34 @@ import org.apache.flume.channel.BasicTransactionSemantics;
 import org.apache.nifi.processor.ProcessSession;
 import org.apache.nifi.processor.Relationship;
 
-
 class NifiTransaction extends BasicTransactionSemantics {
-  private final ProcessSession session;
-  private final Relationship relationship;
-
-  public NifiTransaction(ProcessSession session, Relationship relationship) {
-    this.session = session;
-    this.relationship = relationship;
-  }
-
-  @Override
-  protected void doPut(Event event) throws InterruptedException {
-    AbstractFlumeProcessor.transferEvent(event, session, relationship);
-  }
-
-  @Override
-  protected Event doTake() throws InterruptedException {
-    throw new UnsupportedOperationException("Only put supported");
-  }
-
-  @Override
-  protected void doCommit() throws InterruptedException {
-    session.commit();
-  }
-
-  @Override
-  protected void doRollback() throws InterruptedException {
-    session.rollback();
-  }
 
+    private final ProcessSession session;
+    private final Relationship relationship;
+
+    public NifiTransaction(ProcessSession session, Relationship relationship) {
+        this.session = session;
+        this.relationship = relationship;
+    }
+
+    @Override
+    protected void doPut(Event event) throws InterruptedException {
+        AbstractFlumeProcessor.transferEvent(event, session, relationship);
+    }
+
+    @Override
+    protected Event doTake() throws InterruptedException {
+        throw new UnsupportedOperationException("Only put supported");
+    }
+
+    @Override
+    protected void doCommit() throws InterruptedException {
+        session.commit();
+    }
+
+    @Override
+    protected void doRollback() throws InterruptedException {
+        session.rollback();
+    }
 
 }

http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/3af73c9b/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/src/test/java/org/apache/nifi/processors/flume/FlumeSinkProcessorTest.java
----------------------------------------------------------------------
diff --git a/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/src/test/java/org/apache/nifi/processors/flume/FlumeSinkProcessorTest.java b/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/src/test/java/org/apache/nifi/processors/flume/FlumeSinkProcessorTest.java
index 2e10c24..0654138 100644
--- a/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/src/test/java/org/apache/nifi/processors/flume/FlumeSinkProcessorTest.java
+++ b/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/src/test/java/org/apache/nifi/processors/flume/FlumeSinkProcessorTest.java
@@ -126,13 +126,12 @@ public class FlumeSinkProcessorTest {
     public void testBatchSize() throws IOException {
         TestRunner runner = TestRunners.newTestRunner(FlumeSinkProcessor.class);
         runner.setProperty(FlumeSinkProcessor.SINK_TYPE, NullSink.class.getName());
-        runner.setProperty(FlumeSinkProcessor.BATCH_SIZE, "1000");
         runner.setProperty(FlumeSinkProcessor.FLUME_CONFIG,
             "tier1.sinks.sink-1.batchSize = 1000\n");
         for (int i = 0; i < 100000; i++) {
           runner.enqueue(String.valueOf(i).getBytes());
         }
-        runner.run();
+        runner.run(100);
     }
 
     @Test

http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/3af73c9b/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/src/test/java/org/apache/nifi/processors/flume/FlumeSourceProcessorTest.java
----------------------------------------------------------------------
diff --git a/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/src/test/java/org/apache/nifi/processors/flume/FlumeSourceProcessorTest.java b/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/src/test/java/org/apache/nifi/processors/flume/FlumeSourceProcessorTest.java
index 043e115..32feb1e 100644
--- a/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/src/test/java/org/apache/nifi/processors/flume/FlumeSourceProcessorTest.java
+++ b/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/src/test/java/org/apache/nifi/processors/flume/FlumeSourceProcessorTest.java
@@ -127,11 +127,8 @@ public class FlumeSourceProcessorTest {
         runner.setProperty(FlumeSinkProcessor.FLUME_CONFIG,
             "tier1.sources.src-1.spoolDir = " + spoolDirectory.getAbsolutePath());
         runner.run();
-        List<MockFlowFile> flowFiles = runner.getFlowFilesForRelationship(FlumeSourceProcessor.SUCCESS);
-        Assert.assertEquals(1, flowFiles.size());
-        for (MockFlowFile flowFile : flowFiles) {
-            Assert.assertEquals(8, flowFile.getSize());
-            flowFile.assertContentEquals("record 1");
-        }
+        // No data will be transfered because of how quickly the test runner
+        // starts shutting down
+        runner.assertTransferCount(FlumeSourceProcessor.SUCCESS, 0);
     }
 }

http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/3af73c9b/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/src/test/resources/log4j.properties
----------------------------------------------------------------------
diff --git a/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/src/test/resources/log4j.properties b/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/src/test/resources/log4j.properties
index 8c502ec..cc58727 100644
--- a/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/src/test/resources/log4j.properties
+++ b/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/src/test/resources/log4j.properties
@@ -17,4 +17,6 @@ log4j.rootLogger=INFO, CONSOLE
 log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender
 
 log4j.appender.CONSOLE.layout=org.apache.log4j.PatternLayout
-log4j.appender.CONSOLE.layout.ConversionPattern=%-4r [%t] %-5p %c %x \u2013 %m%n
\ No newline at end of file
+log4j.appender.CONSOLE.layout.ConversionPattern=%-4r [%t] %-5p %c %x \u2013 %m%n
+
+log4j.logger.org.apache.flume = DEBUG
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/3af73c9b/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/src/test/resources/simplelogger.properties
----------------------------------------------------------------------
diff --git a/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/src/test/resources/simplelogger.properties b/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/src/test/resources/simplelogger.properties
index 4994e7f..e3d4fc1 100644
--- a/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/src/test/resources/simplelogger.properties
+++ b/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/src/test/resources/simplelogger.properties
@@ -18,3 +18,4 @@ org.slf4j.simpleLogger.showDateTime=true
 org.slf4j.simpleLogger.dateTimeFormat=yyyy-MM-dd HH:mm:ss.SSS
 org.slf4j.simpleLogger.levelInBrackets=true
 org.slf4j.simpleLogger.log.org.apache.nifi.processors.flume=debug
+org.slf4j.simpleLogger.log.org.apache.flume=debug

http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/3af73c9b/nifi/nifi-nar-bundles/nifi-flume-bundle/pom.xml
----------------------------------------------------------------------
diff --git a/nifi/nifi-nar-bundles/nifi-flume-bundle/pom.xml b/nifi/nifi-nar-bundles/nifi-flume-bundle/pom.xml
index 50b0fde..a2742aa 100644
--- a/nifi/nifi-nar-bundles/nifi-flume-bundle/pom.xml
+++ b/nifi/nifi-nar-bundles/nifi-flume-bundle/pom.xml
@@ -17,10 +17,10 @@
     <parent>
         <groupId>org.apache.nifi</groupId>
         <artifactId>nifi-nar-bundles</artifactId>
-        <version>0.1.0-incubating-SNAPSHOT</version>
+        <version>0.2.0-incubating-SNAPSHOT</version>
     </parent>
     <artifactId>nifi-flume-bundle</artifactId>
-    <version>0.1.0-incubating-SNAPSHOT</version>
+    <version>0.2.0-incubating-SNAPSHOT</version>
     <packaging>pom</packaging>
     <description>A bundle of processors that run Flume sources/sinks</description>
     <modules>


[04/13] incubator-nifi git commit: Added the sink's relationships to the relationship set. Added error checkign and logging for sink/source creation. Fixed an issue with transaction managemetn in the sink. Reformatted per coding standard.

Posted by mc...@apache.org.
Added the sink's relationships to the relationship set. Added error checkign and logging for sink/source creation. Fixed an issue with transaction managemetn in the sink. Reformatted per coding standard.

Signed-off-by: Matt Gilman <ma...@gmail.com>


Project: http://git-wip-us.apache.org/repos/asf/incubator-nifi/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-nifi/commit/cf29029a
Tree: http://git-wip-us.apache.org/repos/asf/incubator-nifi/tree/cf29029a
Diff: http://git-wip-us.apache.org/repos/asf/incubator-nifi/diff/cf29029a

Branch: refs/heads/develop
Commit: cf29029a4db4cc606b417889296abb97e460d586
Parents: b251ab4
Author: Joey Echeverria <jo...@cloudera.com>
Authored: Fri Jan 30 14:21:21 2015 -0500
Committer: Matt Gilman <ma...@gmail.com>
Committed: Tue Jul 14 14:50:16 2015 -0400

----------------------------------------------------------------------
 nifi/nifi-assembly/pom.xml                      |   3 +
 .../nifi-flume-bundle/nifi-flume-nar/pom.xml    |   5 +
 .../processors/flume/FlumeSinkProcessor.java    | 218 ++++++++--------
 .../processors/flume/FlumeSourceProcessor.java  | 253 ++++++++++---------
 .../flume/FlumeSinkProcessorTest.java           |   2 -
 nifi/pom.xml                                    |   5 +
 6 files changed, 257 insertions(+), 229 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/cf29029a/nifi/nifi-assembly/pom.xml
----------------------------------------------------------------------
diff --git a/nifi/nifi-assembly/pom.xml b/nifi/nifi-assembly/pom.xml
index c679d22..4f4879f 100644
--- a/nifi/nifi-assembly/pom.xml
+++ b/nifi/nifi-assembly/pom.xml
@@ -165,6 +165,9 @@ language governing permissions and limitations under the License. -->
         <dependency>
             <groupId>org.apache.nifi</groupId>
             <artifactId>nifi-kite-nar</artifactId>
+        <dependency>
+            <groupId>org.apache.nifi</groupId>
+            <artifactId>nifi-flume-nar</artifactId>
             <type>nar</type>
         </dependency>
         <dependency>

http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/cf29029a/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-nar/pom.xml
----------------------------------------------------------------------
diff --git a/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-nar/pom.xml b/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-nar/pom.xml
index c5333b6..dff440e 100644
--- a/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-nar/pom.xml
+++ b/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-nar/pom.xml
@@ -27,5 +27,10 @@
             <groupId>org.apache.nifi</groupId>
             <artifactId>nifi-flume-processors</artifactId>
         </dependency>
+        <dependency>
+            <groupId>org.apache.nifi</groupId>
+            <artifactId>nifi-hadoop-libraries-nar</artifactId>
+            <type>nar</type>
+        </dependency>
     </dependencies>
 </project>

http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/cf29029a/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/src/main/java/org/apache/nifi/processors/flume/FlumeSinkProcessor.java
----------------------------------------------------------------------
diff --git a/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/src/main/java/org/apache/nifi/processors/flume/FlumeSinkProcessor.java b/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/src/main/java/org/apache/nifi/processors/flume/FlumeSinkProcessor.java
index 4603d18..fc97ae8 100644
--- a/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/src/main/java/org/apache/nifi/processors/flume/FlumeSinkProcessor.java
+++ b/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/src/main/java/org/apache/nifi/processors/flume/FlumeSinkProcessor.java
@@ -27,6 +27,10 @@ import org.apache.flume.Sink;
 import org.apache.flume.Transaction;
 import org.apache.flume.channel.MemoryChannel;
 import org.apache.flume.conf.Configurables;
+import org.apache.nifi.annotation.documentation.CapabilityDescription;
+import org.apache.nifi.annotation.documentation.Tags;
+import org.apache.nifi.annotation.lifecycle.OnScheduled;
+import org.apache.nifi.annotation.lifecycle.OnUnscheduled;
 
 import org.apache.nifi.components.PropertyDescriptor;
 import org.apache.nifi.components.Validator;
@@ -36,122 +40,122 @@ import org.apache.nifi.processor.ProcessSession;
 import org.apache.nifi.processor.ProcessorInitializationContext;
 import org.apache.nifi.processor.Relationship;
 import org.apache.nifi.processor.SchedulingContext;
-import org.apache.nifi.processor.annotation.CapabilityDescription;
-import org.apache.nifi.processor.annotation.OnScheduled;
-import org.apache.nifi.processor.annotation.OnUnscheduled;
-import org.apache.nifi.processor.annotation.Tags;
 import org.apache.nifi.processor.exception.ProcessException;
 import org.apache.nifi.processor.util.StandardValidators;
 import org.apache.nifi.processors.flume.util.FlowFileEvent;
 
 /**
- * This processor runs a Flume sink 
+ * This processor runs a Flume sink
  */
-@Tags({"flume", "hadoop", "get", "sink" })
+@Tags({"flume", "hadoop", "get", "sink"})
 @CapabilityDescription("Generate FlowFile data from a Flume sink")
 public class FlumeSinkProcessor extends AbstractFlumeProcessor {
 
-  private Sink sink;
-  private MemoryChannel channel;
-
-  public static final PropertyDescriptor SINK_TYPE = new PropertyDescriptor.Builder()
-      .name("Sink Type")
-      .description("The fully-qualified name of the Sink class")
-      .required(true)
-      .addValidator(createSinkValidator())
-      .build();
-  public static final PropertyDescriptor AGENT_NAME = new PropertyDescriptor.Builder()
-      .name("Agent Name")
-      .description("The name of the agent used in the Flume sink configuration")
-      .required(true)
-      .defaultValue("tier1")
-      .addValidator(StandardValidators.NON_EMPTY_VALIDATOR)
-      .build();
-  public static final PropertyDescriptor SOURCE_NAME = new PropertyDescriptor.Builder()
-      .name("Sink Name")
-      .description("The name of the sink used in the Flume sink configuration")
-      .required(true)
-      .defaultValue("sink-1")
-      .addValidator(StandardValidators.NON_EMPTY_VALIDATOR)
-      .build();
-  public static final PropertyDescriptor FLUME_CONFIG = new PropertyDescriptor.Builder()
-      .name("Flume Configuration")
-      .description("The Flume configuration for the sink copied from the flume.properties file")
-      .required(true)
-      .defaultValue("")
-      .addValidator(Validator.VALID)
-      .build();
-
-  public static final Relationship SUCCESS = new Relationship.Builder().name("success").build();
-  public static final Relationship FAILURE = new Relationship.Builder().name("failure").build();
-
-  private List<PropertyDescriptor> descriptors;
-  private Set<Relationship> relationships;
-
-
-  @Override
-  protected void init(final ProcessorInitializationContext context) {
-    this.descriptors = ImmutableList.of(SINK_TYPE, AGENT_NAME, SOURCE_NAME, FLUME_CONFIG);
-    this.relationships = ImmutableSet.of();
-  }
-
-  @Override
-  protected List<PropertyDescriptor> getSupportedPropertyDescriptors() {
-    return descriptors;
-  }
-
-  @Override
-  public Set<Relationship> getRelationships() {
-    return relationships;
-  }
-
-  @OnScheduled
-  public void onScheduled(final SchedulingContext context) {
-    channel = new MemoryChannel();
-    Configurables.configure(channel, new Context());
-    channel.start();
-
-    sink = SINK_FACTORY.create(context.getProperty(SOURCE_NAME).getValue(),
-        context.getProperty(SINK_TYPE).getValue());
-    sink.setChannel(channel);
-
-    String flumeConfig = context.getProperty(FLUME_CONFIG).getValue();
-    String agentName = context.getProperty(AGENT_NAME).getValue();
-    String sinkName = context.getProperty(SOURCE_NAME).getValue();
-    Configurables.configure(sink,
-        getFlumeSinkContext(flumeConfig, agentName, sinkName) );
-
-    sink.start();
-  }
-
-  @OnUnscheduled
-  public void unScheduled() {
-    sink.stop();
-    channel.stop();
-  }
-
-  @Override
-  public void onTrigger(final ProcessContext context,
-      final ProcessSession session) throws ProcessException {
-    FlowFile flowFile = session.get();
-
-    Transaction transaction = channel.getTransaction();
-    try {
-      transaction.begin();
-      channel.put(new FlowFileEvent(flowFile, session));
-      transaction.commit();
-    } catch (Throwable th) {
-      transaction.rollback();
-      throw Throwables.propagate(th);
-    } finally {
-      transaction.close();
+    private Sink sink;
+    private MemoryChannel channel;
+
+    public static final PropertyDescriptor SINK_TYPE = new PropertyDescriptor.Builder()
+            .name("Sink Type")
+            .description("The fully-qualified name of the Sink class")
+            .required(true)
+            .addValidator(createSinkValidator())
+            .build();
+    public static final PropertyDescriptor AGENT_NAME = new PropertyDescriptor.Builder()
+            .name("Agent Name")
+            .description("The name of the agent used in the Flume sink configuration")
+            .required(true)
+            .defaultValue("tier1")
+            .addValidator(StandardValidators.NON_EMPTY_VALIDATOR)
+            .build();
+    public static final PropertyDescriptor SOURCE_NAME = new PropertyDescriptor.Builder()
+            .name("Sink Name")
+            .description("The name of the sink used in the Flume sink configuration")
+            .required(true)
+            .defaultValue("sink-1")
+            .addValidator(StandardValidators.NON_EMPTY_VALIDATOR)
+            .build();
+    public static final PropertyDescriptor FLUME_CONFIG = new PropertyDescriptor.Builder()
+            .name("Flume Configuration")
+            .description("The Flume configuration for the sink copied from the flume.properties file")
+            .required(true)
+            .defaultValue("")
+            .addValidator(Validator.VALID)
+            .build();
+
+    public static final Relationship SUCCESS = new Relationship.Builder().name("success").build();
+    public static final Relationship FAILURE = new Relationship.Builder().name("failure").build();
+
+    private List<PropertyDescriptor> descriptors;
+    private Set<Relationship> relationships;
+
+    @Override
+    protected void init(final ProcessorInitializationContext context) {
+        this.descriptors = ImmutableList.of(SINK_TYPE, AGENT_NAME, SOURCE_NAME, FLUME_CONFIG);
+        this.relationships = ImmutableSet.of(SUCCESS, FAILURE);
     }
 
-    try {
-      sink.process();
-      session.transfer(flowFile, SUCCESS);
-    } catch (EventDeliveryException ex) {
-      session.transfer(flowFile, FAILURE);
+    @Override
+    protected List<PropertyDescriptor> getSupportedPropertyDescriptors() {
+        return descriptors;
     }
-  }
-}
\ No newline at end of file
+
+    @Override
+    public Set<Relationship> getRelationships() {
+        return relationships;
+    }
+
+    @OnScheduled
+    public void onScheduled(final SchedulingContext context) {
+        try {
+            channel = new MemoryChannel();
+            Configurables.configure(channel, new Context());
+            channel.start();
+
+            sink = SINK_FACTORY.create(context.getProperty(SOURCE_NAME).getValue(),
+                    context.getProperty(SINK_TYPE).getValue());
+            sink.setChannel(channel);
+
+            String flumeConfig = context.getProperty(FLUME_CONFIG).getValue();
+            String agentName = context.getProperty(AGENT_NAME).getValue();
+            String sinkName = context.getProperty(SOURCE_NAME).getValue();
+            Configurables.configure(sink,
+                    getFlumeSinkContext(flumeConfig, agentName, sinkName));
+
+            sink.start();
+        } catch (Throwable th) {
+            getLogger().error("Error creating sink", th);
+            throw Throwables.propagate(th);
+        }
+    }
+
+    @OnUnscheduled
+    public void unScheduled() {
+        sink.stop();
+        channel.stop();
+    }
+
+    @Override
+    public void onTrigger(final ProcessContext context,
+            final ProcessSession session) throws ProcessException {
+        FlowFile flowFile = session.get();
+
+        Transaction transaction = channel.getTransaction();
+        try {
+            transaction.begin();
+            channel.put(new FlowFileEvent(flowFile, session));
+            transaction.commit();
+        } catch (Throwable th) {
+            transaction.rollback();
+            throw Throwables.propagate(th);
+        } finally {
+            transaction.close();
+        }
+
+        try {
+            sink.process();
+            session.transfer(flowFile, SUCCESS);
+        } catch (EventDeliveryException ex) {
+            session.transfer(flowFile, FAILURE);
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/cf29029a/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/src/main/java/org/apache/nifi/processors/flume/FlumeSourceProcessor.java
----------------------------------------------------------------------
diff --git a/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/src/main/java/org/apache/nifi/processors/flume/FlumeSourceProcessor.java b/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/src/main/java/org/apache/nifi/processors/flume/FlumeSourceProcessor.java
index 8b8388c..19551e6 100644
--- a/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/src/main/java/org/apache/nifi/processors/flume/FlumeSourceProcessor.java
+++ b/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/src/main/java/org/apache/nifi/processors/flume/FlumeSourceProcessor.java
@@ -16,6 +16,7 @@
  */
 package org.apache.nifi.processors.flume;
 
+import com.google.common.base.Throwables;
 import com.google.common.collect.ImmutableList;
 import com.google.common.collect.ImmutableSet;
 import java.util.List;
@@ -32,6 +33,10 @@ import org.apache.flume.channel.ChannelProcessor;
 import org.apache.flume.channel.MemoryChannel;
 import org.apache.flume.conf.Configurables;
 import org.apache.flume.source.EventDrivenSourceRunner;
+import org.apache.nifi.annotation.documentation.CapabilityDescription;
+import org.apache.nifi.annotation.documentation.Tags;
+import org.apache.nifi.annotation.lifecycle.OnScheduled;
+import org.apache.nifi.annotation.lifecycle.OnUnscheduled;
 
 import org.apache.nifi.components.PropertyDescriptor;
 import org.apache.nifi.components.Validator;
@@ -40,139 +45,147 @@ import org.apache.nifi.processor.ProcessSession;
 import org.apache.nifi.processor.ProcessorInitializationContext;
 import org.apache.nifi.processor.Relationship;
 import org.apache.nifi.processor.SchedulingContext;
-import org.apache.nifi.processor.annotation.CapabilityDescription;
-import org.apache.nifi.processor.annotation.OnScheduled;
-import org.apache.nifi.processor.annotation.OnUnscheduled;
-import org.apache.nifi.processor.annotation.Tags;
 import org.apache.nifi.processor.exception.ProcessException;
 import org.apache.nifi.processor.util.StandardValidators;
 
 /**
- * This processor runs a Flume source 
+ * This processor runs a Flume source
  */
-@Tags({"flume", "hadoop", "get", "source" })
+@Tags({"flume", "hadoop", "get", "source"})
 @CapabilityDescription("Generate FlowFile data from a Flume source")
 public class FlumeSourceProcessor extends AbstractFlumeProcessor {
-  
-  private Source source;
-  private SourceRunner runner;
-  private MemoryChannel channel;
-
-  public static final PropertyDescriptor SOURCE_TYPE = new PropertyDescriptor.Builder()
-      .name("Source Type")
-      .description("The fully-qualified name of the Source class")
-      .required(true)
-      .addValidator(createSourceValidator())
-      .build();
-  public static final PropertyDescriptor AGENT_NAME = new PropertyDescriptor.Builder()
-      .name("Agent Name")
-      .description("The name of the agent used in the Flume source configuration")
-      .required(true)
-      .defaultValue("tier1")
-      .addValidator(StandardValidators.NON_EMPTY_VALIDATOR)
-      .build();
-  public static final PropertyDescriptor SOURCE_NAME = new PropertyDescriptor.Builder()
-      .name("Source Name")
-      .description("The name of the source used in the Flume source configuration")
-      .required(true)
-      .defaultValue("src-1")
-      .addValidator(StandardValidators.NON_EMPTY_VALIDATOR)
-      .build();
-  public static final PropertyDescriptor FLUME_CONFIG = new PropertyDescriptor.Builder()
-      .name("Flume Configuration")
-      .description("The Flume configuration for the source copied from the flume.properties file")
-      .required(true)
-      .defaultValue("")
-      .addValidator(Validator.VALID)
-      .build();
-
-  public static final Relationship SUCCESS = new Relationship.Builder().name("success").build();
-
-  private List<PropertyDescriptor> descriptors;
-  private Set<Relationship> relationships;
-
-
-  @Override
-  protected void init(final ProcessorInitializationContext context) {
-    this.descriptors = ImmutableList.of(SOURCE_TYPE, AGENT_NAME, SOURCE_NAME, FLUME_CONFIG);
-    this.relationships = ImmutableSet.of(SUCCESS);
-  }
-
-  @Override
-  protected List<PropertyDescriptor> getSupportedPropertyDescriptors() {
-    return descriptors;
-  }
-
-  @Override
-  public Set<Relationship> getRelationships() {
-    return relationships;
-  }
-
-  @OnScheduled
-  public void onScheduled(final SchedulingContext context) {
-    source = SOURCE_FACTORY.create(
-        context.getProperty(SOURCE_NAME).getValue(),
-        context.getProperty(SOURCE_TYPE).getValue());
-    
-    String flumeConfig = context.getProperty(FLUME_CONFIG).getValue();
-    String agentName = context.getProperty(AGENT_NAME).getValue();
-    String sourceName = context.getProperty(SOURCE_NAME).getValue();
-    Configurables.configure(source,
-        getFlumeSourceContext(flumeConfig, agentName, sourceName) );
-
-    if (source instanceof EventDrivenSource) {
-      runner = new EventDrivenSourceRunner();
-      channel = new MemoryChannel();
-      Configurables.configure(channel, new Context());
-      channel.start();
-      source.setChannelProcessor(new ChannelProcessor(new NifiChannelSelector(channel)));
-      runner.setSource(source);
-      runner.start();
-    } 
-  }
-
-  @OnUnscheduled
-  public void unScheduled() {
-    if (runner != null) {
-      runner.stop();
+
+    private Source source;
+    private SourceRunner runner;
+    private MemoryChannel channel;
+
+    public static final PropertyDescriptor SOURCE_TYPE = new PropertyDescriptor.Builder()
+            .name("Source Type")
+            .description("The fully-qualified name of the Source class")
+            .required(true)
+            .addValidator(createSourceValidator())
+            .build();
+    public static final PropertyDescriptor AGENT_NAME = new PropertyDescriptor.Builder()
+            .name("Agent Name")
+            .description("The name of the agent used in the Flume source configuration")
+            .required(true)
+            .defaultValue("tier1")
+            .addValidator(StandardValidators.NON_EMPTY_VALIDATOR)
+            .build();
+    public static final PropertyDescriptor SOURCE_NAME = new PropertyDescriptor.Builder()
+            .name("Source Name")
+            .description("The name of the source used in the Flume source configuration")
+            .required(true)
+            .defaultValue("src-1")
+            .addValidator(StandardValidators.NON_EMPTY_VALIDATOR)
+            .build();
+    public static final PropertyDescriptor FLUME_CONFIG = new PropertyDescriptor.Builder()
+            .name("Flume Configuration")
+            .description("The Flume configuration for the source copied from the flume.properties file")
+            .required(true)
+            .defaultValue("")
+            .addValidator(Validator.VALID)
+            .build();
+
+    public static final Relationship SUCCESS = new Relationship.Builder().name("success").build();
+
+    private List<PropertyDescriptor> descriptors;
+    private Set<Relationship> relationships;
+
+    @Override
+    protected void init(final ProcessorInitializationContext context) {
+        this.descriptors = ImmutableList.of(SOURCE_TYPE, AGENT_NAME, SOURCE_NAME, FLUME_CONFIG);
+        this.relationships = ImmutableSet.of(SUCCESS);
     }
-    if (channel != null) {
-      channel.stop();
+
+    @Override
+    protected List<PropertyDescriptor> getSupportedPropertyDescriptors() {
+        return descriptors;
     }
-  }
-
-  @Override
-  public void onTrigger(final ProcessContext context,
-      final ProcessSession session) throws ProcessException {
-    if (source instanceof EventDrivenSource) {
-      onEventDrivenTrigger(context, session);
-    } else if (source instanceof PollableSource) {
-      onPollableTrigger((PollableSource)source, context, session);
+
+    @Override
+    public Set<Relationship> getRelationships() {
+        return relationships;
     }
-  }
-
-  public void onPollableTrigger(final PollableSource pollableSource,
-      final ProcessContext context, final ProcessSession session)
-      throws ProcessException {
-    try {
-      pollableSource.setChannelProcessor(new ChannelProcessor(
-          new NifiChannelSelector(new NifiChannel(session, SUCCESS))));
-      pollableSource.start();
-      pollableSource.process();
-      pollableSource.stop();
-    } catch (EventDeliveryException ex) {
-      throw new ProcessException("Error processing pollable source", ex);
+
+    @OnScheduled
+    public void onScheduled(final SchedulingContext context) {
+        try {
+            source = SOURCE_FACTORY.create(
+                    context.getProperty(SOURCE_NAME).getValue(),
+                    context.getProperty(SOURCE_TYPE).getValue());
+
+            String flumeConfig = context.getProperty(FLUME_CONFIG).getValue();
+            String agentName = context.getProperty(AGENT_NAME).getValue();
+            String sourceName = context.getProperty(SOURCE_NAME).getValue();
+            Configurables.configure(source,
+                    getFlumeSourceContext(flumeConfig, agentName, sourceName));
+
+            if (source instanceof EventDrivenSource) {
+                runner = new EventDrivenSourceRunner();
+                channel = new MemoryChannel();
+                Configurables.configure(channel, new Context());
+                channel.start();
+                source.setChannelProcessor(new ChannelProcessor(new NifiChannelSelector(channel)));
+                runner.setSource(source);
+                runner.start();
+            }
+        } catch (Throwable th) {
+            getLogger().error("Error creating source", th);
+            throw Throwables.propagate(th);
+        }
     }
-  }
 
-  public void onEventDrivenTrigger(final ProcessContext context, final ProcessSession session) {
-    Transaction transaction = channel.getTransaction();
-    transaction.begin();
+    @OnUnscheduled
+    public void unScheduled() {
+        if (runner != null) {
+            runner.stop();
+        }
+        if (channel != null) {
+            channel.stop();
+        }
+    }
+
+    @Override
+    public void onTrigger(final ProcessContext context,
+            final ProcessSession session) throws ProcessException {
+        if (source instanceof EventDrivenSource) {
+            onEventDrivenTrigger(context, session);
+        } else if (source instanceof PollableSource) {
+            onPollableTrigger((PollableSource) source, context, session);
+        }
+    }
+
+    public void onPollableTrigger(final PollableSource pollableSource,
+            final ProcessContext context, final ProcessSession session)
+            throws ProcessException {
+        try {
+            pollableSource.setChannelProcessor(new ChannelProcessor(
+                    new NifiChannelSelector(new NifiChannel(session, SUCCESS))));
+            pollableSource.start();
+            pollableSource.process();
+            pollableSource.stop();
+        } catch (EventDeliveryException ex) {
+            throw new ProcessException("Error processing pollable source", ex);
+        }
+    }
 
-    Event event = channel.take();
-    if (event != null) {
-      transferEvent(event, session, SUCCESS);
+    public void onEventDrivenTrigger(final ProcessContext context, final ProcessSession session) {
+        Transaction transaction = channel.getTransaction();
+        transaction.begin();
+
+        try {
+            Event event = channel.take();
+            if (event != null) {
+                transferEvent(event, session, SUCCESS);
+            }
+            transaction.commit();
+        } catch (Throwable th) {
+            transaction.rollback();
+            throw Throwables.propagate(th);
+        } finally {
+            transaction.close();
+        }
     }
-  }
 
 }

http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/cf29029a/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/src/test/java/org/apache/nifi/processors/flume/FlumeSinkProcessorTest.java
----------------------------------------------------------------------
diff --git a/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/src/test/java/org/apache/nifi/processors/flume/FlumeSinkProcessorTest.java b/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/src/test/java/org/apache/nifi/processors/flume/FlumeSinkProcessorTest.java
index 4f2cef7..8d40cb6 100644
--- a/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/src/test/java/org/apache/nifi/processors/flume/FlumeSinkProcessorTest.java
+++ b/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/src/test/java/org/apache/nifi/processors/flume/FlumeSinkProcessorTest.java
@@ -18,7 +18,6 @@ package org.apache.nifi.processors.flume;
 
 import java.io.File;
 import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
 
 import java.io.FileInputStream;
 import java.io.FilenameFilter;
@@ -40,7 +39,6 @@ import org.apache.nifi.util.TestRunners;
 import org.apache.nifi.util.file.FileUtils;
 
 import org.junit.Assert;
-import org.junit.Ignore;
 import org.junit.Test;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;

http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/cf29029a/nifi/pom.xml
----------------------------------------------------------------------
diff --git a/nifi/pom.xml b/nifi/pom.xml
index 0c71ba8..422e1aa 100644
--- a/nifi/pom.xml
+++ b/nifi/pom.xml
@@ -805,6 +805,11 @@
                 <artifactId>nifi-geo-nar</artifactId>
                 <version>0.2.0-incubating-SNAPSHOT</version>
                 <type>nar</type>
+            <dependency>
+                <groupId>org.apache.nifi</groupId>
+                <artifactId>nifi-flume-nar</artifactId>
+                <version>0.0.1-incubating-SNAPSHOT</version>
+                <type>nar</type>
             </dependency>
             <dependency>
                 <groupId>org.apache.nifi</groupId>


[05/13] incubator-nifi git commit: NIFI-589: Set java.io.tmpdir to ${build.project.directory}

Posted by mc...@apache.org.
NIFI-589: Set java.io.tmpdir to ${build.project.directory}

This lets us use TemporaryDirectory and get the benefits of cleaning
up temporary files using `mvn clean`

Signed-off-by: Matt Gilman <ma...@gmail.com>


Project: http://git-wip-us.apache.org/repos/asf/incubator-nifi/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-nifi/commit/419f9455
Tree: http://git-wip-us.apache.org/repos/asf/incubator-nifi/tree/419f9455
Diff: http://git-wip-us.apache.org/repos/asf/incubator-nifi/diff/419f9455

Branch: refs/heads/develop
Commit: 419f9455a21eeb2b0bf6360204ee1175b62df805
Parents: 3529bb3
Author: Joey Echeverria <jo...@gmail.com>
Authored: Fri Jun 5 15:32:16 2015 -0700
Committer: Matt Gilman <ma...@gmail.com>
Committed: Tue Jul 14 14:50:16 2015 -0400

----------------------------------------------------------------------
 .../nifi-flume-bundle/nifi-flume-processors/pom.xml         | 9 +++++++++
 1 file changed, 9 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/419f9455/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/pom.xml
----------------------------------------------------------------------
diff --git a/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/pom.xml b/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/pom.xml
index b903f21..b0e730c 100644
--- a/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/pom.xml
+++ b/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/pom.xml
@@ -136,6 +136,15 @@
                     </excludes>
                 </configuration>
             </plugin>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-surefire-plugin</artifactId>
+                <configuration>
+                    <systemPropertyVariables>
+                        <java.io.tmpdir>${project.build.directory}</java.io.tmpdir>
+                    </systemPropertyVariables>
+                </configuration>
+            </plugin>
         </plugins>
     </build>
 </project>


[13/13] incubator-nifi git commit: NIFI-589: - Tweaking license files.

Posted by mc...@apache.org.
NIFI-589:
- Tweaking license files.

Project: http://git-wip-us.apache.org/repos/asf/incubator-nifi/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-nifi/commit/6f3039c8
Tree: http://git-wip-us.apache.org/repos/asf/incubator-nifi/tree/6f3039c8
Diff: http://git-wip-us.apache.org/repos/asf/incubator-nifi/diff/6f3039c8

Branch: refs/heads/develop
Commit: 6f3039c8c38d6af399f5a896fb7879db111ab4fe
Parents: 2a3deed
Author: Matt Gilman <ma...@gmail.com>
Authored: Tue Jul 14 17:11:08 2015 -0400
Committer: Matt Gilman <ma...@gmail.com>
Committed: Tue Jul 14 17:11:08 2015 -0400

----------------------------------------------------------------------
 nifi/nifi-assembly/NOTICE                       | 63 ++++++++++++++++++++
 .../src/main/resources/META-INF/NOTICE          | 53 +++++++++++++++-
 2 files changed, 113 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/6f3039c8/nifi/nifi-assembly/NOTICE
----------------------------------------------------------------------
diff --git a/nifi/nifi-assembly/NOTICE b/nifi/nifi-assembly/NOTICE
index 23c07b7..f71f98c 100644
--- a/nifi/nifi-assembly/NOTICE
+++ b/nifi/nifi-assembly/NOTICE
@@ -108,6 +108,69 @@ The following binary components are provided under the Apache Software License v
       Spring Framework 4.1.4.RELEASE
       Copyright (c) 2002-2015 Pivotal, Inc.
 
+  (ASLv2) Apache Flume
+    The following NOTICE information applies:
+      Apache Flume
+      Copyright 2011-2015 Apache Software Foundation
+
+      asynchbase is BSD-licensed software (https://github.com/OpenTSDB/asynchbase)
+
+      async is BSD-licensed software (https://github.com/stumbleupon/async)
+
+      jopt-simple is MIT licensed software (http://pholser.github.io/jopt-simple/license.html)
+
+      scala-library is BSD-like licensed software (http://www.scala-lang.org/license.html)
+
+  (ASLv2) Xalan
+     This product includes software developed by
+      The Apache Software Foundation (http://www.apache.org/).
+
+      Portions of this software was originally based on the following:
+
+        - software copyright (c) 1999-2002, Lotus Development Corporation., http://www.lotus.com.
+        - software copyright (c) 2001-2002, Sun Microsystems., http://www.sun.com.
+        - software copyright (c) 2003, IBM Corporation., http://www.ibm.com.
+        - voluntary contributions made by Ovidiu Predescu (ovidiu@cup.hp.com) on behalf of the 
+          Apache Software Foundation and was originally developed at Hewlett Packard Company.
+
+  (ASLv2) Apache XML Commons XML APIs
+    Copyright 2006 The Apache Software Foundation.
+
+    This product includes software developed at
+    The Apache Software Foundation (http://www.apache.org/).
+
+    Portions of this software were originally based on the following:
+      - software copyright (c) 1999, IBM Corporation., http://www.ibm.com.
+      - software copyright (c) 1999, Sun Microsystems., http://www.sun.com.
+      - software copyright (c) 2000 World Wide Web Consortium, http://www.w3.org
+
+  (ASLv2) IRClib
+    The following NOTICE information applies:
+      IRClib -- A Java Internet Relay Chat library --
+      Copyright (C) 2002 - 2006 Christoph Schwering <sc...@gmail.com>
+
+  (ASLv2) Apache Thrift
+    The following NOTICE information applies:
+      Apache Thrift
+      Copyright 2006-2010 The Apache Software Foundation.
+
+  (ASLv2) Apache MINA
+    The following NOTICE information applies:
+      Apache MINA Core
+      Copyright 2004-2011 Apache MINA Project
+
+  (ASLv2) opencsv (net.sf.opencsv:opencsv:2.3)
+
+  (ASLv2) Apache Velocity
+    The following NOTICE information applies:
+      Apache Velocity
+      Copyright (C) 2000-2007 The Apache Software Foundation
+
+  (ASLv2) ZkClient
+    The following NOTICE information applies:
+      ZkClient
+      Copyright 2009 Stefan Groschupf
+
   (ASLv2) Apache Commons CLI
     The following NOTICE information applies:
       Apache Commons CLI

http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/6f3039c8/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-nar/src/main/resources/META-INF/NOTICE
----------------------------------------------------------------------
diff --git a/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-nar/src/main/resources/META-INF/NOTICE b/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-nar/src/main/resources/META-INF/NOTICE
index 793746f..b651143 100644
--- a/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-nar/src/main/resources/META-INF/NOTICE
+++ b/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-nar/src/main/resources/META-INF/NOTICE
@@ -1,4 +1,4 @@
-nifi-social-media-nar
+nifi-flume-nar
 Copyright 2015 The Apache Software Foundation
 
 This product includes software developed at
@@ -33,6 +33,50 @@ The following binary components are provided under the Apache Software License v
       Apache Flume
       Copyright 2011-2015 Apache Software Foundation
 
+      asynchbase is BSD-licensed software (https://github.com/OpenTSDB/asynchbase)
+
+      async is BSD-licensed software (https://github.com/stumbleupon/async)
+
+      jopt-simple is MIT licensed software (http://pholser.github.io/jopt-simple/license.html)
+
+      scala-library is BSD-like licensed software (http://www.scala-lang.org/license.html)
+
+  (ASLv2) Xalan
+     This product includes software developed by
+      The Apache Software Foundation (http://www.apache.org/).
+
+      Portions of this software was originally based on the following:
+
+        - software copyright (c) 1999-2002, Lotus Development Corporation., http://www.lotus.com.
+        - software copyright (c) 2001-2002, Sun Microsystems., http://www.sun.com.
+        - software copyright (c) 2003, IBM Corporation., http://www.ibm.com.
+        - voluntary contributions made by Ovidiu Predescu (ovidiu@cup.hp.com) on behalf of the 
+          Apache Software Foundation and was originally developed at Hewlett Packard Company.
+
+  (ASLv2) Apache Xerces Java
+    Copyright 1999-2007 The Apache Software Foundation
+
+    This product includes software developed at
+    The Apache Software Foundation (http://www.apache.org/).
+
+    Portions of this software were originally based on the following:
+      - software copyright (c) 1999, IBM Corporation., http://www.ibm.com.
+      - software copyright (c) 1999, Sun Microsystems., http://www.sun.com.
+      - voluntary contributions made by Paul Eng on behalf of the 
+        Apache Software Foundation that were originally developed at iClick, Inc.,
+        software copyright (c) 1999.
+
+  (ASLv2) Apache XML Commons XML APIs
+   Copyright 2006 The Apache Software Foundation.
+
+   This product includes software developed at
+   The Apache Software Foundation (http://www.apache.org/).
+
+   Portions of this software were originally based on the following:
+     - software copyright (c) 1999, IBM Corporation., http://www.ibm.com.
+     - software copyright (c) 1999, Sun Microsystems., http://www.sun.com.
+     - software copyright (c) 2000 World Wide Web Consortium, http://www.w3.org
+
   (ASLv2) IRClib
     The following NOTICE information applies:
       IRClib -- A Java Internet Relay Chat library --
@@ -126,7 +170,10 @@ The following binary components are provided under the Apache Software License v
       Apache License Version 2.0 http://www.apache.org/licenses/.
       (c) Daniel Lemire, http://lemire.me/en/
 
-  (ASLv2) Servlet Specification API (org.mortbay.jetty:servlet-api:2.5-20110124)
+  (ASLv2) Jetty
+    The following NOTICE information applies:
+       Jetty Web Container
+       Copyright 1995-2015 Mort Bay Consulting Pty Ltd.
 
   (ASLv2) Twitter4J
     The following NOTICE information applies:
@@ -142,4 +189,4 @@ The following binary components are provided under the Apache Software License v
   (ASLv2) ZkClient
     The following NOTICE information applies:
       ZkClient
-      Copyright 2009 Stefan Groschupf
\ No newline at end of file
+      Copyright 2009 Stefan Groschupf


[10/13] incubator-nifi git commit: More review feedback from Ryan:

Posted by mc...@apache.org.
More review feedback from Ryan:

* Removed unnecessary call to configure our channel
* Removed call to context.yield() when Flume reports a backoff
* Handled the session factory changing when using a event driven source.

Signed-off-by: Matt Gilman <ma...@gmail.com>


Project: http://git-wip-us.apache.org/repos/asf/incubator-nifi/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-nifi/commit/16134a2d
Tree: http://git-wip-us.apache.org/repos/asf/incubator-nifi/tree/16134a2d
Diff: http://git-wip-us.apache.org/repos/asf/incubator-nifi/diff/16134a2d

Branch: refs/heads/develop
Commit: 16134a2dfedf2f05f7d798082bfd86a5a13bda5a
Parents: c4dd1e6
Author: Joey Echeverria <jo...@gmail.com>
Authored: Wed Jun 10 15:08:03 2015 -0700
Committer: Matt Gilman <ma...@gmail.com>
Committed: Tue Jul 14 14:50:17 2015 -0400

----------------------------------------------------------------------
 .../org/apache/nifi/processors/flume/FlumeSinkProcessor.java   | 5 +----
 .../org/apache/nifi/processors/flume/FlumeSourceProcessor.java | 6 +++++-
 2 files changed, 6 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/16134a2d/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/src/main/java/org/apache/nifi/processors/flume/FlumeSinkProcessor.java
----------------------------------------------------------------------
diff --git a/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/src/main/java/org/apache/nifi/processors/flume/FlumeSinkProcessor.java b/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/src/main/java/org/apache/nifi/processors/flume/FlumeSinkProcessor.java
index 9ec1b07..2d8506d 100644
--- a/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/src/main/java/org/apache/nifi/processors/flume/FlumeSinkProcessor.java
+++ b/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/src/main/java/org/apache/nifi/processors/flume/FlumeSinkProcessor.java
@@ -104,7 +104,6 @@ public class FlumeSinkProcessor extends AbstractFlumeProcessor {
     public void onScheduled(final SchedulingContext context) {
         try {
             channel = new NifiSinkSessionChannel(SUCCESS, FAILURE);
-            Configurables.configure(channel, new Context());
             channel.start();
 
             sink = SINK_FACTORY.create(context.getProperty(SOURCE_NAME).getValue(),
@@ -135,9 +134,7 @@ public class FlumeSinkProcessor extends AbstractFlumeProcessor {
 
         channel.setSession(session);
         try {
-            if (sink.process() == Sink.Status.BACKOFF) {
-                context.yield();
-            }
+            sink.process();
         } catch (EventDeliveryException ex) {
             throw new ProcessException("Flume event delivery failed", ex);
         }

http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/16134a2d/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/src/main/java/org/apache/nifi/processors/flume/FlumeSourceProcessor.java
----------------------------------------------------------------------
diff --git a/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/src/main/java/org/apache/nifi/processors/flume/FlumeSourceProcessor.java b/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/src/main/java/org/apache/nifi/processors/flume/FlumeSourceProcessor.java
index 1ebf05c..55b1f2f 100644
--- a/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/src/main/java/org/apache/nifi/processors/flume/FlumeSourceProcessor.java
+++ b/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/src/main/java/org/apache/nifi/processors/flume/FlumeSourceProcessor.java
@@ -165,7 +165,11 @@ public class FlumeSourceProcessor extends AbstractFlumeProcessor {
             super.onTrigger(context, sessionFactory);
         } else if (source instanceof EventDrivenSource) {
             ProcessSessionFactory old = sessionFactoryRef.getAndSet(sessionFactory);
-            if (old == null) {
+            if (old != sessionFactory) {
+                if (runnerRef.get() != null) {
+                    stopped();
+                }
+
                 runnerRef.set(new EventDrivenSourceRunner());
                 eventDrivenSourceChannelRef.set(new NifiSessionFactoryChannel(sessionFactoryRef.get(), SUCCESS));
                 eventDrivenSourceChannelRef.get().start();


[09/13] incubator-nifi git commit: Added detailed documentation for the ExecuteFlumeSource/Sink processors

Posted by mc...@apache.org.
Added detailed documentation for the ExecuteFlumeSource/Sink processors

Signed-off-by: Matt Gilman <ma...@gmail.com>


Project: http://git-wip-us.apache.org/repos/asf/incubator-nifi/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-nifi/commit/e7e15fac
Tree: http://git-wip-us.apache.org/repos/asf/incubator-nifi/tree/e7e15fac
Diff: http://git-wip-us.apache.org/repos/asf/incubator-nifi/diff/e7e15fac

Branch: refs/heads/develop
Commit: e7e15facc4587a7cd0862d3b8f00a280b15392fa
Parents: 286e473
Author: Joey Echeverria <jo...@gmail.com>
Authored: Sun Jul 12 18:44:16 2015 -0700
Committer: Matt Gilman <ma...@gmail.com>
Committed: Tue Jul 14 14:50:17 2015 -0400

----------------------------------------------------------------------
 .../nifi/processors/flume/ExecuteFlumeSink.java |   7 +-
 .../processors/flume/ExecuteFlumeSource.java    |   4 +-
 .../org.apache.nifi.processor.Processor         |   4 +-
 .../additionalDetails.html                      | 159 +++++++++++++++++++
 .../additionalDetails.html                      | 114 +++++++++++++
 5 files changed, 280 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/e7e15fac/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/src/main/java/org/apache/nifi/processors/flume/ExecuteFlumeSink.java
----------------------------------------------------------------------
diff --git a/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/src/main/java/org/apache/nifi/processors/flume/ExecuteFlumeSink.java b/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/src/main/java/org/apache/nifi/processors/flume/ExecuteFlumeSink.java
index 8ccb2d1..94251b4 100644
--- a/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/src/main/java/org/apache/nifi/processors/flume/ExecuteFlumeSink.java
+++ b/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/src/main/java/org/apache/nifi/processors/flume/ExecuteFlumeSink.java
@@ -21,7 +21,6 @@ import com.google.common.collect.ImmutableList;
 import com.google.common.collect.ImmutableSet;
 import java.util.List;
 import java.util.Set;
-import org.apache.flume.Context;
 import org.apache.flume.EventDeliveryException;
 import org.apache.flume.Sink;
 import org.apache.flume.conf.Configurables;
@@ -44,14 +43,14 @@ import org.apache.nifi.processor.util.StandardValidators;
 /**
  * This processor runs a Flume sink
  */
-@Tags({"flume", "hadoop", "get", "sink"})
-@CapabilityDescription("Write FlowFile data to a Flume sink")
+@Tags({"flume", "hadoop", "put", "sink"})
+@CapabilityDescription("Execute a Flume sink. Each input FlowFile is converted into a Flume Event for processing by the sink.")
 @TriggerSerially
 public class ExecuteFlumeSink extends AbstractFlumeProcessor {
 
     public static final PropertyDescriptor SINK_TYPE = new PropertyDescriptor.Builder()
             .name("Sink Type")
-            .description("The fully-qualified name of the Sink class")
+            .description("The component type name for the sink. For some sinks, this is a short, symbolic name (e.g. hdfs). For others, it's the fully-qualified name of the Sink class. See the Flume User Guide for details.")
             .required(true)
             .addValidator(createSinkValidator())
             .build();

http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/e7e15fac/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/src/main/java/org/apache/nifi/processors/flume/ExecuteFlumeSource.java
----------------------------------------------------------------------
diff --git a/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/src/main/java/org/apache/nifi/processors/flume/ExecuteFlumeSource.java b/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/src/main/java/org/apache/nifi/processors/flume/ExecuteFlumeSource.java
index fa02750..fa4fbe6 100644
--- a/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/src/main/java/org/apache/nifi/processors/flume/ExecuteFlumeSource.java
+++ b/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/src/main/java/org/apache/nifi/processors/flume/ExecuteFlumeSource.java
@@ -50,13 +50,13 @@ import org.apache.nifi.processor.util.StandardValidators;
  * This processor runs a Flume source
  */
 @Tags({"flume", "hadoop", "get", "source"})
-@CapabilityDescription("Generate FlowFile data from a Flume source")
+@CapabilityDescription("Execute a Flume source. Each Flume Event is sent to the success relationship as a FlowFile")
 @TriggerSerially
 public class ExecuteFlumeSource extends AbstractFlumeProcessor {
 
     public static final PropertyDescriptor SOURCE_TYPE = new PropertyDescriptor.Builder()
         .name("Source Type")
-        .description("The fully-qualified name of the Source class")
+        .description("The component type name for the source. For some sources, this is a short, symbolic name (e.g. spooldir). For others, it's the fully-qualified name of the Source class. See the Flume User Guide for details.")
         .required(true)
         .addValidator(createSourceValidator())
         .build();

http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/e7e15fac/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/src/main/resources/META-INF/services/org.apache.nifi.processor.Processor
----------------------------------------------------------------------
diff --git a/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/src/main/resources/META-INF/services/org.apache.nifi.processor.Processor b/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/src/main/resources/META-INF/services/org.apache.nifi.processor.Processor
index fae8727..f5b57e1 100644
--- a/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/src/main/resources/META-INF/services/org.apache.nifi.processor.Processor
+++ b/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/src/main/resources/META-INF/services/org.apache.nifi.processor.Processor
@@ -12,5 +12,5 @@
 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 # See the License for the specific language governing permissions and
 # limitations under the License.
-org.apache.nifi.processors.flume.FlumeSourceProcessor
-org.apache.nifi.processors.flume.FlumeSinkProcessor
+org.apache.nifi.processors.flume.ExecuteFlumeSource
+org.apache.nifi.processors.flume.ExecuteFlumeSink

http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/e7e15fac/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/src/main/resources/docs/org.apache.nifi.processors.flume.ExecuteFlumeSink/additionalDetails.html
----------------------------------------------------------------------
diff --git a/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/src/main/resources/docs/org.apache.nifi.processors.flume.ExecuteFlumeSink/additionalDetails.html b/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/src/main/resources/docs/org.apache.nifi.processors.flume.ExecuteFlumeSink/additionalDetails.html
new file mode 100644
index 0000000..be8b99f
--- /dev/null
+++ b/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/src/main/resources/docs/org.apache.nifi.processors.flume.ExecuteFlumeSink/additionalDetails.html
@@ -0,0 +1,159 @@
+<!DOCTYPE html>
+<html lang="en">
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+      http://www.apache.org/licenses/LICENSE-2.0
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+-->
+<head>
+    <meta charset="utf-8" />
+    <title>ExecuteFlumeSink</title>
+    <link rel="stylesheet" href="../../css/component-usage.css" type="text/css" />
+</head>
+
+<body>
+<h2>Data Model</h2>
+<p>
+    This processor executes an Apache Flume sink. FlowFiles are wrapped in Flume's
+    Event interface. The content of the FlowFile becomes the body of the Event and
+    the attributes of the FlowFile become Event headers. The following special
+    headers are also set:
+</p>
+<table id="headers">
+    <tr>
+        <th>Flume Event Header</th>
+        <th>FlowFile Attribute</th>
+    </tr>
+    <tr>
+        <td>nifi.entry.date</td>
+        <td>FlowFile#getEntryDate()</td>
+    </tr>
+    <tr>
+        <td>nifi.id</td>
+        <td>FlowFile#getId()</td>
+    </tr>
+    <tr>
+        <td>nifi.last.queue.date</td>
+        <td>FlowFile#getLastQueueDate()</td>
+    </tr>
+    <tr>
+        <td>nifi.lineage.identifiers.${i}</td>
+        <td>FlowFile#getLineageIdentifiers()[i]</td>
+    </tr>
+    <tr>
+        <td>nifi.lineage.start.date</td>
+        <td>FlowFile#getLineageStartDate()</td>
+    </tr>
+    <tr>
+        <td>nifi.size</td>
+        <td>FlowFile#getSize()</td>
+    </tr>
+</table>
+<h2>Warning</h2>
+<p>
+    In NiFi, the contents of a FlowFile are accessed via a stream, but in Flume it is
+    stored in a byte array. This means the full content will be loaded into memory when
+    a FlowFile is processed by the ExecuteFlumeSink processor. You should consider the
+    typical size of the FlowFiles you'll process and the batch size, if any, your sink
+    is configured with when setting NiFi's heap size.
+</p>
+<h2>Configuration Details</h2>
+<p>
+    This processor is designed to execute arbitrary Flume sinks. Most of the details
+    of configuring the sink is deferred to Flume's built-in configuration system.
+    For details on the available settings for each sink type, refer to the Flume
+    <a href="http://flume.apache.org/FlumeUserGuide.html#flume-sinks">User Guide</a>.
+    Configuring the Flume sink is a four step process:
+</p>
+<ol>
+    <li>Set the Sink Type property to a valid Flume sink type.</li>
+    <li>
+        Set the Agent Name property to the name of the agent in your
+        Flume configuration. This is the prefix of the properties in the Flume
+        configuration file. Example: <code>tier1</code>
+    </li>
+    <li>
+        Set the Sink Name property to the name of the sink in your Flume
+        configuration. If Agent Name is <code>tier1</code>, then the Sink Name
+        is the value of the <code>tier1.sinks</code> property. Example: <code>sink-1</code>
+    </li>
+    <li>
+        Copy and paste the configuration for the sink from your Flume configuration
+        file into the Flume Configuration property. Assuming you're using
+        the same Agent Name and Sink Name as in the examples above, this will be all
+        of the properties that start with <code>tier1.sinks.sink-1</code>.
+        Do not copy the <code>tier1.sinks.sink-1.type</code> or
+        <code>tier1.sinks.sink-1.channel</code> properties.
+    </li>
+</ol>
+<h2>Usage Example</h2>
+<p>
+    Assuming you had the following existing Flume configuration file:
+</p>
+    <pre>
+a1.sources = r1
+a1.sinks = k1
+a1.channels = c1
+
+a1.sources.r1.type = netcat
+a1.sources.r1.bind = localhost
+a1.sources.r1.port = 44444
+
+a1.sinks.k1.type = hdfs
+a1.sinks.k1.channel = c1
+a1.sinks.k1.hdfs.path = /flume/events/%y-%m-%d/%H%M/%S
+a1.sinks.k1.hdfs.filePrefix = events-
+a1.sinks.k1.hdfs.round = true
+a1.sinks.k1.hdfs.roundValue = 10
+a1.sinks.k1.hdfs.roundUnit = minute
+
+a1.channels.c1.type = memory
+a1.channels.c1.capacity = 1000
+a1.channels.c1.transactionCapacity = 100
+
+a1.sources.r1.channels = c1
+a1.sinks.k1.channel = c1</pre>
+<p>
+    Then you'd configure the ExecuteFlumeSink as follows:
+</p>
+<table id="example">
+    <tr>
+        <th>Property</th>
+        <th>Value</th>
+    </tr>
+    <tr>
+        <td>Sink Type</td>
+        <td>hdfs</td>
+    </tr>
+    <tr>
+        <td>Agent Name</td>
+        <td>a1</td>
+    </tr>
+    <tr>
+        <td>Sink Name</td>
+        <td>k1</td>
+    </tr>
+    <tr>
+        <td>Flume Configuration</td>
+        <td>
+            <code>
+                a1.sinks.k1.hdfs.path = /flume/events/%y-%m-%d/%H%M/%S<br>
+                a1.sinks.k1.hdfs.filePrefix = events-<br>
+                a1.sinks.k1.hdfs.round = true<br>
+                a1.sinks.k1.hdfs.roundValue = 10<br>
+                a1.sinks.k1.hdfs.roundUnit = minute
+            </code>
+        </td>
+    </tr>
+</table>
+</body>
+</html>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/e7e15fac/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/src/main/resources/docs/org.apache.nifi.processors.flume.ExecuteFlumeSource/additionalDetails.html
----------------------------------------------------------------------
diff --git a/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/src/main/resources/docs/org.apache.nifi.processors.flume.ExecuteFlumeSource/additionalDetails.html b/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/src/main/resources/docs/org.apache.nifi.processors.flume.ExecuteFlumeSource/additionalDetails.html
new file mode 100644
index 0000000..3d1062b
--- /dev/null
+++ b/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/src/main/resources/docs/org.apache.nifi.processors.flume.ExecuteFlumeSource/additionalDetails.html
@@ -0,0 +1,114 @@
+<!DOCTYPE html>
+<html lang="en">
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+      http://www.apache.org/licenses/LICENSE-2.0
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+-->
+<head>
+    <meta charset="utf-8" />
+    <title>ExecuteFlumeSource</title>
+    <link rel="stylesheet" href="../../css/component-usage.css" type="text/css" />
+</head>
+
+<body>
+<h2>Data Model</h2>
+<p>
+    This processor executes an Apache Flume source. Each Flume Event is turned into
+    a FlowFile. The content of the FlowFile is set to the body of the Event and
+    the Event headers become FlowFile attributes.
+</p>
+<h2>Configuration Details</h2>
+<p>
+    This processor is designed to execute arbitrary Flume sources. Most of the details
+    of configuring the source is deferred to Flume's built-in configuration system.
+    For details on the available settings for each source type, refer to the Flume
+    <a href="http://flume.apache.org/FlumeUserGuide.html#flume-sources">User Guide</a>.
+    Configuring the Flume source is a four step process:
+</p>
+<ol>
+    <li>Set the Source Type property to a valid Flume source type.</li>
+    <li>
+        Set the Agent Name property to the name of the agent in your
+        Flume configuration. This is the prefix of the properties in the Flume
+        configuration file. Example: <code>tier1</code>
+    </li>
+    <li>
+        Set the Source Name property to the name of the source in your Flume
+        configuration. If Agent Name is <code>tier1</code>, then the Source Name
+        is the value of the <code>tier1.sources</code> property. Example: <code>src-1</code>
+    </li>
+    <li>
+        Copy and paste the configuration for the source from your Flume configuration
+        file into the Flume Configuration property. Assuming you're using
+        the same Agent Name and Source Name as in the examples above, this will be all
+        of the properties that start with <code>tier1.sources.src-1</code>.
+        Do not copy the <code>tier1.sources.src-1.type</code> or
+        <code>tier1.sources.src-1.channel</code> properties.
+    </li>
+</ol>
+<h2>Usage Example</h2>
+<p>
+    Assuming you had the following existing Flume configuration file:
+</p>
+    <pre>
+a1.sources = r1
+a1.sinks = k1
+a1.channels = c1
+
+a1.sources.r1.type = multiport_syslogtcp
+a1.sources.r1.channels = c1
+a1.sources.r1.host = 0.0.0.0
+a1.sources.r1.ports = 10001 10002 10003
+a1.sources.r1.portHeader = port
+
+a1.sinks.k1.type = logger
+
+a1.channels.c1.type = memory
+a1.channels.c1.capacity = 1000
+a1.channels.c1.transactionCapacity = 100
+
+a1.sources.r1.channels = c1
+a1.sinks.k1.channel = c1</pre>
+<p>
+    Then you'd configure the ExecuteFlumeSource as follows:
+</p>
+<table id="example">
+    <tr>
+        <th>Property</th>
+        <th>Value</th>
+    </tr>
+    <tr>
+        <td>Source Type</td>
+        <td>multiport_syslogtcp</td>
+    </tr>
+    <tr>
+        <td>Agent Name</td>
+        <td>a1</td>
+    </tr>
+    <tr>
+        <td>Source Name</td>
+        <td>r1</td>
+    </tr>
+    <tr>
+        <td>Flume Configuration</td>
+        <td>
+            <code>
+                a1.sources.r1.host = 0.0.0.0<br>
+                a1.sources.r1.ports = 10001 10002 10003<br>
+                a1.sources.r1.portHeader = port
+            </code>
+        </td>
+    </tr>
+</table>
+</body>
+</html>
\ No newline at end of file


[12/13] incubator-nifi git commit: Implemented Joe's review feedback:

Posted by mc...@apache.org.
Implemented Joe's review feedback:

* Renamed processors to ExecuteFlume*
* Added a LICENSE and NOTICE file to the nar
* Fixed the version number inconsistency in the POMs

Signed-off-by: Matt Gilman <ma...@gmail.com>


Project: http://git-wip-us.apache.org/repos/asf/incubator-nifi/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-nifi/commit/286e4738
Tree: http://git-wip-us.apache.org/repos/asf/incubator-nifi/tree/286e4738
Diff: http://git-wip-us.apache.org/repos/asf/incubator-nifi/diff/286e4738

Branch: refs/heads/develop
Commit: 286e4738b8bea6e8a386b630822a897ca07410d2
Parents: 16134a2
Author: Joey Echeverria <jo...@gmail.com>
Authored: Sun Jul 12 13:33:09 2015 -0700
Committer: Matt Gilman <ma...@gmail.com>
Committed: Tue Jul 14 14:50:17 2015 -0400

----------------------------------------------------------------------
 .../nifi-flume-bundle/nifi-flume-nar/pom.xml    |  95 ++++++
 .../src/main/resources/META-INF/LICENSE         | 319 +++++++++++++++++++
 .../src/main/resources/META-INF/NOTICE          | 145 +++++++++
 .../nifi-flume-processors/pom.xml               |  50 ++-
 .../flume/AbstractFlumeProcessor.java           |   4 +-
 .../nifi/processors/flume/ExecuteFlumeSink.java | 144 +++++++++
 .../processors/flume/ExecuteFlumeSource.java    | 194 +++++++++++
 .../processors/flume/FlumeSinkProcessor.java    | 142 ---------
 .../processors/flume/FlumeSourceProcessor.java  | 196 ------------
 .../flume/NifiSessionFactoryChannel.java        |   1 -
 .../processors/flume/util/FlowFileEvent.java    |   9 +-
 .../processors/flume/ExecuteFlumeSinkTest.java  | 167 ++++++++++
 .../flume/ExecuteFlumeSourceTest.java           | 150 +++++++++
 .../flume/FlumeSinkProcessorTest.java           | 167 ----------
 .../flume/FlumeSourceProcessorTest.java         | 150 ---------
 nifi/nifi-nar-bundles/nifi-flume-bundle/pom.xml |   2 +-
 nifi/pom.xml                                    |  10 +-
 17 files changed, 1267 insertions(+), 678 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/286e4738/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-nar/pom.xml
----------------------------------------------------------------------
diff --git a/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-nar/pom.xml b/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-nar/pom.xml
index c07cedf..a9bbe6f 100644
--- a/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-nar/pom.xml
+++ b/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-nar/pom.xml
@@ -26,6 +26,101 @@
         <dependency>
             <groupId>org.apache.nifi</groupId>
             <artifactId>nifi-flume-processors</artifactId>
+            <!-- The following are inherited from nifi-hadoop-libraries-nar -->
+            <exclusions>
+                <exclusion>
+                    <groupId>org.apache.hadoop</groupId>
+                    <artifactId>hadoop-client</artifactId>
+                </exclusion>
+                <exclusion>
+                    <groupId>org.xerial.snappy</groupId>
+                    <artifactId>snappy-java</artifactId>
+                </exclusion>
+                <exclusion>
+                    <groupId>com.thoughtworks.paranamer</groupId>
+                    <artifactId>paranamer</artifactId>
+                </exclusion>
+                <exclusion>
+                    <groupId>org.codehaus.jackson</groupId>
+                    <artifactId>jackson-mapper-asl</artifactId>
+                </exclusion>
+                <exclusion>
+                    <groupId>org.codehaus.jackson</groupId>
+                    <artifactId>jackson-core-asl</artifactId>
+                </exclusion>
+                <exclusion>
+                    <groupId>com.google.guava</groupId>
+                    <artifactId>guava</artifactId>
+                </exclusion>
+                <exclusion>
+                    <groupId>com.google.guava</groupId>
+                    <artifactId>guava</artifactId>
+                </exclusion>
+                <exclusion>
+                    <groupId>commons-logging</groupId>
+                    <artifactId>commons-logging</artifactId>
+                </exclusion>
+                <exclusion>
+                    <groupId>org.apache.commons</groupId>
+                    <artifactId>commons-compress</artifactId>
+                </exclusion>
+                <exclusion>
+                    <groupId>commons-codec</groupId>
+                    <artifactId>commons-codec</artifactId>
+                </exclusion>
+                <exclusion>
+                    <groupId>org.apache.avro</groupId>
+                    <artifactId>avro</artifactId>
+                </exclusion>
+                <exclusion>
+                    <groupId>org.apache.zookeeper</groupId>
+                    <artifactId>zookeeper</artifactId>
+                </exclusion>
+                <exclusion>
+                    <groupId>commons-lang</groupId>
+                    <artifactId>commons-lang</artifactId>
+                </exclusion>
+                <exclusion>
+                    <groupId>commons-cli</groupId>
+                    <artifactId>commons-cli</artifactId>
+                </exclusion>
+                <exclusion>
+                    <groupId>commons-collections</groupId>
+                    <artifactId>commons-collections</artifactId>
+                </exclusion>
+                <exclusion>
+                    <groupId>commons-io</groupId>
+                    <artifactId>commons-io</artifactId>
+                </exclusion>
+                <exclusion>
+                    <groupId>com.google.code.gson</groupId>
+                    <artifactId>gson</artifactId>
+                </exclusion>
+                <exclusion>
+                    <groupId>org.apache.httpcomponents</groupId>
+                    <artifactId>httpclient</artifactId>
+                </exclusion>
+                <exclusion>
+                    <groupId>org.apache.httpcomponents</groupId>
+                    <artifactId>httpcore</artifactId>
+                </exclusion>
+                <exclusion>
+                    <groupId>org.mortbay.jetty</groupId>
+                    <artifactId>jetty</artifactId>
+                </exclusion>
+                <exclusion>
+                    <groupId>org.mortbay.jetty</groupId>
+                    <artifactId>jetty-util</artifactId>
+                </exclusion>
+                <exclusion>
+                    <groupId>log4j</groupId>
+                    <artifactId>log4j</artifactId>
+                </exclusion>
+                <exclusion>
+                    <groupId>com.google.protobuf</groupId>
+                    <artifactId>protobuf-java</artifactId>
+                </exclusion>
+            </exclusions>
         </dependency>
         <dependency>
             <groupId>org.apache.nifi</groupId>

http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/286e4738/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-nar/src/main/resources/META-INF/LICENSE
----------------------------------------------------------------------
diff --git a/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-nar/src/main/resources/META-INF/LICENSE b/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-nar/src/main/resources/META-INF/LICENSE
new file mode 100644
index 0000000..c1a3ec4
--- /dev/null
+++ b/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-nar/src/main/resources/META-INF/LICENSE
@@ -0,0 +1,319 @@
+
+                                 Apache License
+                           Version 2.0, January 2004
+                        http://www.apache.org/licenses/
+
+   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+   1. Definitions.
+
+      "License" shall mean the terms and conditions for use, reproduction,
+      and distribution as defined by Sections 1 through 9 of this document.
+
+      "Licensor" shall mean the copyright owner or entity authorized by
+      the copyright owner that is granting the License.
+
+      "Legal Entity" shall mean the union of the acting entity and all
+      other entities that control, are controlled by, or are under common
+      control with that entity. For the purposes of this definition,
+      "control" means (i) the power, direct or indirect, to cause the
+      direction or management of such entity, whether by contract or
+      otherwise, or (ii) ownership of fifty percent (50%) or more of the
+      outstanding shares, or (iii) beneficial ownership of such entity.
+
+      "You" (or "Your") shall mean an individual or Legal Entity
+      exercising permissions granted by this License.
+
+      "Source" form shall mean the preferred form for making modifications,
+      including but not limited to software source code, documentation
+      source, and configuration files.
+
+      "Object" form shall mean any form resulting from mechanical
+      transformation or translation of a Source form, including but
+      not limited to compiled object code, generated documentation,
+      and conversions to other media types.
+
+      "Work" shall mean the work of authorship, whether in Source or
+      Object form, made available under the License, as indicated by a
+      copyright notice that is included in or attached to the work
+      (an example is provided in the Appendix below).
+
+      "Derivative Works" shall mean any work, whether in Source or Object
+      form, that is based on (or derived from) the Work and for which the
+      editorial revisions, annotations, elaborations, or other modifications
+      represent, as a whole, an original work of authorship. For the purposes
+      of this License, Derivative Works shall not include works that remain
+      separable from, or merely link (or bind by name) to the interfaces of,
+      the Work and Derivative Works thereof.
+
+      "Contribution" shall mean any work of authorship, including
+      the original version of the Work and any modifications or additions
+      to that Work or Derivative Works thereof, that is intentionally
+      submitted to Licensor for inclusion in the Work by the copyright owner
+      or by an individual or Legal Entity authorized to submit on behalf of
+      the copyright owner. For the purposes of this definition, "submitted"
+      means any form of electronic, verbal, or written communication sent
+      to the Licensor or its representatives, including but not limited to
+      communication on electronic mailing lists, source code control systems,
+      and issue tracking systems that are managed by, or on behalf of, the
+      Licensor for the purpose of discussing and improving the Work, but
+      excluding communication that is conspicuously marked or otherwise
+      designated in writing by the copyright owner as "Not a Contribution."
+
+      "Contributor" shall mean Licensor and any individual or Legal Entity
+      on behalf of whom a Contribution has been received by Licensor and
+      subsequently incorporated within the Work.
+
+   2. Grant of Copyright License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      copyright license to reproduce, prepare Derivative Works of,
+      publicly display, publicly perform, sublicense, and distribute the
+      Work and such Derivative Works in Source or Object form.
+
+   3. Grant of Patent License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      (except as stated in this section) patent license to make, have made,
+      use, offer to sell, sell, import, and otherwise transfer the Work,
+      where such license applies only to those patent claims licensable
+      by such Contributor that are necessarily infringed by their
+      Contribution(s) alone or by combination of their Contribution(s)
+      with the Work to which such Contribution(s) was submitted. If You
+      institute patent litigation against any entity (including a
+      cross-claim or counterclaim in a lawsuit) alleging that the Work
+      or a Contribution incorporated within the Work constitutes direct
+      or contributory patent infringement, then any patent licenses
+      granted to You under this License for that Work shall terminate
+      as of the date such litigation is filed.
+
+   4. Redistribution. You may reproduce and distribute copies of the
+      Work or Derivative Works thereof in any medium, with or without
+      modifications, and in Source or Object form, provided that You
+      meet the following conditions:
+
+      (a) You must give any other recipients of the Work or
+          Derivative Works a copy of this License; and
+
+      (b) You must cause any modified files to carry prominent notices
+          stating that You changed the files; and
+
+      (c) You must retain, in the Source form of any Derivative Works
+          that You distribute, all copyright, patent, trademark, and
+          attribution notices from the Source form of the Work,
+          excluding those notices that do not pertain to any part of
+          the Derivative Works; and
+
+      (d) If the Work includes a "NOTICE" text file as part of its
+          distribution, then any Derivative Works that You distribute must
+          include a readable copy of the attribution notices contained
+          within such NOTICE file, excluding those notices that do not
+          pertain to any part of the Derivative Works, in at least one
+          of the following places: within a NOTICE text file distributed
+          as part of the Derivative Works; within the Source form or
+          documentation, if provided along with the Derivative Works; or,
+          within a display generated by the Derivative Works, if and
+          wherever such third-party notices normally appear. The contents
+          of the NOTICE file are for informational purposes only and
+          do not modify the License. You may add Your own attribution
+          notices within Derivative Works that You distribute, alongside
+          or as an addendum to the NOTICE text from the Work, provided
+          that such additional attribution notices cannot be construed
+          as modifying the License.
+
+      You may add Your own copyright statement to Your modifications and
+      may provide additional or different license terms and conditions
+      for use, reproduction, or distribution of Your modifications, or
+      for any such Derivative Works as a whole, provided Your use,
+      reproduction, and distribution of the Work otherwise complies with
+      the conditions stated in this License.
+
+   5. Submission of Contributions. Unless You explicitly state otherwise,
+      any Contribution intentionally submitted for inclusion in the Work
+      by You to the Licensor shall be under the terms and conditions of
+      this License, without any additional terms or conditions.
+      Notwithstanding the above, nothing herein shall supersede or modify
+      the terms of any separate license agreement you may have executed
+      with Licensor regarding such Contributions.
+
+   6. Trademarks. This License does not grant permission to use the trade
+      names, trademarks, service marks, or product names of the Licensor,
+      except as required for reasonable and customary use in describing the
+      origin of the Work and reproducing the content of the NOTICE file.
+
+   7. Disclaimer of Warranty. Unless required by applicable law or
+      agreed to in writing, Licensor provides the Work (and each
+      Contributor provides its Contributions) on an "AS IS" BASIS,
+      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+      implied, including, without limitation, any warranties or conditions
+      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+      PARTICULAR PURPOSE. You are solely responsible for determining the
+      appropriateness of using or redistributing the Work and assume any
+      risks associated with Your exercise of permissions under this License.
+
+   8. Limitation of Liability. In no event and under no legal theory,
+      whether in tort (including negligence), contract, or otherwise,
+      unless required by applicable law (such as deliberate and grossly
+      negligent acts) or agreed to in writing, shall any Contributor be
+      liable to You for damages, including any direct, indirect, special,
+      incidental, or consequential damages of any character arising as a
+      result of this License or out of the use or inability to use the
+      Work (including but not limited to damages for loss of goodwill,
+      work stoppage, computer failure or malfunction, or any and all
+      other commercial damages or losses), even if such Contributor
+      has been advised of the possibility of such damages.
+
+   9. Accepting Warranty or Additional Liability. While redistributing
+      the Work or Derivative Works thereof, You may choose to offer,
+      and charge a fee for, acceptance of support, warranty, indemnity,
+      or other liability obligations and/or rights consistent with this
+      License. However, in accepting such obligations, You may act only
+      on Your own behalf and on Your sole responsibility, not on behalf
+      of any other Contributor, and only if You agree to indemnify,
+      defend, and hold each Contributor harmless for any liability
+      incurred by, or claims asserted against, such Contributor by reason
+      of your accepting any such warranty or additional liability.
+
+   END OF TERMS AND CONDITIONS
+
+   APPENDIX: How to apply the Apache License to your work.
+
+      To apply the Apache License to your work, attach the following
+      boilerplate notice, with the fields enclosed by brackets "[]"
+      replaced with your own identifying information. (Don't include
+      the brackets!)  The text should be enclosed in the appropriate
+      comment syntax for the file format. We also recommend that a
+      file or class name and description of purpose be included on the
+      same "printed page" as the copyright notice for easier
+      identification within third-party archives.
+
+   Copyright [yyyy] [name of copyright owner]
+
+   Licensed under the Apache License, Version 2.0 (the "License");
+   you may not use this file except in compliance with the License.
+   You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+
+APACHE NIFI SUBCOMPONENTS:
+
+The Apache NiFi project contains subcomponents with separate copyright
+notices and license terms. Your use of the source code for the these
+subcomponents is subject to the terms and conditions of the following
+licenses. 
+
+The binary distribution of this product bundles 'SUAsync Library' which is
+available under a 3-Clause BSD License.
+
+  Copyright (c) 2010  StumbleUpon, Inc.  All rights reserved.
+
+  Redistribution and use in source and binary forms, with or without
+  modification, are permitted provided that the following conditions are met:
+    - Redistributions of source code must retain the above copyright notice,
+      this list of conditions and the following disclaimer.
+    - Redistributions in binary form must reproduce the above copyright notice,
+      this list of conditions and the following disclaimer in the documentation
+      and/or other materials provided with the distribution.
+    - Neither the name of the StumbleUpon nor the names of its contributors
+      may be used to endorse or promote products derived from this software
+      without specific prior written permission.
+  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+  ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+  POSSIBILITY OF SUCH DAMAGE.
+
+The binary distribution of this product bundles 'Asynchronous HBase Client'
+which is available under a 3-Clause BSD License.
+
+  Copyright (C) 2010-2012  The Async HBase Authors.  All rights reserved.
+
+  Redistribution and use in source and binary forms, with or without
+  modification, are permitted provided that the following conditions are met:
+    - Redistributions of source code must retain the above copyright notice,
+      this list of conditions and the following disclaimer.
+    - Redistributions in binary form must reproduce the above copyright notice,
+      this list of conditions and the following disclaimer in the documentation
+      and/or other materials provided with the distribution.
+    - Neither the name of the StumbleUpon nor the names of its contributors
+      may be used to endorse or promote products derived from this software
+      without specific prior written permission.
+  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+  ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+  POSSIBILITY OF SUCH DAMAGE.
+
+The binary distribution of this product bundles 'JOpt Simple' which is
+available under the MIT license.
+
+   The MIT License
+
+   Copyright (c) 2004-2011 Paul R. Holser, Jr.
+
+   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.
+
+The binary distribution of this product bundles 'Scala Library' under a BSD
+style license.
+
+    Copyright (c) 2002-2015 EPFL
+    Copyright (c) 2011-2015 Typesafe, Inc.
+    
+    All rights reserved.
+
+    Redistribution and use in source and binary forms, with or without modification, 
+	  are permitted provided that the following conditions are met:
+
+      Redistributions of source code must retain the above copyright notice, this list of 
+		  conditions and the following disclaimer.
+    
+	    Redistributions in binary form must reproduce the above copyright notice, this list of 
+		  conditions and the following disclaimer in the documentation and/or other materials
+		  provided with the distribution.
+    
+	    Neither the name of the EPFL nor the names of its contributors may be used to endorse 
+		  or promote products derived from this software without specific prior written permission.
+    
+    THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS “AS IS” AND ANY EXPRESS 
+    OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY 
+    AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR 
+    CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+    DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+    DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER 
+    IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 
+    OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/286e4738/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-nar/src/main/resources/META-INF/NOTICE
----------------------------------------------------------------------
diff --git a/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-nar/src/main/resources/META-INF/NOTICE b/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-nar/src/main/resources/META-INF/NOTICE
new file mode 100644
index 0000000..793746f
--- /dev/null
+++ b/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-nar/src/main/resources/META-INF/NOTICE
@@ -0,0 +1,145 @@
+nifi-social-media-nar
+Copyright 2015 The Apache Software Foundation
+
+This product includes software developed at
+The Apache Software Foundation (http://www.apache.org/).
+
+******************
+Apache Software License v2
+******************
+
+The following binary components are provided under the Apache Software License v2
+
+  (ASLv2) Apache Avro
+    The following NOTICE information applies:
+      Apache Avro
+      Copyright 2009-2012 The Apache Software Foundation
+
+  (ASLv2) Apache Commons JEXL
+    The following NOTICE information applies:
+      Apache Commons JEXL
+      Copyright 2001-2011 The Apache Software Foundation
+
+  (ASLv2) Apache Commons Lang
+    The following NOTICE information applies:
+      Apache Commons Lang
+      Copyright 2001-2015 The Apache Software Foundation
+
+      This product includes software from the Spring Framework,
+      under the Apache License 2.0 (see: StringUtils.containsWhitespace())
+
+  (ASLv2) Apache Flume
+    The following NOTICE information applies:
+      Apache Flume
+      Copyright 2011-2015 Apache Software Foundation
+
+  (ASLv2) IRClib
+    The following NOTICE information applies:
+      IRClib -- A Java Internet Relay Chat library --
+      Copyright (C) 2002 - 2006 Christoph Schwering <sc...@gmail.com>
+
+  (ASLv2) Jackson JSON processor
+    The following NOTICE information applies:
+      # Jackson JSON processor
+
+      Jackson is a high-performance, Free/Open Source JSON processing library.
+      It was originally written by Tatu Saloranta (tatu.saloranta@iki.fi), and has
+      been in development since 2007.
+      It is currently developed by a community of developers, as well as supported
+      commercially by FasterXML.com.
+
+      ## Licensing
+
+      Jackson core and extension components may licensed under different licenses.
+      To find the details that apply to this artifact see the accompanying LICENSE file.
+      For more information, including possible other licensing options, contact
+      FasterXML.com (http://fasterxml.com).
+
+      ## Credits
+
+      A list of contributors may be found from CREDITS file, which is included
+      in some artifacts (usually source distributions); but is always available
+      from the source code management (SCM) system project uses.
+
+  (ASLv2) Joda-Time
+    The following NOTICE information applies:
+      =============================================================================
+      = NOTICE file corresponding to section 4d of the Apache License Version 2.0 =
+      =============================================================================
+      This product includes software developed by
+      Joda.org (http://www.joda.org/).
+
+  (ASLv2) Apache Kafka
+    The following NOTICE information applies:
+      Apache Kafka
+      Copyright 2012 The Apache Software Foundation.
+
+  (ASLv2) Kite SDK
+    The following NOTICE information applies:
+      This product includes software developed by Cloudera, Inc.
+      (http://www.cloudera.com/).
+
+      This product includes software developed at
+      The Apache Software Foundation (http://www.apache.org/).
+
+      This product includes software developed by
+      Saxonica (http://www.saxonica.com/).
+
+  (ASLv2) Apache Thrift
+    The following NOTICE information applies:
+      Apache Thrift
+      Copyright 2006-2010 The Apache Software Foundation.
+
+  (ASLv2) Yammer Metrics
+    The following NOTICE information applies:
+      Metrics
+      Copyright 2010-2012 Coda Hale and Yammer, Inc.
+
+      This product includes software developed by Coda Hale and Yammer, Inc.
+
+      This product includes code derived from the JSR-166 project (ThreadLocalRandom), which was released
+      with the following comments:
+
+          Written by Doug Lea with assistance from members of JCP JSR-166
+          Expert Group and released to the public domain, as explained at
+          http://creativecommons.org/publicdomain/zero/1.0/
+
+  (ASLv2) Apache MINA
+    The following NOTICE information applies:
+      Apache MINA Core
+      Copyright 2004-2011 Apache MINA Project
+
+  (ASLv2) The Netty Project
+    The following NOTICE information applies:
+      The Netty Project
+      Copyright 2011 The Netty Project
+
+  (ASLv2) opencsv (net.sf.opencsv:opencsv:2.3)
+
+  (ASLv2) Parquet MR
+    The following NOTICE information applies:
+      Parquet MR
+      Copyright 2012 Twitter, Inc.
+
+      This project includes code from https://github.com/lemire/JavaFastPFOR
+      parquet-column/src/main/java/parquet/column/values/bitpacking/LemireBitPacking.java
+      Apache License Version 2.0 http://www.apache.org/licenses/.
+      (c) Daniel Lemire, http://lemire.me/en/
+
+  (ASLv2) Servlet Specification API (org.mortbay.jetty:servlet-api:2.5-20110124)
+
+  (ASLv2) Twitter4J
+    The following NOTICE information applies:
+      Copyright 2007 Yusuke Yamamoto
+      
+      Twitter4J includes software from JSON.org to parse JSON response from the Twitter API. You can see the license term at http://www.JSON.org/license.html
+
+  (ASLv2) Apache Velocity
+    The following NOTICE information applies:
+      Apache Velocity
+      Copyright (C) 2000-2007 The Apache Software Foundation
+
+  (ASLv2) ZkClient
+    The following NOTICE information applies:
+      ZkClient
+      Copyright 2009 Stefan Groschupf
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/286e4738/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/pom.xml
----------------------------------------------------------------------
diff --git a/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/pom.xml b/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/pom.xml
index 1dad25f..167aa6e 100644
--- a/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/pom.xml
+++ b/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/pom.xml
@@ -21,6 +21,11 @@
     </parent>
     <artifactId>nifi-flume-processors</artifactId>
     <packaging>jar</packaging>
+
+    <properties>
+        <flume.version>1.6.0</flume.version>
+    </properties>
+
     <dependencies>
         <dependency>
             <groupId>org.apache.nifi</groupId>
@@ -41,12 +46,12 @@
         <dependency>
             <groupId>org.apache.flume</groupId>
             <artifactId>flume-ng-sdk</artifactId>
-            <version>1.5.2</version>
+            <version>${flume.version}</version>
         </dependency>
         <dependency>
             <groupId>org.apache.flume</groupId>
             <artifactId>flume-ng-core</artifactId>
-            <version>1.5.2</version>
+            <version>${flume.version}</version>
             <exclusions>
                 <exclusion>
                     <groupId>org.slf4j</groupId>
@@ -56,27 +61,38 @@
         </dependency>
 
         <!-- Flume Sources -->
+
         <dependency>
             <groupId>org.apache.flume.flume-ng-sources</groupId>
-            <artifactId>flume-twitter-source</artifactId>
-            <version>1.5.2</version>
+            <artifactId>flume-jms-source</artifactId>
+            <version>${flume.version}</version>
         </dependency>
         <dependency>
             <groupId>org.apache.flume.flume-ng-sources</groupId>
-            <artifactId>flume-jms-source</artifactId>
-            <version>1.5.2</version>
+            <artifactId>flume-kafka-source</artifactId>
+            <version>${flume.version}</version>
         </dependency>
         <dependency>
             <groupId>org.apache.flume.flume-ng-sources</groupId>
             <artifactId>flume-scribe-source</artifactId>
-            <version>1.5.2</version>
+            <version>${flume.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.flume.flume-ng-sources</groupId>
+            <artifactId>flume-twitter-source</artifactId>
+            <version>${flume.version}</version>
         </dependency>
 
         <!-- Flume Sinks -->
         <dependency>
             <groupId>org.apache.flume.flume-ng-sinks</groupId>
+            <artifactId>flume-dataset-sink</artifactId>
+            <version>${flume.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.flume.flume-ng-sinks</groupId>
             <artifactId>flume-hdfs-sink</artifactId>
-            <version>1.5.2</version>
+            <version>${flume.version}</version>
         </dependency>
 
         <!-- HDFS sink dependencies -->
@@ -99,23 +115,33 @@
 
         <dependency>
             <groupId>org.apache.flume.flume-ng-sinks</groupId>
+            <artifactId>flume-hive-sink</artifactId>
+            <version>${flume.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.flume.flume-ng-sinks</groupId>
             <artifactId>flume-irc-sink</artifactId>
-            <version>1.5.2</version>
+            <version>${flume.version}</version>
         </dependency>
         <dependency>
             <groupId>org.apache.flume.flume-ng-sinks</groupId>
             <artifactId>flume-ng-elasticsearch-sink</artifactId>
-            <version>1.5.2</version>
+            <version>${flume.version}</version>
         </dependency>
         <dependency>
             <groupId>org.apache.flume.flume-ng-sinks</groupId>
             <artifactId>flume-ng-hbase-sink</artifactId>
-            <version>1.5.2</version>
+            <version>${flume.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.flume.flume-ng-sinks</groupId>
+            <artifactId>flume-ng-kafka-sink</artifactId>
+            <version>${flume.version}</version>
         </dependency>
         <dependency>
             <groupId>org.apache.flume.flume-ng-sinks</groupId>
             <artifactId>flume-ng-morphline-solr-sink</artifactId>
-            <version>1.5.2</version>
+            <version>${flume.version}</version>
         </dependency>
 
         <dependency>

http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/286e4738/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/src/main/java/org/apache/nifi/processors/flume/AbstractFlumeProcessor.java
----------------------------------------------------------------------
diff --git a/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/src/main/java/org/apache/nifi/processors/flume/AbstractFlumeProcessor.java b/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/src/main/java/org/apache/nifi/processors/flume/AbstractFlumeProcessor.java
index 83ae9e1..9b75047 100644
--- a/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/src/main/java/org/apache/nifi/processors/flume/AbstractFlumeProcessor.java
+++ b/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/src/main/java/org/apache/nifi/processors/flume/AbstractFlumeProcessor.java
@@ -77,7 +77,7 @@ public abstract class AbstractFlumeProcessor extends AbstractSessionFactoryProce
             public ValidationResult validate(final String subject, final String value, final ValidationContext context) {
                 String reason = null;
                 try {
-                    FlumeSourceProcessor.SOURCE_FACTORY.create("NiFi Source", value);
+                    ExecuteFlumeSource.SOURCE_FACTORY.create("NiFi Source", value);
                 } catch (Exception ex) {
                     reason = ex.getLocalizedMessage();
                     reason = Character.toLowerCase(reason.charAt(0)) + reason.substring(1);
@@ -97,7 +97,7 @@ public abstract class AbstractFlumeProcessor extends AbstractSessionFactoryProce
             public ValidationResult validate(final String subject, final String value, final ValidationContext context) {
                 String reason = null;
                 try {
-                    FlumeSinkProcessor.SINK_FACTORY.create("NiFi Sink", value);
+                    ExecuteFlumeSink.SINK_FACTORY.create("NiFi Sink", value);
                 } catch (Exception ex) {
                     reason = ex.getLocalizedMessage();
                     reason = Character.toLowerCase(reason.charAt(0)) + reason.substring(1);

http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/286e4738/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/src/main/java/org/apache/nifi/processors/flume/ExecuteFlumeSink.java
----------------------------------------------------------------------
diff --git a/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/src/main/java/org/apache/nifi/processors/flume/ExecuteFlumeSink.java b/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/src/main/java/org/apache/nifi/processors/flume/ExecuteFlumeSink.java
new file mode 100644
index 0000000..8ccb2d1
--- /dev/null
+++ b/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/src/main/java/org/apache/nifi/processors/flume/ExecuteFlumeSink.java
@@ -0,0 +1,144 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.nifi.processors.flume;
+
+import com.google.common.base.Throwables;
+import com.google.common.collect.ImmutableList;
+import com.google.common.collect.ImmutableSet;
+import java.util.List;
+import java.util.Set;
+import org.apache.flume.Context;
+import org.apache.flume.EventDeliveryException;
+import org.apache.flume.Sink;
+import org.apache.flume.conf.Configurables;
+import org.apache.nifi.annotation.behavior.TriggerSerially;
+import org.apache.nifi.annotation.documentation.CapabilityDescription;
+import org.apache.nifi.annotation.documentation.Tags;
+import org.apache.nifi.annotation.lifecycle.OnScheduled;
+import org.apache.nifi.annotation.lifecycle.OnStopped;
+
+import org.apache.nifi.components.PropertyDescriptor;
+import org.apache.nifi.components.Validator;
+import org.apache.nifi.processor.ProcessContext;
+import org.apache.nifi.processor.ProcessSession;
+import org.apache.nifi.processor.ProcessorInitializationContext;
+import org.apache.nifi.processor.Relationship;
+import org.apache.nifi.processor.SchedulingContext;
+import org.apache.nifi.processor.exception.ProcessException;
+import org.apache.nifi.processor.util.StandardValidators;
+
+/**
+ * This processor runs a Flume sink
+ */
+@Tags({"flume", "hadoop", "get", "sink"})
+@CapabilityDescription("Write FlowFile data to a Flume sink")
+@TriggerSerially
+public class ExecuteFlumeSink extends AbstractFlumeProcessor {
+
+    public static final PropertyDescriptor SINK_TYPE = new PropertyDescriptor.Builder()
+            .name("Sink Type")
+            .description("The fully-qualified name of the Sink class")
+            .required(true)
+            .addValidator(createSinkValidator())
+            .build();
+    public static final PropertyDescriptor AGENT_NAME = new PropertyDescriptor.Builder()
+            .name("Agent Name")
+            .description("The name of the agent used in the Flume sink configuration")
+            .required(true)
+            .defaultValue("tier1")
+            .addValidator(StandardValidators.NON_EMPTY_VALIDATOR)
+            .build();
+    public static final PropertyDescriptor SOURCE_NAME = new PropertyDescriptor.Builder()
+            .name("Sink Name")
+            .description("The name of the sink used in the Flume sink configuration")
+            .required(true)
+            .defaultValue("sink-1")
+            .addValidator(StandardValidators.NON_EMPTY_VALIDATOR)
+            .build();
+    public static final PropertyDescriptor FLUME_CONFIG = new PropertyDescriptor.Builder()
+            .name("Flume Configuration")
+            .description("The Flume configuration for the sink copied from the flume.properties file")
+            .required(true)
+            .defaultValue("")
+            .addValidator(Validator.VALID)
+            .build();
+
+    public static final Relationship SUCCESS = new Relationship.Builder().name("success").build();
+    public static final Relationship FAILURE = new Relationship.Builder().name("failure").build();
+
+    private List<PropertyDescriptor> descriptors;
+    private Set<Relationship> relationships;
+
+    private volatile Sink sink;
+    private volatile NifiSinkSessionChannel channel;
+
+    @Override
+    protected void init(final ProcessorInitializationContext context) {
+        this.descriptors = ImmutableList.of(SINK_TYPE, AGENT_NAME, SOURCE_NAME, FLUME_CONFIG);
+        this.relationships = ImmutableSet.of(SUCCESS, FAILURE);
+    }
+
+    @Override
+    protected List<PropertyDescriptor> getSupportedPropertyDescriptors() {
+        return descriptors;
+    }
+
+    @Override
+    public Set<Relationship> getRelationships() {
+        return relationships;
+    }
+
+    @OnScheduled
+    public void onScheduled(final SchedulingContext context) {
+        try {
+            channel = new NifiSinkSessionChannel(SUCCESS, FAILURE);
+            channel.start();
+
+            sink = SINK_FACTORY.create(context.getProperty(SOURCE_NAME).getValue(),
+                    context.getProperty(SINK_TYPE).getValue());
+            sink.setChannel(channel);
+
+            String flumeConfig = context.getProperty(FLUME_CONFIG).getValue();
+            String agentName = context.getProperty(AGENT_NAME).getValue();
+            String sinkName = context.getProperty(SOURCE_NAME).getValue();
+            Configurables.configure(sink,
+                    getFlumeSinkContext(flumeConfig, agentName, sinkName));
+
+            sink.start();
+        } catch (Throwable th) {
+            getLogger().error("Error creating sink", th);
+            throw Throwables.propagate(th);
+        }
+    }
+
+    @OnStopped
+    public void stopped() {
+        sink.stop();
+        channel.stop();
+    }
+
+    @Override
+    public void onTrigger(final ProcessContext context, final ProcessSession session) throws ProcessException {
+
+        channel.setSession(session);
+        try {
+            sink.process();
+        } catch (EventDeliveryException ex) {
+            throw new ProcessException("Flume event delivery failed", ex);
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/286e4738/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/src/main/java/org/apache/nifi/processors/flume/ExecuteFlumeSource.java
----------------------------------------------------------------------
diff --git a/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/src/main/java/org/apache/nifi/processors/flume/ExecuteFlumeSource.java b/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/src/main/java/org/apache/nifi/processors/flume/ExecuteFlumeSource.java
new file mode 100644
index 0000000..fa02750
--- /dev/null
+++ b/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/src/main/java/org/apache/nifi/processors/flume/ExecuteFlumeSource.java
@@ -0,0 +1,194 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.nifi.processors.flume;
+
+import com.google.common.base.Throwables;
+import com.google.common.collect.ImmutableList;
+import com.google.common.collect.ImmutableSet;
+import java.util.List;
+import java.util.Set;
+import java.util.concurrent.atomic.AtomicReference;
+import org.apache.flume.EventDeliveryException;
+import org.apache.flume.EventDrivenSource;
+import org.apache.flume.PollableSource;
+import org.apache.flume.Source;
+import org.apache.flume.channel.ChannelProcessor;
+import org.apache.flume.conf.Configurables;
+import org.apache.flume.source.EventDrivenSourceRunner;
+import org.apache.nifi.annotation.behavior.TriggerSerially;
+import org.apache.nifi.annotation.documentation.CapabilityDescription;
+import org.apache.nifi.annotation.documentation.Tags;
+import org.apache.nifi.annotation.lifecycle.OnScheduled;
+import org.apache.nifi.annotation.lifecycle.OnStopped;
+
+import org.apache.nifi.components.PropertyDescriptor;
+import org.apache.nifi.components.Validator;
+import org.apache.nifi.processor.ProcessContext;
+import org.apache.nifi.processor.ProcessSession;
+import org.apache.nifi.processor.ProcessSessionFactory;
+import org.apache.nifi.processor.ProcessorInitializationContext;
+import org.apache.nifi.processor.Relationship;
+import org.apache.nifi.processor.SchedulingContext;
+import org.apache.nifi.processor.exception.ProcessException;
+import org.apache.nifi.processor.util.StandardValidators;
+
+/**
+ * This processor runs a Flume source
+ */
+@Tags({"flume", "hadoop", "get", "source"})
+@CapabilityDescription("Generate FlowFile data from a Flume source")
+@TriggerSerially
+public class ExecuteFlumeSource extends AbstractFlumeProcessor {
+
+    public static final PropertyDescriptor SOURCE_TYPE = new PropertyDescriptor.Builder()
+        .name("Source Type")
+        .description("The fully-qualified name of the Source class")
+        .required(true)
+        .addValidator(createSourceValidator())
+        .build();
+    public static final PropertyDescriptor AGENT_NAME = new PropertyDescriptor.Builder()
+        .name("Agent Name")
+        .description("The name of the agent used in the Flume source configuration")
+        .required(true)
+        .defaultValue("tier1")
+        .addValidator(StandardValidators.NON_EMPTY_VALIDATOR)
+        .build();
+    public static final PropertyDescriptor SOURCE_NAME = new PropertyDescriptor.Builder()
+        .name("Source Name")
+        .description("The name of the source used in the Flume source configuration")
+        .required(true)
+        .defaultValue("src-1")
+        .addValidator(StandardValidators.NON_EMPTY_VALIDATOR)
+        .build();
+    public static final PropertyDescriptor FLUME_CONFIG = new PropertyDescriptor.Builder()
+        .name("Flume Configuration")
+        .description("The Flume configuration for the source copied from the flume.properties file")
+        .required(true)
+        .defaultValue("")
+        .addValidator(Validator.VALID)
+        .build();
+
+    public static final Relationship SUCCESS = new Relationship.Builder().name("success")
+        .build();
+
+    private List<PropertyDescriptor> descriptors;
+    private Set<Relationship> relationships;
+
+    private volatile Source source;
+
+    private final NifiSessionChannel pollableSourceChannel = new NifiSessionChannel(SUCCESS);
+    private final AtomicReference<ProcessSessionFactory> sessionFactoryRef = new AtomicReference<>(null);
+    private final AtomicReference<EventDrivenSourceRunner> runnerRef = new AtomicReference<>(null);
+    private final AtomicReference<NifiSessionFactoryChannel> eventDrivenSourceChannelRef = new AtomicReference<>(null);
+
+    @Override
+    protected void init(final ProcessorInitializationContext context) {
+        this.descriptors = ImmutableList.of(SOURCE_TYPE, AGENT_NAME, SOURCE_NAME, FLUME_CONFIG);
+        this.relationships = ImmutableSet.of(SUCCESS);
+    }
+
+    @Override
+    protected List<PropertyDescriptor> getSupportedPropertyDescriptors() {
+        return descriptors;
+    }
+
+    @Override
+    public Set<Relationship> getRelationships() {
+        return relationships;
+    }
+
+    @OnScheduled
+    public void onScheduled(final SchedulingContext context) {
+        try {
+            source = SOURCE_FACTORY.create(
+                    context.getProperty(SOURCE_NAME).getValue(),
+                    context.getProperty(SOURCE_TYPE).getValue());
+
+            String flumeConfig = context.getProperty(FLUME_CONFIG).getValue();
+            String agentName = context.getProperty(AGENT_NAME).getValue();
+            String sourceName = context.getProperty(SOURCE_NAME).getValue();
+            Configurables.configure(source,
+                getFlumeSourceContext(flumeConfig, agentName, sourceName));
+
+            if (source instanceof PollableSource) {
+                source.setChannelProcessor(new ChannelProcessor(
+                    new NifiChannelSelector(pollableSourceChannel)));
+                source.start();
+            }
+        } catch (Throwable th) {
+            getLogger().error("Error creating source", th);
+            throw Throwables.propagate(th);
+        }
+    }
+
+    @OnStopped
+    public void stopped() {
+        if (source instanceof PollableSource) {
+            source.stop();
+        } else {
+            EventDrivenSourceRunner runner = runnerRef.get();
+            if (runner != null) {
+                runner.stop();
+                runnerRef.compareAndSet(runner, null);
+            }
+
+            NifiSessionFactoryChannel eventDrivenSourceChannel = eventDrivenSourceChannelRef.get();
+            if (eventDrivenSourceChannel != null) {
+                eventDrivenSourceChannel.stop();
+                eventDrivenSourceChannelRef.compareAndSet(eventDrivenSourceChannel, null);
+            }
+        }
+        sessionFactoryRef.set(null);
+    }
+
+    @Override
+    public void onTrigger(ProcessContext context, ProcessSessionFactory sessionFactory) throws ProcessException {
+        if (source instanceof PollableSource) {
+            super.onTrigger(context, sessionFactory);
+        } else if (source instanceof EventDrivenSource) {
+            ProcessSessionFactory old = sessionFactoryRef.getAndSet(sessionFactory);
+            if (old != sessionFactory) {
+                if (runnerRef.get() != null) {
+                    stopped();
+                }
+
+                runnerRef.set(new EventDrivenSourceRunner());
+                eventDrivenSourceChannelRef.set(new NifiSessionFactoryChannel(sessionFactoryRef.get(), SUCCESS));
+                eventDrivenSourceChannelRef.get().start();
+                source.setChannelProcessor(new ChannelProcessor(
+                    new NifiChannelSelector(eventDrivenSourceChannelRef.get())));
+                runnerRef.get().setSource(source);
+                runnerRef.get().start();
+            }
+        }
+    }
+
+    @Override
+    public void onTrigger(final ProcessContext context, final ProcessSession session) throws ProcessException {
+        if (source instanceof PollableSource) {
+            PollableSource pollableSource = (PollableSource) source;
+            try {
+                pollableSourceChannel.setSession(session);
+                pollableSource.process();
+            } catch (EventDeliveryException ex) {
+                throw new ProcessException("Error processing pollable source", ex);
+            }
+        } else {
+            throw new ProcessException("Invalid source type: " + source.getClass().getSimpleName());
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/286e4738/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/src/main/java/org/apache/nifi/processors/flume/FlumeSinkProcessor.java
----------------------------------------------------------------------
diff --git a/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/src/main/java/org/apache/nifi/processors/flume/FlumeSinkProcessor.java b/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/src/main/java/org/apache/nifi/processors/flume/FlumeSinkProcessor.java
deleted file mode 100644
index 2d8506d..0000000
--- a/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/src/main/java/org/apache/nifi/processors/flume/FlumeSinkProcessor.java
+++ /dev/null
@@ -1,142 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.nifi.processors.flume;
-
-import com.google.common.base.Throwables;
-import com.google.common.collect.ImmutableList;
-import com.google.common.collect.ImmutableSet;
-import java.util.List;
-import java.util.Set;
-import org.apache.flume.Context;
-import org.apache.flume.EventDeliveryException;
-import org.apache.flume.Sink;
-import org.apache.flume.conf.Configurables;
-import org.apache.nifi.annotation.documentation.CapabilityDescription;
-import org.apache.nifi.annotation.documentation.Tags;
-import org.apache.nifi.annotation.lifecycle.OnScheduled;
-import org.apache.nifi.annotation.lifecycle.OnStopped;
-
-import org.apache.nifi.components.PropertyDescriptor;
-import org.apache.nifi.components.Validator;
-import org.apache.nifi.processor.ProcessContext;
-import org.apache.nifi.processor.ProcessSession;
-import org.apache.nifi.processor.ProcessorInitializationContext;
-import org.apache.nifi.processor.Relationship;
-import org.apache.nifi.processor.SchedulingContext;
-import org.apache.nifi.processor.exception.ProcessException;
-import org.apache.nifi.processor.util.StandardValidators;
-
-/**
- * This processor runs a Flume sink
- */
-@Tags({"flume", "hadoop", "get", "sink"})
-@CapabilityDescription("Write FlowFile data to a Flume sink")
-public class FlumeSinkProcessor extends AbstractFlumeProcessor {
-
-    public static final PropertyDescriptor SINK_TYPE = new PropertyDescriptor.Builder()
-            .name("Sink Type")
-            .description("The fully-qualified name of the Sink class")
-            .required(true)
-            .addValidator(createSinkValidator())
-            .build();
-    public static final PropertyDescriptor AGENT_NAME = new PropertyDescriptor.Builder()
-            .name("Agent Name")
-            .description("The name of the agent used in the Flume sink configuration")
-            .required(true)
-            .defaultValue("tier1")
-            .addValidator(StandardValidators.NON_EMPTY_VALIDATOR)
-            .build();
-    public static final PropertyDescriptor SOURCE_NAME = new PropertyDescriptor.Builder()
-            .name("Sink Name")
-            .description("The name of the sink used in the Flume sink configuration")
-            .required(true)
-            .defaultValue("sink-1")
-            .addValidator(StandardValidators.NON_EMPTY_VALIDATOR)
-            .build();
-    public static final PropertyDescriptor FLUME_CONFIG = new PropertyDescriptor.Builder()
-            .name("Flume Configuration")
-            .description("The Flume configuration for the sink copied from the flume.properties file")
-            .required(true)
-            .defaultValue("")
-            .addValidator(Validator.VALID)
-            .build();
-
-    public static final Relationship SUCCESS = new Relationship.Builder().name("success").build();
-    public static final Relationship FAILURE = new Relationship.Builder().name("failure").build();
-
-    private List<PropertyDescriptor> descriptors;
-    private Set<Relationship> relationships;
-
-    private volatile Sink sink;
-    private volatile NifiSinkSessionChannel channel;
-
-    @Override
-    protected void init(final ProcessorInitializationContext context) {
-        this.descriptors = ImmutableList.of(SINK_TYPE, AGENT_NAME, SOURCE_NAME, FLUME_CONFIG);
-        this.relationships = ImmutableSet.of(SUCCESS, FAILURE);
-    }
-
-    @Override
-    protected List<PropertyDescriptor> getSupportedPropertyDescriptors() {
-        return descriptors;
-    }
-
-    @Override
-    public Set<Relationship> getRelationships() {
-        return relationships;
-    }
-
-    @OnScheduled
-    public void onScheduled(final SchedulingContext context) {
-        try {
-            channel = new NifiSinkSessionChannel(SUCCESS, FAILURE);
-            channel.start();
-
-            sink = SINK_FACTORY.create(context.getProperty(SOURCE_NAME).getValue(),
-                    context.getProperty(SINK_TYPE).getValue());
-            sink.setChannel(channel);
-
-            String flumeConfig = context.getProperty(FLUME_CONFIG).getValue();
-            String agentName = context.getProperty(AGENT_NAME).getValue();
-            String sinkName = context.getProperty(SOURCE_NAME).getValue();
-            Configurables.configure(sink,
-                    getFlumeSinkContext(flumeConfig, agentName, sinkName));
-
-            sink.start();
-        } catch (Throwable th) {
-            getLogger().error("Error creating sink", th);
-            throw Throwables.propagate(th);
-        }
-    }
-
-    @OnStopped
-    public void stopped() {
-        sink.stop();
-        channel.stop();
-    }
-
-    @Override
-    public void onTrigger(final ProcessContext context, final ProcessSession session) throws ProcessException {
-
-        channel.setSession(session);
-        try {
-            sink.process();
-        } catch (EventDeliveryException ex) {
-            throw new ProcessException("Flume event delivery failed", ex);
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/286e4738/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/src/main/java/org/apache/nifi/processors/flume/FlumeSourceProcessor.java
----------------------------------------------------------------------
diff --git a/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/src/main/java/org/apache/nifi/processors/flume/FlumeSourceProcessor.java b/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/src/main/java/org/apache/nifi/processors/flume/FlumeSourceProcessor.java
deleted file mode 100644
index 55b1f2f..0000000
--- a/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/src/main/java/org/apache/nifi/processors/flume/FlumeSourceProcessor.java
+++ /dev/null
@@ -1,196 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.nifi.processors.flume;
-
-import com.google.common.base.Throwables;
-import com.google.common.collect.ImmutableList;
-import com.google.common.collect.ImmutableSet;
-import java.util.List;
-import java.util.Set;
-import java.util.concurrent.atomic.AtomicReference;
-import org.apache.flume.EventDeliveryException;
-import org.apache.flume.EventDrivenSource;
-import org.apache.flume.PollableSource;
-import org.apache.flume.Source;
-import org.apache.flume.channel.ChannelProcessor;
-import org.apache.flume.conf.Configurables;
-import org.apache.flume.source.EventDrivenSourceRunner;
-import org.apache.nifi.annotation.documentation.CapabilityDescription;
-import org.apache.nifi.annotation.documentation.Tags;
-import org.apache.nifi.annotation.lifecycle.OnScheduled;
-import org.apache.nifi.annotation.lifecycle.OnStopped;
-
-import org.apache.nifi.components.PropertyDescriptor;
-import org.apache.nifi.components.Validator;
-import org.apache.nifi.processor.ProcessContext;
-import org.apache.nifi.processor.ProcessSession;
-import org.apache.nifi.processor.ProcessSessionFactory;
-import org.apache.nifi.processor.ProcessorInitializationContext;
-import org.apache.nifi.processor.Relationship;
-import org.apache.nifi.processor.SchedulingContext;
-import org.apache.nifi.processor.exception.ProcessException;
-import org.apache.nifi.processor.util.StandardValidators;
-
-/**
- * This processor runs a Flume source
- */
-@Tags({"flume", "hadoop", "get", "source"})
-@CapabilityDescription("Generate FlowFile data from a Flume source")
-public class FlumeSourceProcessor extends AbstractFlumeProcessor {
-
-    public static final PropertyDescriptor SOURCE_TYPE = new PropertyDescriptor.Builder()
-        .name("Source Type")
-        .description("The fully-qualified name of the Source class")
-        .required(true)
-        .addValidator(createSourceValidator())
-        .build();
-    public static final PropertyDescriptor AGENT_NAME = new PropertyDescriptor.Builder()
-        .name("Agent Name")
-        .description("The name of the agent used in the Flume source configuration")
-        .required(true)
-        .defaultValue("tier1")
-        .addValidator(StandardValidators.NON_EMPTY_VALIDATOR)
-        .build();
-    public static final PropertyDescriptor SOURCE_NAME = new PropertyDescriptor.Builder()
-        .name("Source Name")
-        .description("The name of the source used in the Flume source configuration")
-        .required(true)
-        .defaultValue("src-1")
-        .addValidator(StandardValidators.NON_EMPTY_VALIDATOR)
-        .build();
-    public static final PropertyDescriptor FLUME_CONFIG = new PropertyDescriptor.Builder()
-        .name("Flume Configuration")
-        .description("The Flume configuration for the source copied from the flume.properties file")
-        .required(true)
-        .defaultValue("")
-        .addValidator(Validator.VALID)
-        .build();
-
-    public static final Relationship SUCCESS = new Relationship.Builder().name("success")
-        .build();
-
-    private List<PropertyDescriptor> descriptors;
-    private Set<Relationship> relationships;
-
-    private volatile Source source;
-
-    private final NifiSessionChannel pollableSourceChannel = new NifiSessionChannel(SUCCESS);
-    private final AtomicReference<ProcessSessionFactory> sessionFactoryRef = new AtomicReference<>(null);
-    private final AtomicReference<EventDrivenSourceRunner> runnerRef = new AtomicReference<>(null);
-    private final AtomicReference<NifiSessionFactoryChannel> eventDrivenSourceChannelRef = new AtomicReference<>(null);
-
-    @Override
-    protected void init(final ProcessorInitializationContext context) {
-        this.descriptors = ImmutableList.of(SOURCE_TYPE, AGENT_NAME, SOURCE_NAME, FLUME_CONFIG);
-        this.relationships = ImmutableSet.of(SUCCESS);
-    }
-
-    @Override
-    protected List<PropertyDescriptor> getSupportedPropertyDescriptors() {
-        return descriptors;
-    }
-
-    @Override
-    public Set<Relationship> getRelationships() {
-        return relationships;
-    }
-
-    @OnScheduled
-    public void onScheduled(final SchedulingContext context) {
-        try {
-            source = SOURCE_FACTORY.create(
-                context.getProperty(SOURCE_NAME)
-                .getValue(),
-                context.getProperty(SOURCE_TYPE)
-                .getValue());
-
-            String flumeConfig = context.getProperty(FLUME_CONFIG)
-                .getValue();
-            String agentName = context.getProperty(AGENT_NAME)
-                .getValue();
-            String sourceName = context.getProperty(SOURCE_NAME)
-                .getValue();
-            Configurables.configure(source,
-                getFlumeSourceContext(flumeConfig, agentName, sourceName));
-
-            if (source instanceof PollableSource) {
-                source.setChannelProcessor(new ChannelProcessor(
-                    new NifiChannelSelector(pollableSourceChannel)));
-                source.start();
-            }
-        } catch (Throwable th) {
-            getLogger()
-                .error("Error creating source", th);
-            throw Throwables.propagate(th);
-        }
-    }
-
-    @OnStopped
-    public void stopped() {
-        if (source instanceof PollableSource) {
-            source.stop();
-        } else {
-            EventDrivenSourceRunner runner = runnerRef.get();
-            if (runner != null) {
-                runner.stop();
-                runnerRef.compareAndSet(runner, null);
-            }
-
-            NifiSessionFactoryChannel eventDrivenSourceChannel = eventDrivenSourceChannelRef.get();
-            if (eventDrivenSourceChannel != null) {
-                eventDrivenSourceChannel.stop();
-                eventDrivenSourceChannelRef.compareAndSet(eventDrivenSourceChannel, null);
-            }
-        }
-        sessionFactoryRef.set(null);
-    }
-
-    @Override
-    public void onTrigger(ProcessContext context, ProcessSessionFactory sessionFactory) throws ProcessException {
-        if (source instanceof PollableSource) {
-            super.onTrigger(context, sessionFactory);
-        } else if (source instanceof EventDrivenSource) {
-            ProcessSessionFactory old = sessionFactoryRef.getAndSet(sessionFactory);
-            if (old != sessionFactory) {
-                if (runnerRef.get() != null) {
-                    stopped();
-                }
-
-                runnerRef.set(new EventDrivenSourceRunner());
-                eventDrivenSourceChannelRef.set(new NifiSessionFactoryChannel(sessionFactoryRef.get(), SUCCESS));
-                eventDrivenSourceChannelRef.get().start();
-                source.setChannelProcessor(new ChannelProcessor(
-                    new NifiChannelSelector(eventDrivenSourceChannelRef.get())));
-                runnerRef.get().setSource(source);
-                runnerRef.get().start();
-            }
-        }
-    }
-
-    @Override
-    public void onTrigger(final ProcessContext context, final ProcessSession session) throws ProcessException {
-        if (source instanceof PollableSource) {
-            PollableSource pollableSource = (PollableSource) source;
-            try {
-                pollableSourceChannel.setSession(session);
-                pollableSource.process();
-            } catch (EventDeliveryException ex) {
-                throw new ProcessException("Error processing pollable source", ex);
-            }
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/286e4738/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/src/main/java/org/apache/nifi/processors/flume/NifiSessionFactoryChannel.java
----------------------------------------------------------------------
diff --git a/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/src/main/java/org/apache/nifi/processors/flume/NifiSessionFactoryChannel.java b/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/src/main/java/org/apache/nifi/processors/flume/NifiSessionFactoryChannel.java
index bc56587..eb31a66 100644
--- a/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/src/main/java/org/apache/nifi/processors/flume/NifiSessionFactoryChannel.java
+++ b/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/src/main/java/org/apache/nifi/processors/flume/NifiSessionFactoryChannel.java
@@ -39,7 +39,6 @@ public class NifiSessionFactoryChannel extends BasicChannelSemantics {
         LifecycleState lifecycleState = getLifecycleState();
         if (lifecycleState == LifecycleState.STOP) {
             throw new ChannelFullException("Can't write to a stopped channel");
-            //return null;
         }
         return new NifiTransaction(sessionFactory.createSession(), relationship);
     }

http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/286e4738/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/src/main/java/org/apache/nifi/processors/flume/util/FlowFileEvent.java
----------------------------------------------------------------------
diff --git a/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/src/main/java/org/apache/nifi/processors/flume/util/FlowFileEvent.java b/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/src/main/java/org/apache/nifi/processors/flume/util/FlowFileEvent.java
index 5dc97d6..fdff203 100644
--- a/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/src/main/java/org/apache/nifi/processors/flume/util/FlowFileEvent.java
+++ b/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/src/main/java/org/apache/nifi/processors/flume/util/FlowFileEvent.java
@@ -26,8 +26,13 @@ import org.apache.flume.Event;
 import org.apache.nifi.flowfile.FlowFile;
 import org.apache.nifi.processor.ProcessSession;
 import org.apache.nifi.processor.io.InputStreamCallback;
+import static org.apache.nifi.processors.flume.util.FlowFileEventConstants.ENTRY_DATE_HEADER;
+import static org.apache.nifi.processors.flume.util.FlowFileEventConstants.ID_HEADER;
+import static org.apache.nifi.processors.flume.util.FlowFileEventConstants.LAST_QUEUE_DATE_HEADER;
+import static org.apache.nifi.processors.flume.util.FlowFileEventConstants.LINEAGE_IDENTIFIERS_HEADER;
+import static org.apache.nifi.processors.flume.util.FlowFileEventConstants.LINEAGE_START_DATE_HEADER;
+import static org.apache.nifi.processors.flume.util.FlowFileEventConstants.SIZE_HEADER;
 
-import static org.apache.nifi.processors.flume.util.FlowFileEventConstants.*;
 import org.apache.nifi.stream.io.BufferedInputStream;
 import org.apache.nifi.stream.io.StreamUtils;
 
@@ -105,7 +110,7 @@ public class FlowFileEvent implements Event {
           @Override
           public void process(InputStream in) throws IOException {
             try (BufferedInputStream input = new BufferedInputStream(in)) {
-              StreamUtils.copy(in, baos);
+              StreamUtils.copy(input, baos);
             }
             baos.close();
           }

http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/286e4738/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/src/test/java/org/apache/nifi/processors/flume/ExecuteFlumeSinkTest.java
----------------------------------------------------------------------
diff --git a/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/src/test/java/org/apache/nifi/processors/flume/ExecuteFlumeSinkTest.java b/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/src/test/java/org/apache/nifi/processors/flume/ExecuteFlumeSinkTest.java
new file mode 100644
index 0000000..6a0c40d
--- /dev/null
+++ b/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/src/test/java/org/apache/nifi/processors/flume/ExecuteFlumeSinkTest.java
@@ -0,0 +1,167 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.nifi.processors.flume;
+
+import java.io.File;
+import static org.junit.Assert.assertEquals;
+
+import java.io.FilenameFilter;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+import org.apache.commons.io.filefilter.HiddenFileFilter;
+import org.apache.flume.sink.NullSink;
+import org.apache.flume.source.AvroSource;
+
+import org.apache.nifi.components.ValidationResult;
+import org.apache.nifi.flowfile.attributes.CoreAttributes;
+import org.apache.nifi.processor.ProcessContext;
+import org.apache.nifi.util.MockProcessContext;
+import org.apache.nifi.util.TestRunner;
+import org.apache.nifi.util.TestRunners;
+import org.apache.nifi.util.file.FileUtils;
+
+import org.junit.Assert;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.TemporaryFolder;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class ExecuteFlumeSinkTest {
+
+    private static final Logger logger =
+        LoggerFactory.getLogger(ExecuteFlumeSinkTest.class);
+
+    @Rule
+    public final TemporaryFolder temp = new TemporaryFolder();
+
+    @Test
+    public void testValidators() {
+        TestRunner runner = TestRunners.newTestRunner(ExecuteFlumeSink.class);
+        Collection<ValidationResult> results;
+        ProcessContext pc;
+
+        results = new HashSet<>();
+        runner.enqueue(new byte[0]);
+        pc = runner.getProcessContext();
+        if (pc instanceof MockProcessContext) {
+            results = ((MockProcessContext) pc).validate();
+        }
+        Assert.assertEquals(1, results.size());
+        for (ValidationResult vr : results) {
+            logger.debug(vr.toString());
+            Assert.assertTrue(vr.toString().contains("is invalid because Sink Type is required"));
+        }
+
+        // non-existent class
+        results = new HashSet<>();
+        runner.setProperty(ExecuteFlumeSink.SINK_TYPE, "invalid.class.name");
+        runner.enqueue(new byte[0]);
+        pc = runner.getProcessContext();
+        if (pc instanceof MockProcessContext) {
+            results = ((MockProcessContext) pc).validate();
+        }
+        Assert.assertEquals(1, results.size());
+        for (ValidationResult vr : results) {
+            logger.debug(vr.toString());
+            Assert.assertTrue(vr.toString().contains("is invalid because unable to load sink"));
+        }
+
+        // class doesn't implement Sink
+        results = new HashSet<>();
+        runner.setProperty(ExecuteFlumeSink.SINK_TYPE, AvroSource.class.getName());
+        runner.enqueue(new byte[0]);
+        pc = runner.getProcessContext();
+        if (pc instanceof MockProcessContext) {
+            results = ((MockProcessContext) pc).validate();
+        }
+        Assert.assertEquals(1, results.size());
+        for (ValidationResult vr : results) {
+            logger.debug(vr.toString());
+            Assert.assertTrue(vr.toString().contains("is invalid because unable to create sink"));
+        }
+
+        results = new HashSet<>();
+        runner.setProperty(ExecuteFlumeSink.SINK_TYPE, NullSink.class.getName());
+        runner.enqueue(new byte[0]);
+        pc = runner.getProcessContext();
+        if (pc instanceof MockProcessContext) {
+            results = ((MockProcessContext) pc).validate();
+        }
+        Assert.assertEquals(0, results.size());
+    }
+
+
+    @Test
+    public void testNullSink() throws IOException {
+        TestRunner runner = TestRunners.newTestRunner(ExecuteFlumeSink.class);
+        runner.setProperty(ExecuteFlumeSink.SINK_TYPE, NullSink.class.getName());
+        try (InputStream inputStream = getClass().getResourceAsStream("/testdata/records.txt")) {
+            Map<String, String> attributes = new HashMap<>();
+            attributes.put(CoreAttributes.FILENAME.key(), "records.txt");
+            runner.enqueue(inputStream, attributes);
+            runner.run();
+        }
+    }
+
+    @Test
+    public void testBatchSize() throws IOException {
+        TestRunner runner = TestRunners.newTestRunner(ExecuteFlumeSink.class);
+        runner.setProperty(ExecuteFlumeSink.SINK_TYPE, NullSink.class.getName());
+        runner.setProperty(ExecuteFlumeSink.FLUME_CONFIG,
+            "tier1.sinks.sink-1.batchSize = 1000\n");
+        for (int i = 0; i < 100000; i++) {
+          runner.enqueue(String.valueOf(i).getBytes());
+        }
+        runner.run(100);
+    }
+
+    @Test
+    public void testHdfsSink() throws IOException {
+        File destDir = temp.newFolder("hdfs");
+
+        TestRunner runner = TestRunners.newTestRunner(ExecuteFlumeSink.class);
+        runner.setProperty(ExecuteFlumeSink.SINK_TYPE, "hdfs");
+        runner.setProperty(ExecuteFlumeSink.FLUME_CONFIG,
+            "tier1.sinks.sink-1.hdfs.path = " + destDir.toURI().toString() + "\n" +
+            "tier1.sinks.sink-1.hdfs.fileType = DataStream\n" +
+            "tier1.sinks.sink-1.hdfs.serializer = TEXT\n" +
+            "tier1.sinks.sink-1.serializer.appendNewline = false"
+        );
+        try (InputStream inputStream = getClass().getResourceAsStream("/testdata/records.txt")) {
+            Map<String, String> attributes = new HashMap<>();
+            attributes.put(CoreAttributes.FILENAME.key(), "records.txt");
+            runner.enqueue(inputStream, attributes);
+            runner.run();
+        }
+
+        File[] files = destDir.listFiles((FilenameFilter)HiddenFileFilter.VISIBLE);
+        assertEquals("Unexpected number of destination files.", 1, files.length);
+        File dst = files[0];
+        byte[] expectedMd5;
+        try (InputStream md5Stream = getClass().getResourceAsStream("/testdata/records.txt")) {
+            expectedMd5 = FileUtils.computeMd5Digest(md5Stream);
+        }
+        byte[] actualMd5 = FileUtils.computeMd5Digest(dst);
+        Assert.assertArrayEquals("Destination file doesn't match source data", expectedMd5, actualMd5);
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/286e4738/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/src/test/java/org/apache/nifi/processors/flume/ExecuteFlumeSourceTest.java
----------------------------------------------------------------------
diff --git a/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/src/test/java/org/apache/nifi/processors/flume/ExecuteFlumeSourceTest.java b/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/src/test/java/org/apache/nifi/processors/flume/ExecuteFlumeSourceTest.java
new file mode 100644
index 0000000..924776e
--- /dev/null
+++ b/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/src/test/java/org/apache/nifi/processors/flume/ExecuteFlumeSourceTest.java
@@ -0,0 +1,150 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.nifi.processors.flume;
+
+
+import java.io.File;
+import java.io.IOException;
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.List;
+import java.util.concurrent.TimeUnit;
+import org.apache.flume.sink.NullSink;
+import org.apache.flume.source.AvroSource;
+
+import org.apache.nifi.components.ValidationResult;
+import org.apache.nifi.processor.ProcessContext;
+import org.apache.nifi.util.MockFlowFile;
+import org.apache.nifi.util.MockProcessContext;
+import org.apache.nifi.util.TestRunner;
+import org.apache.nifi.util.TestRunners;
+import org.apache.nifi.util.file.FileUtils;
+
+import org.junit.Assert;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.TemporaryFolder;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class ExecuteFlumeSourceTest {
+
+    private static final Logger logger = LoggerFactory.getLogger(ExecuteFlumeSourceTest.class);
+
+    @Rule
+    public final TemporaryFolder temp = new TemporaryFolder();
+
+    @Test
+    public void testValidators() {
+        TestRunner runner = TestRunners.newTestRunner(ExecuteFlumeSource.class);
+        Collection<ValidationResult> results;
+        ProcessContext pc;
+
+        results = new HashSet<>();
+        runner.enqueue(new byte[0]);
+        pc = runner.getProcessContext();
+        if (pc instanceof MockProcessContext) {
+            results = ((MockProcessContext) pc).validate();
+        }
+        Assert.assertEquals(1, results.size());
+        for (ValidationResult vr : results) {
+            logger.debug(vr.toString());
+            Assert.assertTrue(vr.toString().contains("is invalid because Source Type is required"));
+        }
+
+        // non-existent class
+        results = new HashSet<>();
+        runner.setProperty(ExecuteFlumeSource.SOURCE_TYPE, "invalid.class.name");
+        runner.enqueue(new byte[0]);
+        pc = runner.getProcessContext();
+        if (pc instanceof MockProcessContext) {
+            results = ((MockProcessContext) pc).validate();
+        }
+        Assert.assertEquals(1, results.size());
+        for (ValidationResult vr : results) {
+            logger.debug(vr.toString());
+            Assert.assertTrue(vr.toString().contains("is invalid because unable to load source"));
+        }
+
+        // class doesn't implement Source
+        results = new HashSet<>();
+        runner.setProperty(ExecuteFlumeSource.SOURCE_TYPE, NullSink.class.getName());
+        runner.enqueue(new byte[0]);
+        pc = runner.getProcessContext();
+        if (pc instanceof MockProcessContext) {
+            results = ((MockProcessContext) pc).validate();
+        }
+        Assert.assertEquals(1, results.size());
+        for (ValidationResult vr : results) {
+            logger.debug(vr.toString());
+            Assert.assertTrue(vr.toString().contains("is invalid because unable to create source"));
+        }
+
+        results = new HashSet<>();
+        runner.setProperty(ExecuteFlumeSource.SOURCE_TYPE, AvroSource.class.getName());
+        runner.enqueue(new byte[0]);
+        pc = runner.getProcessContext();
+        if (pc instanceof MockProcessContext) {
+            results = ((MockProcessContext) pc).validate();
+        }
+        Assert.assertEquals(0, results.size());
+    }
+
+    @Test
+    public void testSequenceSource() {
+        TestRunner runner = TestRunners.newTestRunner(ExecuteFlumeSource.class);
+        runner.setProperty(ExecuteFlumeSource.SOURCE_TYPE, "seq");
+        runner.run();
+        List<MockFlowFile> flowFiles = runner.getFlowFilesForRelationship(ExecuteFlumeSource.SUCCESS);
+        Assert.assertEquals(1, flowFiles.size());
+        for (MockFlowFile flowFile : flowFiles) {
+            logger.debug(flowFile.toString());
+            Assert.assertEquals(1, flowFile.getSize());
+        }
+    }
+
+    @Test
+    public void testSourceWithConfig() throws IOException {
+        File spoolDirectory = temp.newFolder("spooldir");
+        File dst = new File(spoolDirectory, "records.txt");
+        FileUtils.copyFile(getClass().getResourceAsStream("/testdata/records.txt"), dst, true, false);
+
+        TestRunner runner = TestRunners.newTestRunner(ExecuteFlumeSource.class);
+        runner.setProperty(ExecuteFlumeSource.SOURCE_TYPE, "spooldir");
+        runner.setProperty(ExecuteFlumeSink.FLUME_CONFIG,
+            "tier1.sources.src-1.spoolDir = " + spoolDirectory.getAbsolutePath());
+        runner.run(1, false, true);
+        // Because the spool directory source is an event driven source, it may take some time for flow files to get
+        // produced. I'm willing to wait up to 5 seconds, but will bail out early if possible. If it takes longer than
+        // that then there is likely a bug.
+        int numWaits = 10;
+        while (runner.getFlowFilesForRelationship(ExecuteFlumeSource.SUCCESS).size() < 4 && --numWaits > 0) {
+            try {
+                TimeUnit.MILLISECONDS.sleep(500);
+            } catch (InterruptedException ex) {
+                logger.warn("Sleep interrupted");
+            }
+        }
+        runner.shutdown();
+        runner.assertTransferCount(ExecuteFlumeSource.SUCCESS, 4);
+        int i = 1;
+        for (MockFlowFile flowFile : runner.getFlowFilesForRelationship(ExecuteFlumeSource.SUCCESS)) {
+            flowFile.assertContentEquals("record " + i);
+            i++;
+        }
+    }
+}



[11/13] incubator-nifi git commit: Implemented Joe's review feedback:

Posted by mc...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/286e4738/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/src/test/java/org/apache/nifi/processors/flume/FlumeSinkProcessorTest.java
----------------------------------------------------------------------
diff --git a/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/src/test/java/org/apache/nifi/processors/flume/FlumeSinkProcessorTest.java b/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/src/test/java/org/apache/nifi/processors/flume/FlumeSinkProcessorTest.java
deleted file mode 100644
index 0654138..0000000
--- a/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/src/test/java/org/apache/nifi/processors/flume/FlumeSinkProcessorTest.java
+++ /dev/null
@@ -1,167 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.nifi.processors.flume;
-
-import java.io.File;
-import static org.junit.Assert.assertEquals;
-
-import java.io.FilenameFilter;
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Map;
-import org.apache.commons.io.filefilter.HiddenFileFilter;
-import org.apache.flume.sink.NullSink;
-import org.apache.flume.source.AvroSource;
-
-import org.apache.nifi.components.ValidationResult;
-import org.apache.nifi.flowfile.attributes.CoreAttributes;
-import org.apache.nifi.processor.ProcessContext;
-import org.apache.nifi.util.MockProcessContext;
-import org.apache.nifi.util.TestRunner;
-import org.apache.nifi.util.TestRunners;
-import org.apache.nifi.util.file.FileUtils;
-
-import org.junit.Assert;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.TemporaryFolder;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class FlumeSinkProcessorTest {
-
-    private static final Logger logger =
-        LoggerFactory.getLogger(FlumeSinkProcessorTest.class);
-
-    @Rule
-    public final TemporaryFolder temp = new TemporaryFolder();
-
-    @Test
-    public void testValidators() {
-        TestRunner runner = TestRunners.newTestRunner(FlumeSinkProcessor.class);
-        Collection<ValidationResult> results;
-        ProcessContext pc;
-
-        results = new HashSet<>();
-        runner.enqueue(new byte[0]);
-        pc = runner.getProcessContext();
-        if (pc instanceof MockProcessContext) {
-            results = ((MockProcessContext) pc).validate();
-        }
-        Assert.assertEquals(1, results.size());
-        for (ValidationResult vr : results) {
-            logger.debug(vr.toString());
-            Assert.assertTrue(vr.toString().contains("is invalid because Sink Type is required"));
-        }
-
-        // non-existent class
-        results = new HashSet<>();
-        runner.setProperty(FlumeSinkProcessor.SINK_TYPE, "invalid.class.name");
-        runner.enqueue(new byte[0]);
-        pc = runner.getProcessContext();
-        if (pc instanceof MockProcessContext) {
-            results = ((MockProcessContext) pc).validate();
-        }
-        Assert.assertEquals(1, results.size());
-        for (ValidationResult vr : results) {
-            logger.debug(vr.toString());
-            Assert.assertTrue(vr.toString().contains("is invalid because unable to load sink"));
-        }
-
-        // class doesn't implement Sink
-        results = new HashSet<>();
-        runner.setProperty(FlumeSinkProcessor.SINK_TYPE, AvroSource.class.getName());
-        runner.enqueue(new byte[0]);
-        pc = runner.getProcessContext();
-        if (pc instanceof MockProcessContext) {
-            results = ((MockProcessContext) pc).validate();
-        }
-        Assert.assertEquals(1, results.size());
-        for (ValidationResult vr : results) {
-            logger.debug(vr.toString());
-            Assert.assertTrue(vr.toString().contains("is invalid because unable to create sink"));
-        }
-
-        results = new HashSet<>();
-        runner.setProperty(FlumeSinkProcessor.SINK_TYPE, NullSink.class.getName());
-        runner.enqueue(new byte[0]);
-        pc = runner.getProcessContext();
-        if (pc instanceof MockProcessContext) {
-            results = ((MockProcessContext) pc).validate();
-        }
-        Assert.assertEquals(0, results.size());
-    }
-
-
-    @Test
-    public void testNullSink() throws IOException {
-        TestRunner runner = TestRunners.newTestRunner(FlumeSinkProcessor.class);
-        runner.setProperty(FlumeSinkProcessor.SINK_TYPE, NullSink.class.getName());
-        try (InputStream inputStream = getClass().getResourceAsStream("/testdata/records.txt")) {
-            Map<String, String> attributes = new HashMap<>();
-            attributes.put(CoreAttributes.FILENAME.key(), "records.txt");
-            runner.enqueue(inputStream, attributes);
-            runner.run();
-        }
-    }
-
-    @Test
-    public void testBatchSize() throws IOException {
-        TestRunner runner = TestRunners.newTestRunner(FlumeSinkProcessor.class);
-        runner.setProperty(FlumeSinkProcessor.SINK_TYPE, NullSink.class.getName());
-        runner.setProperty(FlumeSinkProcessor.FLUME_CONFIG,
-            "tier1.sinks.sink-1.batchSize = 1000\n");
-        for (int i = 0; i < 100000; i++) {
-          runner.enqueue(String.valueOf(i).getBytes());
-        }
-        runner.run(100);
-    }
-
-    @Test
-    public void testHdfsSink() throws IOException {
-        File destDir = temp.newFolder("hdfs");
-
-        TestRunner runner = TestRunners.newTestRunner(FlumeSinkProcessor.class);
-        runner.setProperty(FlumeSinkProcessor.SINK_TYPE, "hdfs");
-        runner.setProperty(FlumeSinkProcessor.FLUME_CONFIG,
-            "tier1.sinks.sink-1.hdfs.path = " + destDir.toURI().toString() + "\n" +
-            "tier1.sinks.sink-1.hdfs.fileType = DataStream\n" +
-            "tier1.sinks.sink-1.hdfs.serializer = TEXT\n" +
-            "tier1.sinks.sink-1.serializer.appendNewline = false"
-        );
-        try (InputStream inputStream = getClass().getResourceAsStream("/testdata/records.txt")) {
-            Map<String, String> attributes = new HashMap<>();
-            attributes.put(CoreAttributes.FILENAME.key(), "records.txt");
-            runner.enqueue(inputStream, attributes);
-            runner.run();
-        }
-
-        File[] files = destDir.listFiles((FilenameFilter)HiddenFileFilter.VISIBLE);
-        assertEquals("Unexpected number of destination files.", 1, files.length);
-        File dst = files[0];
-        byte[] expectedMd5;
-        try (InputStream md5Stream = getClass().getResourceAsStream("/testdata/records.txt")) {
-            expectedMd5 = FileUtils.computeMd5Digest(md5Stream);
-        }
-        byte[] actualMd5 = FileUtils.computeMd5Digest(dst);
-        Assert.assertArrayEquals("Destination file doesn't match source data", expectedMd5, actualMd5);
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/286e4738/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/src/test/java/org/apache/nifi/processors/flume/FlumeSourceProcessorTest.java
----------------------------------------------------------------------
diff --git a/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/src/test/java/org/apache/nifi/processors/flume/FlumeSourceProcessorTest.java b/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/src/test/java/org/apache/nifi/processors/flume/FlumeSourceProcessorTest.java
deleted file mode 100644
index bf32095..0000000
--- a/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/src/test/java/org/apache/nifi/processors/flume/FlumeSourceProcessorTest.java
+++ /dev/null
@@ -1,150 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.nifi.processors.flume;
-
-
-import java.io.File;
-import java.io.IOException;
-import java.util.Collection;
-import java.util.HashSet;
-import java.util.List;
-import java.util.concurrent.TimeUnit;
-import org.apache.flume.sink.NullSink;
-import org.apache.flume.source.AvroSource;
-
-import org.apache.nifi.components.ValidationResult;
-import org.apache.nifi.processor.ProcessContext;
-import org.apache.nifi.util.MockFlowFile;
-import org.apache.nifi.util.MockProcessContext;
-import org.apache.nifi.util.TestRunner;
-import org.apache.nifi.util.TestRunners;
-import org.apache.nifi.util.file.FileUtils;
-
-import org.junit.Assert;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.TemporaryFolder;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class FlumeSourceProcessorTest {
-
-    private static final Logger logger = LoggerFactory.getLogger(FlumeSourceProcessorTest.class);
-
-    @Rule
-    public final TemporaryFolder temp = new TemporaryFolder();
-
-    @Test
-    public void testValidators() {
-        TestRunner runner = TestRunners.newTestRunner(FlumeSourceProcessor.class);
-        Collection<ValidationResult> results;
-        ProcessContext pc;
-
-        results = new HashSet<>();
-        runner.enqueue(new byte[0]);
-        pc = runner.getProcessContext();
-        if (pc instanceof MockProcessContext) {
-            results = ((MockProcessContext) pc).validate();
-        }
-        Assert.assertEquals(1, results.size());
-        for (ValidationResult vr : results) {
-            logger.debug(vr.toString());
-            Assert.assertTrue(vr.toString().contains("is invalid because Source Type is required"));
-        }
-
-        // non-existent class
-        results = new HashSet<>();
-        runner.setProperty(FlumeSourceProcessor.SOURCE_TYPE, "invalid.class.name");
-        runner.enqueue(new byte[0]);
-        pc = runner.getProcessContext();
-        if (pc instanceof MockProcessContext) {
-            results = ((MockProcessContext) pc).validate();
-        }
-        Assert.assertEquals(1, results.size());
-        for (ValidationResult vr : results) {
-            logger.debug(vr.toString());
-            Assert.assertTrue(vr.toString().contains("is invalid because unable to load source"));
-        }
-
-        // class doesn't implement Source
-        results = new HashSet<>();
-        runner.setProperty(FlumeSourceProcessor.SOURCE_TYPE, NullSink.class.getName());
-        runner.enqueue(new byte[0]);
-        pc = runner.getProcessContext();
-        if (pc instanceof MockProcessContext) {
-            results = ((MockProcessContext) pc).validate();
-        }
-        Assert.assertEquals(1, results.size());
-        for (ValidationResult vr : results) {
-            logger.debug(vr.toString());
-            Assert.assertTrue(vr.toString().contains("is invalid because unable to create source"));
-        }
-
-        results = new HashSet<>();
-        runner.setProperty(FlumeSourceProcessor.SOURCE_TYPE, AvroSource.class.getName());
-        runner.enqueue(new byte[0]);
-        pc = runner.getProcessContext();
-        if (pc instanceof MockProcessContext) {
-            results = ((MockProcessContext) pc).validate();
-        }
-        Assert.assertEquals(0, results.size());
-    }
-
-    @Test
-    public void testSequenceSource() {
-        TestRunner runner = TestRunners.newTestRunner(FlumeSourceProcessor.class);
-        runner.setProperty(FlumeSourceProcessor.SOURCE_TYPE, "seq");
-        runner.run();
-        List<MockFlowFile> flowFiles = runner.getFlowFilesForRelationship(FlumeSourceProcessor.SUCCESS);
-        Assert.assertEquals(1, flowFiles.size());
-        for (MockFlowFile flowFile : flowFiles) {
-            logger.debug(flowFile.toString());
-            Assert.assertEquals(1, flowFile.getSize());
-        }
-    }
-
-    @Test
-    public void testSourceWithConfig() throws IOException {
-        File spoolDirectory = temp.newFolder("spooldir");
-        File dst = new File(spoolDirectory, "records.txt");
-        FileUtils.copyFile(getClass().getResourceAsStream("/testdata/records.txt"), dst, true, false);
-
-        TestRunner runner = TestRunners.newTestRunner(FlumeSourceProcessor.class);
-        runner.setProperty(FlumeSourceProcessor.SOURCE_TYPE, "spooldir");
-        runner.setProperty(FlumeSinkProcessor.FLUME_CONFIG,
-            "tier1.sources.src-1.spoolDir = " + spoolDirectory.getAbsolutePath());
-        runner.run(1, false, true);
-        // Because the spool directory source is an event driven source, it may take some time for flow files to get
-        // produced. I'm willing to wait up to 5 seconds, but will bail out early if possible. If it takes longer than
-        // that then there is likely a bug.
-        int numWaits = 10;
-        while (runner.getFlowFilesForRelationship(FlumeSourceProcessor.SUCCESS).size() < 4 && --numWaits > 0) {
-            try {
-                TimeUnit.MILLISECONDS.sleep(500);
-            } catch (InterruptedException ex) {
-                logger.warn("Sleep interrupted");
-            }
-        }
-        runner.shutdown();
-        runner.assertTransferCount(FlumeSourceProcessor.SUCCESS, 4);
-        int i = 1;
-        for (MockFlowFile flowFile : runner.getFlowFilesForRelationship(FlumeSourceProcessor.SUCCESS)) {
-            flowFile.assertContentEquals("record " + i);
-            i++;
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/286e4738/nifi/nifi-nar-bundles/nifi-flume-bundle/pom.xml
----------------------------------------------------------------------
diff --git a/nifi/nifi-nar-bundles/nifi-flume-bundle/pom.xml b/nifi/nifi-nar-bundles/nifi-flume-bundle/pom.xml
index a2742aa..59aab3c 100644
--- a/nifi/nifi-nar-bundles/nifi-flume-bundle/pom.xml
+++ b/nifi/nifi-nar-bundles/nifi-flume-bundle/pom.xml
@@ -32,7 +32,7 @@
             <dependency>
                 <groupId>org.apache.nifi</groupId>
                 <artifactId>nifi-flume-processors</artifactId>
-                <version>0.1.0-incubating-SNAPSHOT</version>
+                <version>0.2.0-incubating-SNAPSHOT</version>
             </dependency>
         </dependencies>
     </dependencyManagement>

http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/286e4738/nifi/pom.xml
----------------------------------------------------------------------
diff --git a/nifi/pom.xml b/nifi/pom.xml
index 3a5c6b7..66a328c 100644
--- a/nifi/pom.xml
+++ b/nifi/pom.xml
@@ -809,7 +809,7 @@
             <dependency>
                 <groupId>org.apache.nifi</groupId>
                 <artifactId>nifi-flume-nar</artifactId>
-                <version>0.1.0-incubating-SNAPSHOT</version>
+                <version>0.2.0-incubating-SNAPSHOT</version>
                 <type>nar</type>
             </dependency>
             <dependency>
@@ -864,10 +864,10 @@
                 <version>2.0.0</version>
             </dependency>
             <dependency>
-			    <groupId>org.apache.derby</groupId>
-			    <artifactId>derby</artifactId>
-			    <version>10.11.1.1</version>
-		    </dependency>
+                <groupId>org.apache.derby</groupId>
+                <artifactId>derby</artifactId>
+                <version>10.11.1.1</version>
+            </dependency>
         </dependencies>
     </dependencyManagement>
     <dependencies>


[06/13] incubator-nifi git commit: Fix poms, versions, add batching to sink processor

Posted by mc...@apache.org.
Fix poms, versions, add batching to sink processor

* Fix pom issues caused by the rebase.
* Update the Flume bundle's version to 0.1.0
* Add support for batching to the sink processor

Signed-off-by: Matt Gilman <ma...@gmail.com>


Project: http://git-wip-us.apache.org/repos/asf/incubator-nifi/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-nifi/commit/3b9e4824
Tree: http://git-wip-us.apache.org/repos/asf/incubator-nifi/tree/3b9e4824
Diff: http://git-wip-us.apache.org/repos/asf/incubator-nifi/diff/3b9e4824

Branch: refs/heads/develop
Commit: 3b9e48246641e617cd3fef987ce6facd283f6f3e
Parents: cf29029
Author: Joey Echeverria <jo...@gmail.com>
Authored: Tue Apr 7 17:18:45 2015 -0700
Committer: Matt Gilman <ma...@gmail.com>
Committed: Tue Jul 14 14:50:16 2015 -0400

----------------------------------------------------------------------
 nifi/nifi-assembly/pom.xml                      |  2 +
 .../nifi-flume-bundle/nifi-flume-nar/pom.xml    |  4 +-
 .../nifi-flume-processors/pom.xml               |  2 +-
 .../flume/AbstractFlumeProcessor.java           |  6 ---
 .../processors/flume/FlumeSinkProcessor.java    | 46 +++++++++++++++++---
 .../flume/FlumeSinkProcessorTest.java           | 13 ++++++
 nifi/nifi-nar-bundles/nifi-flume-bundle/pom.xml |  6 +--
 nifi/pom.xml                                    |  2 +-
 8 files changed, 61 insertions(+), 20 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/3b9e4824/nifi/nifi-assembly/pom.xml
----------------------------------------------------------------------
diff --git a/nifi/nifi-assembly/pom.xml b/nifi/nifi-assembly/pom.xml
index 4f4879f..0293c70 100644
--- a/nifi/nifi-assembly/pom.xml
+++ b/nifi/nifi-assembly/pom.xml
@@ -165,6 +165,8 @@ language governing permissions and limitations under the License. -->
         <dependency>
             <groupId>org.apache.nifi</groupId>
             <artifactId>nifi-kite-nar</artifactId>
+            <type>nar</type>
+        </dependency>
         <dependency>
             <groupId>org.apache.nifi</groupId>
             <artifactId>nifi-flume-nar</artifactId>

http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/3b9e4824/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-nar/pom.xml
----------------------------------------------------------------------
diff --git a/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-nar/pom.xml b/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-nar/pom.xml
index dff440e..36a5170 100644
--- a/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-nar/pom.xml
+++ b/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-nar/pom.xml
@@ -17,10 +17,10 @@
     <parent>
         <groupId>org.apache.nifi</groupId>
         <artifactId>nifi-flume-bundle</artifactId>
-        <version>0.0.1-incubating-SNAPSHOT</version>
+        <version>0.1.0-incubating-SNAPSHOT</version>
     </parent>
     <artifactId>nifi-flume-nar</artifactId>
-    <version>0.0.1-incubating-SNAPSHOT</version>
+    <version>0.1.0-incubating-SNAPSHOT</version>
     <packaging>nar</packaging>
     <dependencies>
         <dependency>

http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/3b9e4824/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/pom.xml
----------------------------------------------------------------------
diff --git a/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/pom.xml b/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/pom.xml
index 54636ca..bd26a99 100644
--- a/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/pom.xml
+++ b/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/pom.xml
@@ -17,7 +17,7 @@
     <parent>
         <groupId>org.apache.nifi</groupId>
         <artifactId>nifi-flume-bundle</artifactId>
-        <version>0.0.1-incubating-SNAPSHOT</version>
+        <version>0.1.0-incubating-SNAPSHOT</version>
     </parent>
     <artifactId>nifi-flume-processors</artifactId>
     <packaging>jar</packaging>

http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/3b9e4824/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/src/main/java/org/apache/nifi/processors/flume/AbstractFlumeProcessor.java
----------------------------------------------------------------------
diff --git a/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/src/main/java/org/apache/nifi/processors/flume/AbstractFlumeProcessor.java b/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/src/main/java/org/apache/nifi/processors/flume/AbstractFlumeProcessor.java
index 5c608d5..a831000 100644
--- a/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/src/main/java/org/apache/nifi/processors/flume/AbstractFlumeProcessor.java
+++ b/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/src/main/java/org/apache/nifi/processors/flume/AbstractFlumeProcessor.java
@@ -20,20 +20,15 @@ import com.google.common.collect.Maps;
 import java.io.IOException;
 import java.io.OutputStream;
 import java.io.StringReader;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
 import java.util.Map;
 import java.util.Properties;
 import org.apache.flume.Context;
 import org.apache.flume.Event;
 import org.apache.flume.SinkFactory;
-import org.apache.flume.Source;
 import org.apache.flume.SourceFactory;
 import org.apache.flume.sink.DefaultSinkFactory;
 import org.apache.flume.source.DefaultSourceFactory;
 
-import org.apache.nifi.components.PropertyDescriptor;
 import org.apache.nifi.components.ValidationContext;
 import org.apache.nifi.components.ValidationResult;
 import org.apache.nifi.components.Validator;
@@ -42,7 +37,6 @@ import org.apache.nifi.processor.AbstractProcessor;
 import org.apache.nifi.processor.ProcessSession;
 import org.apache.nifi.processor.Relationship;
 import org.apache.nifi.processor.io.OutputStreamCallback;
-import static org.apache.nifi.processors.flume.FlumeSourceProcessor.FLUME_CONFIG;
 import org.apache.nifi.processors.flume.util.FlowFileEvent;
 
 /**

http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/3b9e4824/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/src/main/java/org/apache/nifi/processors/flume/FlumeSinkProcessor.java
----------------------------------------------------------------------
diff --git a/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/src/main/java/org/apache/nifi/processors/flume/FlumeSinkProcessor.java b/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/src/main/java/org/apache/nifi/processors/flume/FlumeSinkProcessor.java
index fc97ae8..0ffd4f1 100644
--- a/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/src/main/java/org/apache/nifi/processors/flume/FlumeSinkProcessor.java
+++ b/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/src/main/java/org/apache/nifi/processors/flume/FlumeSinkProcessor.java
@@ -19,6 +19,7 @@ package org.apache.nifi.processors.flume;
 import com.google.common.base.Throwables;
 import com.google.common.collect.ImmutableList;
 import com.google.common.collect.ImmutableSet;
+import com.google.common.collect.Lists;
 import java.util.List;
 import java.util.Set;
 import org.apache.flume.Context;
@@ -27,6 +28,7 @@ import org.apache.flume.Sink;
 import org.apache.flume.Transaction;
 import org.apache.flume.channel.MemoryChannel;
 import org.apache.flume.conf.Configurables;
+import org.apache.jasper.compiler.JspUtil;
 import org.apache.nifi.annotation.documentation.CapabilityDescription;
 import org.apache.nifi.annotation.documentation.Tags;
 import org.apache.nifi.annotation.lifecycle.OnScheduled;
@@ -81,16 +83,24 @@ public class FlumeSinkProcessor extends AbstractFlumeProcessor {
             .defaultValue("")
             .addValidator(Validator.VALID)
             .build();
+    public static final PropertyDescriptor BATCH_SIZE = new PropertyDescriptor.Builder()
+            .name("Batch Size")
+            .description("The number of FlowFiles to process in a single batch")
+            .required(true)
+            .defaultValue("100")
+            .addValidator(StandardValidators.INTEGER_VALIDATOR)
+            .build();
 
     public static final Relationship SUCCESS = new Relationship.Builder().name("success").build();
     public static final Relationship FAILURE = new Relationship.Builder().name("failure").build();
 
     private List<PropertyDescriptor> descriptors;
     private Set<Relationship> relationships;
+    private int batchSize;
 
     @Override
     protected void init(final ProcessorInitializationContext context) {
-        this.descriptors = ImmutableList.of(SINK_TYPE, AGENT_NAME, SOURCE_NAME, FLUME_CONFIG);
+        this.descriptors = ImmutableList.of(SINK_TYPE, AGENT_NAME, SOURCE_NAME, FLUME_CONFIG, BATCH_SIZE);
         this.relationships = ImmutableSet.of(SUCCESS, FAILURE);
     }
 
@@ -106,9 +116,14 @@ public class FlumeSinkProcessor extends AbstractFlumeProcessor {
 
     @OnScheduled
     public void onScheduled(final SchedulingContext context) {
+        batchSize = context.getProperty(BATCH_SIZE).asInteger();
+
         try {
             channel = new MemoryChannel();
-            Configurables.configure(channel, new Context());
+            Context memoryChannelContext = new Context();
+            memoryChannelContext.put("capacity", String.valueOf(batchSize*10));
+            memoryChannelContext.put("transactionCapacity", String.valueOf(batchSize*10));
+            Configurables.configure(channel, memoryChannelContext);
             channel.start();
 
             sink = SINK_FACTORY.create(context.getProperty(SOURCE_NAME).getValue(),
@@ -137,12 +152,22 @@ public class FlumeSinkProcessor extends AbstractFlumeProcessor {
     @Override
     public void onTrigger(final ProcessContext context,
             final ProcessSession session) throws ProcessException {
-        FlowFile flowFile = session.get();
+        List<FlowFile> flowFiles = Lists.newArrayListWithExpectedSize(batchSize);
+        for (int i = 0; i < batchSize; i++) {
+            FlowFile flowFile = session.get();
+            if (flowFile == null) {
+              break;
+            }
+
+            flowFiles.add(flowFile);
+        }
 
         Transaction transaction = channel.getTransaction();
         try {
             transaction.begin();
-            channel.put(new FlowFileEvent(flowFile, session));
+            for (FlowFile flowFile : flowFiles) {
+                channel.put(new FlowFileEvent(flowFile, session));
+            }
             transaction.commit();
         } catch (Throwable th) {
             transaction.rollback();
@@ -152,10 +177,17 @@ public class FlumeSinkProcessor extends AbstractFlumeProcessor {
         }
 
         try {
-            sink.process();
-            session.transfer(flowFile, SUCCESS);
+            Sink.Status status;
+            do {
+              status = sink.process();
+            } while(status == Sink.Status.READY);
+            for (FlowFile flowFile : flowFiles) {
+                session.transfer(flowFile, SUCCESS);
+            }
         } catch (EventDeliveryException ex) {
-            session.transfer(flowFile, FAILURE);
+            for (FlowFile flowFile : flowFiles) {
+                session.transfer(flowFile, FAILURE);
+            }
         }
     }
 }

http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/3b9e4824/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/src/test/java/org/apache/nifi/processors/flume/FlumeSinkProcessorTest.java
----------------------------------------------------------------------
diff --git a/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/src/test/java/org/apache/nifi/processors/flume/FlumeSinkProcessorTest.java b/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/src/test/java/org/apache/nifi/processors/flume/FlumeSinkProcessorTest.java
index 8d40cb6..d22514f 100644
--- a/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/src/test/java/org/apache/nifi/processors/flume/FlumeSinkProcessorTest.java
+++ b/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/src/test/java/org/apache/nifi/processors/flume/FlumeSinkProcessorTest.java
@@ -116,6 +116,19 @@ public class FlumeSinkProcessorTest {
         runner.run();
         fis.close();
     }
+
+    @Test
+    public void testBatchSize() throws IOException {
+        TestRunner runner = TestRunners.newTestRunner(FlumeSinkProcessor.class);
+        runner.setProperty(FlumeSinkProcessor.SINK_TYPE, NullSink.class.getName());
+        runner.setProperty(FlumeSinkProcessor.BATCH_SIZE, "1000");
+        runner.setProperty(FlumeSinkProcessor.FLUME_CONFIG,
+            "tier1.sinks.sink-1.batchSize = 1000\n");
+        for (int i = 0; i < 100000; i++) {
+          runner.enqueue(String.valueOf(i).getBytes());
+        }
+        runner.run();
+    }
     
     @Test
     public void testHdfsSink() throws IOException {

http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/3b9e4824/nifi/nifi-nar-bundles/nifi-flume-bundle/pom.xml
----------------------------------------------------------------------
diff --git a/nifi/nifi-nar-bundles/nifi-flume-bundle/pom.xml b/nifi/nifi-nar-bundles/nifi-flume-bundle/pom.xml
index dc9ec69..50b0fde 100644
--- a/nifi/nifi-nar-bundles/nifi-flume-bundle/pom.xml
+++ b/nifi/nifi-nar-bundles/nifi-flume-bundle/pom.xml
@@ -17,10 +17,10 @@
     <parent>
         <groupId>org.apache.nifi</groupId>
         <artifactId>nifi-nar-bundles</artifactId>
-        <version>0.0.1-incubating-SNAPSHOT</version>
+        <version>0.1.0-incubating-SNAPSHOT</version>
     </parent>
     <artifactId>nifi-flume-bundle</artifactId>
-    <version>0.0.1-incubating-SNAPSHOT</version>
+    <version>0.1.0-incubating-SNAPSHOT</version>
     <packaging>pom</packaging>
     <description>A bundle of processors that run Flume sources/sinks</description>
     <modules>
@@ -32,7 +32,7 @@
             <dependency>
                 <groupId>org.apache.nifi</groupId>
                 <artifactId>nifi-flume-processors</artifactId>
-                <version>0.0.1-incubating-SNAPSHOT</version>
+                <version>0.1.0-incubating-SNAPSHOT</version>
             </dependency>
         </dependencies>
     </dependencyManagement>

http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/3b9e4824/nifi/pom.xml
----------------------------------------------------------------------
diff --git a/nifi/pom.xml b/nifi/pom.xml
index 422e1aa..682a426 100644
--- a/nifi/pom.xml
+++ b/nifi/pom.xml
@@ -808,7 +808,7 @@
             <dependency>
                 <groupId>org.apache.nifi</groupId>
                 <artifactId>nifi-flume-nar</artifactId>
-                <version>0.0.1-incubating-SNAPSHOT</version>
+                <version>0.1.0-incubating-SNAPSHOT</version>
                 <type>nar</type>
             </dependency>
             <dependency>


[07/13] incubator-nifi git commit: NIFI-589: Updated with first review feedback

Posted by mc...@apache.org.
NIFI-589: Updated with first review feedback

* Switched to using `getResourceAsStream()` where possible
* Removed trailing whitespace from added files
* Added missing license headers
* Added RAT exception to testdata files
* Fixed POM errors that broke the build
* Switched to using TemporaryFolder instead of putting files in
  `target`
* Used try-with-resources where needed to autoclose streams
* Moved logging configuration to properties files
* Removed AbstractFlumeTest
* Fixed logging levels in test code

Signed-off-by: Matt Gilman <ma...@gmail.com>


Project: http://git-wip-us.apache.org/repos/asf/incubator-nifi/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-nifi/commit/3529bb33
Tree: http://git-wip-us.apache.org/repos/asf/incubator-nifi/tree/3529bb33
Diff: http://git-wip-us.apache.org/repos/asf/incubator-nifi/diff/3529bb33

Branch: refs/heads/develop
Commit: 3529bb33178ce70a33cc7ab21d7334ba3411048b
Parents: 3b9e482
Author: Joey Echeverria <jo...@gmail.com>
Authored: Fri Jun 5 14:00:37 2015 -0700
Committer: Matt Gilman <ma...@gmail.com>
Committed: Tue Jul 14 14:50:16 2015 -0400

----------------------------------------------------------------------
 .../org/apache/nifi/util/file/FileUtils.java    |  27 +++-
 .../nifi-flume-processors/pom.xml               | 127 +++++++++++--------
 .../nifi/processors/flume/NifiChannel.java      |  18 ++-
 .../processors/flume/NifiChannelSelector.java   |  18 ++-
 .../nifi/processors/flume/NifiTransaction.java  |  17 ++-
 .../processors/flume/util/FlowFileEvent.java    |  21 ++-
 .../flume/util/FlowFileEventConstants.java      |  17 ++-
 .../processors/flume/AbstractFlumeTest.java     |  35 -----
 .../flume/FlumeSinkProcessorTest.java           |  59 +++++----
 .../flume/FlumeSourceProcessorTest.java         |  25 ++--
 .../src/test/resources/core-site.xml            |   5 +
 .../src/test/resources/log4j.properties         |  20 +++
 .../src/test/resources/simplelogger.properties  |  20 +++
 nifi/pom.xml                                    |   1 +
 14 files changed, 261 insertions(+), 149 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/3529bb33/nifi/nifi-commons/nifi-utils/src/main/java/org/apache/nifi/util/file/FileUtils.java
----------------------------------------------------------------------
diff --git a/nifi/nifi-commons/nifi-utils/src/main/java/org/apache/nifi/util/file/FileUtils.java b/nifi/nifi-commons/nifi-utils/src/main/java/org/apache/nifi/util/file/FileUtils.java
index 7661e2d..ff4da8e 100644
--- a/nifi/nifi-commons/nifi-utils/src/main/java/org/apache/nifi/util/file/FileUtils.java
+++ b/nifi/nifi-commons/nifi-utils/src/main/java/org/apache/nifi/util/file/FileUtils.java
@@ -560,6 +560,19 @@ public class FileUtils {
      * @throws IOException if the MD5 hash could not be computed
      */
     public static byte[] computeMd5Digest(final File file) throws IOException {
+        try (final FileInputStream fis = new FileInputStream(file)) {
+            return computeMd5Digest(fis);
+        }
+    }
+
+    /**
+     * Returns the MD5 hash of the given stream.
+     *
+     * @param stream an input stream
+     * @return the MD5 hash
+     * @throws IOException if the MD5 hash could not be computed
+     */
+    public static byte[] computeMd5Digest(final InputStream stream) throws IOException {
         final MessageDigest digest;
         try {
             digest = MessageDigest.getInstance("MD5");
@@ -567,15 +580,15 @@ public class FileUtils {
             throw new IOException(nsae);
         }
 
-        try (final FileInputStream fis = new FileInputStream(file)) {
-            int len;
-            final byte[] buffer = new byte[8192];
-            while ((len = fis.read(buffer)) > -1) {
-                if (len > 0) {
-                    digest.update(buffer, 0, len);
-                }
+
+        int len;
+        final byte[] buffer = new byte[8192];
+        while ((len = stream.read(buffer)) > -1) {
+            if (len > 0) {
+                digest.update(buffer, 0, len);
             }
         }
+
         return digest.digest();
     }
 }

http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/3529bb33/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/pom.xml
----------------------------------------------------------------------
diff --git a/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/pom.xml b/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/pom.xml
index bd26a99..b903f21 100644
--- a/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/pom.xml
+++ b/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/pom.xml
@@ -38,14 +38,14 @@
             <groupId>org.apache.nifi</groupId>
             <artifactId>nifi-flowfile-packager</artifactId>
         </dependency>
-        <dependency> 
-            <groupId>org.apache.flume</groupId> 
-            <artifactId>flume-ng-sdk</artifactId> 
+        <dependency>
+            <groupId>org.apache.flume</groupId>
+            <artifactId>flume-ng-sdk</artifactId>
             <version>1.5.2</version>
-        </dependency> 
-        <dependency> 
-            <groupId>org.apache.flume</groupId> 
-            <artifactId>flume-ng-core</artifactId> 
+        </dependency>
+        <dependency>
+            <groupId>org.apache.flume</groupId>
+            <artifactId>flume-ng-core</artifactId>
             <version>1.5.2</version>
             <exclusions>
                 <exclusion>
@@ -53,74 +53,89 @@
                     <artifactId>slf4j-log4j12</artifactId>
                 </exclusion>
             </exclusions>
-        </dependency> 
+        </dependency>
 
         <!-- Flume Sources -->
-        <dependency> 
-            <groupId>org.apache.flume.flume-ng-sources</groupId> 
-            <artifactId>flume-twitter-source</artifactId> 
+        <dependency>
+            <groupId>org.apache.flume.flume-ng-sources</groupId>
+            <artifactId>flume-twitter-source</artifactId>
             <version>1.5.2</version>
-        </dependency> 
-        <dependency> 
-            <groupId>org.apache.flume.flume-ng-sources</groupId> 
-            <artifactId>flume-jms-source</artifactId> 
+        </dependency>
+        <dependency>
+            <groupId>org.apache.flume.flume-ng-sources</groupId>
+            <artifactId>flume-jms-source</artifactId>
             <version>1.5.2</version>
-        </dependency> 
-        <dependency> 
-            <groupId>org.apache.flume.flume-ng-sources</groupId> 
-            <artifactId>flume-scribe-source</artifactId> 
+        </dependency>
+        <dependency>
+            <groupId>org.apache.flume.flume-ng-sources</groupId>
+            <artifactId>flume-scribe-source</artifactId>
             <version>1.5.2</version>
-        </dependency> 
+        </dependency>
 
         <!-- Flume Sinks -->
-        <dependency> 
-            <groupId>org.apache.flume.flume-ng-sinks</groupId> 
-            <artifactId>flume-hdfs-sink</artifactId> 
+        <dependency>
+            <groupId>org.apache.flume.flume-ng-sinks</groupId>
+            <artifactId>flume-hdfs-sink</artifactId>
             <version>1.5.2</version>
-        </dependency> 
+        </dependency>
 
         <!-- HDFS sink dependencies -->
-        <dependency> 
-            <groupId>org.apache.hadoop</groupId> 
-            <artifactId>hadoop-common</artifactId> 
-            <scope>provided</scope> 
-        </dependency> 
-        <dependency> 
-            <groupId>org.apache.hadoop</groupId> 
-            <artifactId>hadoop-hdfs</artifactId> 
-            <scope>provided</scope> 
-        </dependency>
-        
-        <dependency> 
-            <groupId>org.apache.flume.flume-ng-sinks</groupId> 
-            <artifactId>flume-irc-sink</artifactId> 
+        <dependency>
+            <groupId>org.apache.hadoop</groupId>
+            <artifactId>hadoop-common</artifactId>
+            <scope>provided</scope>
+            <exclusions>
+                <exclusion>
+                    <groupId>org.slf4j</groupId>
+                    <artifactId>slf4j-log4j12</artifactId>
+                </exclusion>
+            </exclusions>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.hadoop</groupId>
+            <artifactId>hadoop-hdfs</artifactId>
+            <scope>provided</scope>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.flume.flume-ng-sinks</groupId>
+            <artifactId>flume-irc-sink</artifactId>
             <version>1.5.2</version>
-        </dependency> 
-        <dependency> 
-            <groupId>org.apache.flume.flume-ng-sinks</groupId> 
-            <artifactId>flume-ng-elasticsearch-sink</artifactId> 
+        </dependency>
+        <dependency>
+            <groupId>org.apache.flume.flume-ng-sinks</groupId>
+            <artifactId>flume-ng-elasticsearch-sink</artifactId>
             <version>1.5.2</version>
-        </dependency> 
-        <dependency> 
-            <groupId>org.apache.flume.flume-ng-sinks</groupId> 
-            <artifactId>flume-ng-hbase-sink</artifactId> 
+        </dependency>
+        <dependency>
+            <groupId>org.apache.flume.flume-ng-sinks</groupId>
+            <artifactId>flume-ng-hbase-sink</artifactId>
             <version>1.5.2</version>
-        </dependency> 
-        <dependency> 
-            <groupId>org.apache.flume.flume-ng-sinks</groupId> 
-            <artifactId>flume-ng-morphline-solr-sink</artifactId> 
+        </dependency>
+        <dependency>
+            <groupId>org.apache.flume.flume-ng-sinks</groupId>
+            <artifactId>flume-ng-morphline-solr-sink</artifactId>
             <version>1.5.2</version>
-        </dependency> 
+        </dependency>
 
         <dependency>
             <groupId>org.apache.nifi</groupId>
             <artifactId>nifi-mock</artifactId>
             <scope>test</scope>
         </dependency>
-        <dependency>
-          <groupId>org.slf4j</groupId>
-          <artifactId>slf4j-simple</artifactId>
-          <scope>test</scope>
-        </dependency>
     </dependencies>
+
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.rat</groupId>
+                <artifactId>apache-rat-plugin</artifactId>
+                <configuration>
+                    <excludes>
+                        <exclude>src/test/resources/testdata/*</exclude> <!-- test data -->
+                    </excludes>
+                </configuration>
+            </plugin>
+        </plugins>
+    </build>
 </project>

http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/3529bb33/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/src/main/java/org/apache/nifi/processors/flume/NifiChannel.java
----------------------------------------------------------------------
diff --git a/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/src/main/java/org/apache/nifi/processors/flume/NifiChannel.java b/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/src/main/java/org/apache/nifi/processors/flume/NifiChannel.java
index ac8dbe2..c4d3bef 100644
--- a/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/src/main/java/org/apache/nifi/processors/flume/NifiChannel.java
+++ b/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/src/main/java/org/apache/nifi/processors/flume/NifiChannel.java
@@ -1,4 +1,19 @@
-
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
 package org.apache.nifi.processors.flume;
 
 import org.apache.flume.Context;
@@ -24,7 +39,6 @@ public class NifiChannel extends BasicChannelSemantics {
 
   @Override
   public void configure(Context context) {
-    throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
   }
 
 

http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/3529bb33/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/src/main/java/org/apache/nifi/processors/flume/NifiChannelSelector.java
----------------------------------------------------------------------
diff --git a/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/src/main/java/org/apache/nifi/processors/flume/NifiChannelSelector.java b/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/src/main/java/org/apache/nifi/processors/flume/NifiChannelSelector.java
index 792678b..2b0ba77 100644
--- a/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/src/main/java/org/apache/nifi/processors/flume/NifiChannelSelector.java
+++ b/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/src/main/java/org/apache/nifi/processors/flume/NifiChannelSelector.java
@@ -1,4 +1,19 @@
-
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
 package org.apache.nifi.processors.flume;
 
 import com.google.common.collect.ImmutableList;
@@ -36,7 +51,6 @@ public class NifiChannelSelector implements ChannelSelector {
 
   @Override
   public void setChannels(List<Channel> channels) {
-    throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
   }
 
   @Override

http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/3529bb33/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/src/main/java/org/apache/nifi/processors/flume/NifiTransaction.java
----------------------------------------------------------------------
diff --git a/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/src/main/java/org/apache/nifi/processors/flume/NifiTransaction.java b/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/src/main/java/org/apache/nifi/processors/flume/NifiTransaction.java
index 3d6a647..37c8a50 100644
--- a/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/src/main/java/org/apache/nifi/processors/flume/NifiTransaction.java
+++ b/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/src/main/java/org/apache/nifi/processors/flume/NifiTransaction.java
@@ -1,4 +1,19 @@
-
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
 package org.apache.nifi.processors.flume;
 
 import org.apache.flume.Event;

http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/3529bb33/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/src/main/java/org/apache/nifi/processors/flume/util/FlowFileEvent.java
----------------------------------------------------------------------
diff --git a/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/src/main/java/org/apache/nifi/processors/flume/util/FlowFileEvent.java b/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/src/main/java/org/apache/nifi/processors/flume/util/FlowFileEvent.java
index c3531ca..5dc97d6 100644
--- a/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/src/main/java/org/apache/nifi/processors/flume/util/FlowFileEvent.java
+++ b/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/src/main/java/org/apache/nifi/processors/flume/util/FlowFileEvent.java
@@ -1,4 +1,19 @@
-
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
 package org.apache.nifi.processors.flume.util;
 
 import com.google.common.collect.Maps;
@@ -56,7 +71,7 @@ public class FlowFileEvent implements Event {
         }
         headers.put(LINEAGE_START_DATE_HEADER, Long.toString(flowFile.getLineageStartDate()));
         headers.put(SIZE_HEADER, Long.toString(flowFile.getSize()));
-        
+
         headersLoaded = true;
       }
     }
@@ -83,7 +98,7 @@ public class FlowFileEvent implements Event {
         if (flowFile.getSize() > Integer.MAX_VALUE) {
           throw new RuntimeException("Can't get body of Event because the backing FlowFile is too large (" + flowFile.getSize() + " bytes)");
         }
-    
+
         final ByteArrayOutputStream baos = new ByteArrayOutputStream((int) flowFile.getSize());
         session.read(flowFile, new InputStreamCallback() {
 

http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/3529bb33/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/src/main/java/org/apache/nifi/processors/flume/util/FlowFileEventConstants.java
----------------------------------------------------------------------
diff --git a/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/src/main/java/org/apache/nifi/processors/flume/util/FlowFileEventConstants.java b/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/src/main/java/org/apache/nifi/processors/flume/util/FlowFileEventConstants.java
index c13f0ef..c9650c1 100644
--- a/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/src/main/java/org/apache/nifi/processors/flume/util/FlowFileEventConstants.java
+++ b/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/src/main/java/org/apache/nifi/processors/flume/util/FlowFileEventConstants.java
@@ -1,4 +1,19 @@
-
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
 package org.apache.nifi.processors.flume.util;
 
 

http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/3529bb33/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/src/test/java/org/apache/nifi/processors/flume/AbstractFlumeTest.java
----------------------------------------------------------------------
diff --git a/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/src/test/java/org/apache/nifi/processors/flume/AbstractFlumeTest.java b/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/src/test/java/org/apache/nifi/processors/flume/AbstractFlumeTest.java
deleted file mode 100644
index 87b056a..0000000
--- a/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/src/test/java/org/apache/nifi/processors/flume/AbstractFlumeTest.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.nifi.processors.flume;
-
-import org.junit.BeforeClass;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class AbstractFlumeTest {
-
-    private static Logger logger;
-
-    @BeforeClass
-    public static void setUpClass() {
-        System.setProperty("org.slf4j.simpleLogger.defaultLogLevel", "info");
-        System.setProperty("org.slf4j.simpleLogger.showDateTime", "true");
-        System.setProperty("org.slf4j.simpleLogger.log.nifi.processors.flume", "debug");
-        logger = LoggerFactory.getLogger(AbstractFlumeTest.class);
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/3529bb33/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/src/test/java/org/apache/nifi/processors/flume/FlumeSinkProcessorTest.java
----------------------------------------------------------------------
diff --git a/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/src/test/java/org/apache/nifi/processors/flume/FlumeSinkProcessorTest.java b/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/src/test/java/org/apache/nifi/processors/flume/FlumeSinkProcessorTest.java
index d22514f..2e10c24 100644
--- a/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/src/test/java/org/apache/nifi/processors/flume/FlumeSinkProcessorTest.java
+++ b/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/src/test/java/org/apache/nifi/processors/flume/FlumeSinkProcessorTest.java
@@ -19,9 +19,9 @@ package org.apache.nifi.processors.flume;
 import java.io.File;
 import static org.junit.Assert.assertEquals;
 
-import java.io.FileInputStream;
 import java.io.FilenameFilter;
 import java.io.IOException;
+import java.io.InputStream;
 import java.util.Collection;
 import java.util.HashMap;
 import java.util.HashSet;
@@ -39,15 +39,20 @@ import org.apache.nifi.util.TestRunners;
 import org.apache.nifi.util.file.FileUtils;
 
 import org.junit.Assert;
+import org.junit.Rule;
 import org.junit.Test;
+import org.junit.rules.TemporaryFolder;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 public class FlumeSinkProcessorTest {
 
-  private static final Logger logger =
-      LoggerFactory.getLogger(FlumeSinkProcessorTest.class);
-  
+    private static final Logger logger =
+        LoggerFactory.getLogger(FlumeSinkProcessorTest.class);
+
+    @Rule
+    public final TemporaryFolder temp = new TemporaryFolder();
+
     @Test
     public void testValidators() {
         TestRunner runner = TestRunners.newTestRunner(FlumeSinkProcessor.class);
@@ -62,7 +67,7 @@ public class FlumeSinkProcessorTest {
         }
         Assert.assertEquals(1, results.size());
         for (ValidationResult vr : results) {
-            logger.error(vr.toString());
+            logger.debug(vr.toString());
             Assert.assertTrue(vr.toString().contains("is invalid because Sink Type is required"));
         }
 
@@ -76,7 +81,7 @@ public class FlumeSinkProcessorTest {
         }
         Assert.assertEquals(1, results.size());
         for (ValidationResult vr : results) {
-            logger.error(vr.toString());
+            logger.debug(vr.toString());
             Assert.assertTrue(vr.toString().contains("is invalid because unable to load sink"));
         }
 
@@ -90,7 +95,7 @@ public class FlumeSinkProcessorTest {
         }
         Assert.assertEquals(1, results.size());
         for (ValidationResult vr : results) {
-            logger.error(vr.toString());
+            logger.debug(vr.toString());
             Assert.assertTrue(vr.toString().contains("is invalid because unable to create sink"));
         }
 
@@ -109,12 +114,12 @@ public class FlumeSinkProcessorTest {
     public void testNullSink() throws IOException {
         TestRunner runner = TestRunners.newTestRunner(FlumeSinkProcessor.class);
         runner.setProperty(FlumeSinkProcessor.SINK_TYPE, NullSink.class.getName());
-        FileInputStream fis = new FileInputStream("src/test/resources/testdata/records.txt");
-        Map<String, String> attributes = new HashMap<>();
-        attributes.put(CoreAttributes.FILENAME.key(), "records.txt");
-        runner.enqueue(fis, attributes);
-        runner.run();
-        fis.close();
+        try (InputStream inputStream = getClass().getResourceAsStream("/testdata/records.txt")) {
+            Map<String, String> attributes = new HashMap<>();
+            attributes.put(CoreAttributes.FILENAME.key(), "records.txt");
+            runner.enqueue(inputStream, attributes);
+            runner.run();
+        }
     }
 
     @Test
@@ -129,15 +134,10 @@ public class FlumeSinkProcessorTest {
         }
         runner.run();
     }
-    
+
     @Test
     public void testHdfsSink() throws IOException {
-        File destDir = new File("target/hdfs");
-        if (destDir.exists()) {
-          FileUtils.deleteFilesInDir(destDir, null, logger);
-        } else {
-          destDir.mkdirs();
-        }
+        File destDir = temp.newFolder("hdfs");
 
         TestRunner runner = TestRunners.newTestRunner(FlumeSinkProcessor.class);
         runner.setProperty(FlumeSinkProcessor.SINK_TYPE, "hdfs");
@@ -147,19 +147,22 @@ public class FlumeSinkProcessorTest {
             "tier1.sinks.sink-1.hdfs.serializer = TEXT\n" +
             "tier1.sinks.sink-1.serializer.appendNewline = false"
         );
-        FileInputStream fis = new FileInputStream("src/test/resources/testdata/records.txt");
-        Map<String, String> attributes = new HashMap<>();
-        attributes.put(CoreAttributes.FILENAME.key(), "records.txt");
-        runner.enqueue(fis, attributes);
-        runner.run();
-        fis.close();
+        try (InputStream inputStream = getClass().getResourceAsStream("/testdata/records.txt")) {
+            Map<String, String> attributes = new HashMap<>();
+            attributes.put(CoreAttributes.FILENAME.key(), "records.txt");
+            runner.enqueue(inputStream, attributes);
+            runner.run();
+        }
 
         File[] files = destDir.listFiles((FilenameFilter)HiddenFileFilter.VISIBLE);
         assertEquals("Unexpected number of destination files.", 1, files.length);
         File dst = files[0];
-        byte[] expectedMd5 = FileUtils.computeMd5Digest(new File("src/test/resources/testdata/records.txt"));
+        byte[] expectedMd5;
+        try (InputStream md5Stream = getClass().getResourceAsStream("/testdata/records.txt")) {
+            expectedMd5 = FileUtils.computeMd5Digest(md5Stream);
+        }
         byte[] actualMd5 = FileUtils.computeMd5Digest(dst);
         Assert.assertArrayEquals("Destination file doesn't match source data", expectedMd5, actualMd5);
     }
- 
+
 }

http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/3529bb33/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/src/test/java/org/apache/nifi/processors/flume/FlumeSourceProcessorTest.java
----------------------------------------------------------------------
diff --git a/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/src/test/java/org/apache/nifi/processors/flume/FlumeSourceProcessorTest.java b/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/src/test/java/org/apache/nifi/processors/flume/FlumeSourceProcessorTest.java
index bbcf116..043e115 100644
--- a/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/src/test/java/org/apache/nifi/processors/flume/FlumeSourceProcessorTest.java
+++ b/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/src/test/java/org/apache/nifi/processors/flume/FlumeSourceProcessorTest.java
@@ -34,15 +34,18 @@ import org.apache.nifi.util.TestRunners;
 import org.apache.nifi.util.file.FileUtils;
 
 import org.junit.Assert;
+import org.junit.Rule;
 import org.junit.Test;
+import org.junit.rules.TemporaryFolder;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 public class FlumeSourceProcessorTest {
 
-  private static final Logger logger =
-      LoggerFactory.getLogger(FlumeSourceProcessorTest.class);
+    private static final Logger logger = LoggerFactory.getLogger(FlumeSourceProcessorTest.class);
 
+    @Rule
+    public final TemporaryFolder temp = new TemporaryFolder();
 
     @Test
     public void testValidators() {
@@ -58,7 +61,7 @@ public class FlumeSourceProcessorTest {
         }
         Assert.assertEquals(1, results.size());
         for (ValidationResult vr : results) {
-            logger.error(vr.toString());
+            logger.debug(vr.toString());
             Assert.assertTrue(vr.toString().contains("is invalid because Source Type is required"));
         }
 
@@ -72,7 +75,7 @@ public class FlumeSourceProcessorTest {
         }
         Assert.assertEquals(1, results.size());
         for (ValidationResult vr : results) {
-            logger.error(vr.toString());
+            logger.debug(vr.toString());
             Assert.assertTrue(vr.toString().contains("is invalid because unable to load source"));
         }
 
@@ -86,7 +89,7 @@ public class FlumeSourceProcessorTest {
         }
         Assert.assertEquals(1, results.size());
         for (ValidationResult vr : results) {
-            logger.error(vr.toString());
+            logger.debug(vr.toString());
             Assert.assertTrue(vr.toString().contains("is invalid because unable to create source"));
         }
 
@@ -108,22 +111,16 @@ public class FlumeSourceProcessorTest {
         List<MockFlowFile> flowFiles = runner.getFlowFilesForRelationship(FlumeSourceProcessor.SUCCESS);
         Assert.assertEquals(1, flowFiles.size());
         for (MockFlowFile flowFile : flowFiles) {
-          logger.error(flowFile.toString());
+            logger.debug(flowFile.toString());
             Assert.assertEquals(1, flowFile.getSize());
         }
     }
 
     @Test
     public void testSourceWithConfig() throws IOException {
-        File spoolDirectory = new File("target/spooldir");
-        if (spoolDirectory.exists()) {
-          FileUtils.deleteFilesInDir(spoolDirectory, null, logger);
-        } else {
-          spoolDirectory.mkdirs();
-        }
-        File src = new File("src/test/resources/testdata/records.txt");
+        File spoolDirectory = temp.newFolder("spooldir");
         File dst = new File(spoolDirectory, "records.txt");
-        FileUtils.copyFile(src, dst, false, false, logger);
+        FileUtils.copyFile(getClass().getResourceAsStream("/testdata/records.txt"), dst, true, false);
 
         TestRunner runner = TestRunners.newTestRunner(FlumeSourceProcessor.class);
         runner.setProperty(FlumeSourceProcessor.SOURCE_TYPE, "spooldir");

http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/3529bb33/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/src/test/resources/core-site.xml
----------------------------------------------------------------------
diff --git a/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/src/test/resources/core-site.xml b/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/src/test/resources/core-site.xml
index 5e3b55c..849854b 100644
--- a/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/src/test/resources/core-site.xml
+++ b/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/src/test/resources/core-site.xml
@@ -20,6 +20,11 @@
 <configuration>
     <property>
         <name>fs.defaultFS</name>
+        <!--
+            Hadoop doesn't support a chroot style operation for the
+            local filesystem so there's no benefit to setting this
+            to a directory other than '/'
+        -->
         <value>file:///</value>
     </property>
 </configuration>

http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/3529bb33/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/src/test/resources/log4j.properties
----------------------------------------------------------------------
diff --git a/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/src/test/resources/log4j.properties b/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/src/test/resources/log4j.properties
new file mode 100644
index 0000000..8c502ec
--- /dev/null
+++ b/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/src/test/resources/log4j.properties
@@ -0,0 +1,20 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+log4j.rootLogger=INFO, CONSOLE
+
+log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender
+
+log4j.appender.CONSOLE.layout=org.apache.log4j.PatternLayout
+log4j.appender.CONSOLE.layout.ConversionPattern=%-4r [%t] %-5p %c %x \u2013 %m%n
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/3529bb33/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/src/test/resources/simplelogger.properties
----------------------------------------------------------------------
diff --git a/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/src/test/resources/simplelogger.properties b/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/src/test/resources/simplelogger.properties
new file mode 100644
index 0000000..4994e7f
--- /dev/null
+++ b/nifi/nifi-nar-bundles/nifi-flume-bundle/nifi-flume-processors/src/test/resources/simplelogger.properties
@@ -0,0 +1,20 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+org.slf4j.simpleLogger.logFile=System.out
+org.slf4j.simpleLogger.defaultLogLevel=info
+org.slf4j.simpleLogger.showDateTime=true
+org.slf4j.simpleLogger.dateTimeFormat=yyyy-MM-dd HH:mm:ss.SSS
+org.slf4j.simpleLogger.levelInBrackets=true
+org.slf4j.simpleLogger.log.org.apache.nifi.processors.flume=debug

http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/3529bb33/nifi/pom.xml
----------------------------------------------------------------------
diff --git a/nifi/pom.xml b/nifi/pom.xml
index 682a426..3a5c6b7 100644
--- a/nifi/pom.xml
+++ b/nifi/pom.xml
@@ -805,6 +805,7 @@
                 <artifactId>nifi-geo-nar</artifactId>
                 <version>0.2.0-incubating-SNAPSHOT</version>
                 <type>nar</type>
+            </dependency>
             <dependency>
                 <groupId>org.apache.nifi</groupId>
                 <artifactId>nifi-flume-nar</artifactId>