You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2016/07/15 07:09:56 UTC

[3/4] camel git commit: Add Lumberjack component

Add Lumberjack component


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

Branch: refs/heads/master
Commit: 3d0379d0379944187d6c780cf7567b895697c648
Parents: 920a88d
Author: Antoine DESSAIGNE <an...@gmail.com>
Authored: Fri Jul 8 09:37:53 2016 +0200
Committer: Claus Ibsen <da...@apache.org>
Committed: Fri Jul 15 08:59:27 2016 +0200

----------------------------------------------------------------------
 apache-camel/pom.xml                            |  12 +-
 .../src/main/descriptors/common-bin.xml         |   1 +
 components/camel-lumberjack/pom.xml             |  84 +++++++
 .../src/main/docs/lumberjack.adoc               |  93 ++++++++
 .../lumberjack/LumberjackComponent.java         |  60 +++++
 .../lumberjack/LumberjackConsumer.java          |  68 ++++++
 .../lumberjack/LumberjackEndpoint.java          |  54 +++++
 .../lumberjack/LumberjacksComponent.java        |  31 +++
 .../lumberjack/LumberjacksEndpoint.java         |  45 ++++
 .../io/LumberjackChannelInitializer.java        |  62 ++++++
 .../lumberjack/io/LumberjackConstants.java      |  46 ++++
 .../lumberjack/io/LumberjackFrameDecoder.java   | 217 +++++++++++++++++++
 .../lumberjack/io/LumberjackMessage.java        |  38 ++++
 .../lumberjack/io/LumberjackMessageHandler.java |  67 ++++++
 .../io/LumberjackMessageProcessor.java          |  44 ++++
 .../lumberjack/io/LumberjackServer.java         | 111 ++++++++++
 .../lumberjack/io/LumberjackSessionHandler.java |  65 ++++++
 .../src/main/resources/LICENSE.txt              | 203 +++++++++++++++++
 .../org/apache/camel/component/lumberjack       |  17 ++
 .../org/apache/camel/component/lumberjacks      |  17 ++
 .../src/main/resources/NOTICE.txt               |  11 +
 .../lumberjack/LumberjackComponentTest.java     |  69 ++++++
 .../lumberjack/LumberjackDisconnectionTest.java |  82 +++++++
 .../component/lumberjack/LumberjackUtil.java    | 112 ++++++++++
 .../lumberjack/LumberjacksComponentTest.java    | 109 ++++++++++
 .../io/LumberjackChannelInitializerTest.java    |  81 +++++++
 .../src/test/resources/log4j.properties         |  38 ++++
 .../camel/component/lumberjack/io/window10      | Bin 0 -> 1195 bytes
 .../camel/component/lumberjack/io/window15      | Bin 0 -> 1489 bytes
 .../camel/component/lumberjack/keystore.jks     | Bin 0 -> 1473 bytes
 components/pom.xml                              |   1 +
 parent/pom.xml                                  |  15 +-
 .../features/src/main/resources/features.xml    |  11 +
 .../camel/itest/karaf/CamelLumberjackTest.java  |  36 +++
 34 files changed, 1891 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/3d0379d0/apache-camel/pom.xml
----------------------------------------------------------------------
diff --git a/apache-camel/pom.xml b/apache-camel/pom.xml
index 8e9d4c4..e2e6001 100644
--- a/apache-camel/pom.xml
+++ b/apache-camel/pom.xml
@@ -528,10 +528,6 @@
     </dependency>
     <dependency>
       <groupId>org.apache.camel</groupId>
-      <artifactId>camel-lucene</artifactId>
-    </dependency>
-    <dependency>
-      <groupId>org.apache.camel</groupId>
       <artifactId>camel-ldap</artifactId>
     </dependency>
     <dependency>
@@ -548,6 +544,14 @@
     </dependency>
     <dependency>
       <groupId>org.apache.camel</groupId>
+      <artifactId>camel-lucene</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.camel</groupId>
+      <artifactId>camel-lumberjack</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.camel</groupId>
       <artifactId>camel-lzf</artifactId>
     </dependency>
     <dependency>

http://git-wip-us.apache.org/repos/asf/camel/blob/3d0379d0/apache-camel/src/main/descriptors/common-bin.xml
----------------------------------------------------------------------
diff --git a/apache-camel/src/main/descriptors/common-bin.xml b/apache-camel/src/main/descriptors/common-bin.xml
index af39760..5f3e9bc 100644
--- a/apache-camel/src/main/descriptors/common-bin.xml
+++ b/apache-camel/src/main/descriptors/common-bin.xml
@@ -147,6 +147,7 @@
         <include>org.apache.camel:camel-linkedin-api</include>
         <include>org.apache.camel:camel-linkedin</include>
         <include>org.apache.camel:camel-lucene</include>
+        <include>org.apache.camel:camel-lumberjack</include>
         <include>org.apache.camel:camel-lzf</include>
         <include>org.apache.camel:camel-metrics</include>
         <include>org.apache.camel:camel-mail</include>

http://git-wip-us.apache.org/repos/asf/camel/blob/3d0379d0/components/camel-lumberjack/pom.xml
----------------------------------------------------------------------
diff --git a/components/camel-lumberjack/pom.xml b/components/camel-lumberjack/pom.xml
new file mode 100644
index 0000000..1e69023
--- /dev/null
+++ b/components/camel-lumberjack/pom.xml
@@ -0,0 +1,84 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+    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.
+
+-->
+<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">
+    <modelVersion>4.0.0</modelVersion>
+
+    <parent>
+        <groupId>org.apache.camel</groupId>
+        <artifactId>components</artifactId>
+        <version>2.18-SNAPSHOT</version>
+    </parent>
+
+    <artifactId>camel-lumberjack</artifactId>
+    <packaging>jar</packaging>
+    <name>Camel :: Lumberjack</name>
+    <description>Camel Lumberjack log streaming component</description>
+
+    <properties>
+        <camel.osgi.export.pkg>org.apache.camel.component.lumberjack.*</camel.osgi.export.pkg>
+        <camel.osgi.export.service>
+            org.apache.camel.spi.ComponentResolver;component=lumberjack,
+            org.apache.camel.spi.ComponentResolver;component=lumberjacks
+        </camel.osgi.export.service>
+    </properties>
+
+    <dependencies>
+
+        <dependency>
+            <groupId>org.apache.camel</groupId>
+            <artifactId>camel-core</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>io.netty</groupId>
+            <artifactId>netty-transport</artifactId>
+            <version>${netty-version}</version>
+        </dependency>
+        <dependency>
+            <groupId>io.netty</groupId>
+            <artifactId>netty-handler</artifactId>
+            <version>${netty-version}</version>
+        </dependency>
+        <dependency>
+            <groupId>com.google.code.gson</groupId>
+            <artifactId>gson</artifactId>
+            <version>${gson-version}</version>
+        </dependency>
+
+        <!-- test dependencies -->
+        <dependency>
+            <groupId>junit</groupId>
+            <artifactId>junit</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.camel</groupId>
+            <artifactId>camel-test</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.slf4j</groupId>
+            <artifactId>slf4j-log4j12</artifactId>
+            <scope>test</scope>
+        </dependency>
+    </dependencies>
+
+</project>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/camel/blob/3d0379d0/components/camel-lumberjack/src/main/docs/lumberjack.adoc
----------------------------------------------------------------------
diff --git a/components/camel-lumberjack/src/main/docs/lumberjack.adoc b/components/camel-lumberjack/src/main/docs/lumberjack.adoc
new file mode 100644
index 0000000..51c2fca
--- /dev/null
+++ b/components/camel-lumberjack/src/main/docs/lumberjack.adoc
@@ -0,0 +1,93 @@
+[[Lumberjack-LumberjackComponent]]
+Lumberjack Component
+~~~~~~~~~~~~~~~~~~~~
+
+*Available as of Camel 2.18*
+
+The *Lumberjack* component retrieves logs sent over the network using the Lumberjack protocol,
+from https://www.elastic.co/fr/products/beats/filebeat[Filebeat] for instance.
+The network communication can be secured with SSL using the `lumberjacks` component.
+
+This component only supports consumer endpoints.
+
+Maven users will need to add the following dependency to their `pom.xml` for this component:
+
+[source,xml]
+------------------------------------------------------------
+<dependency>
+    <groupId>org.apache.camel</groupId>
+    <artifactId>camel-lumberjack</artifactId>
+    <version>x.x.x</version>
+    <!-- use the same version as your Camel core version -->
+</dependency>
+------------------------------------------------------------
+
+[[Lumberjack-URIformat]]
+URI format
+^^^^^^^^^^
+
+[source,java]
+------------------------------------
+lumberjack:host
+lumberjack:host:port
+lumberjacks:host:port?sslContextParameters=#ssl
+------------------------------------
+
+You can append query options to the URI in the following format,
+`?option=value&option=value&...`
+
+[[Lumberjack-Options]]
+Options
+^^^^^^^
+
+
+// component options: START
+The Lumberjack component has no options.
+// component options: END
+
+
+
+// endpoint options: START
+The Lumberjack component supports 6 endpoint options which are listed below:
+
+{% raw %}
+[width="100%",cols="2s,1,1m,1m,5",options="header"]
+|=======================================================================
+| Name | Group | Default | Java Type | Description
+| host | common |  | String | *Required* Network interface on which to listen for Lumberjack
+| port | common | 5044 | int | Network port on which to listen for Lumberjack
+| bridgeErrorHandler | consumer | false | boolean | Allows for bridging the consumer to the Camel routing Error Handler which mean any exceptions occurred while the consumer is trying to pickup incoming messages or the likes will now be processed as a message and handled by the routing Error Handler. By default the consumer will use the org.apache.camel.spi.ExceptionHandler to deal with exceptions that will be logged at WARN/ERROR level and ignored.
+| exceptionHandler | consumer (advanced) |  | ExceptionHandler | To let the consumer use a custom ExceptionHandler. Notice if the option bridgeErrorHandler is enabled then this options is not in use. By default the consumer will deal with exceptions that will be logged at WARN/ERROR level and ignored.
+| exchangePattern | advanced | InOnly | ExchangePattern | Sets the default exchange pattern when creating an exchange
+| synchronous | advanced | false | boolean | Sets whether synchronous processing should be strictly used or Camel is allowed to use asynchronous processing (if supported).
+|=======================================================================
+{% endraw %}
+// endpoint options: END
+
+
+
+[[Lumberjack-Result]]
+Result
+^^^^^^
+
+The result body is a `Map<String, Object>` object.
+
+[[Lumberjack-LumberjackUsageSamples]]
+Lumberjack Usage Samples
+^^^^^^^^^^^^^^^^^^^^^^^^
+
+[[Lumberjack-Example1:]]
+Example 1: Streaming the log messages
++++++++++++++++++++++++++++++++++++++
+
+[source,java]
+------------------------------------------------------------------------------------
+RouteBuilder builder = new RouteBuilder() {
+    public void configure() {
+       from("lumberjack:0.0.0.0").                  // Listen on all network interfaces using the default port
+           setBody(simple("${body[message]}")).     // Select only the log message
+           to("stream:out");                        // Write it into the output stream
+    }
+};
+------------------------------------------------------------------------------------
+

http://git-wip-us.apache.org/repos/asf/camel/blob/3d0379d0/components/camel-lumberjack/src/main/java/org/apache/camel/component/lumberjack/LumberjackComponent.java
----------------------------------------------------------------------
diff --git a/components/camel-lumberjack/src/main/java/org/apache/camel/component/lumberjack/LumberjackComponent.java b/components/camel-lumberjack/src/main/java/org/apache/camel/component/lumberjack/LumberjackComponent.java
new file mode 100644
index 0000000..1cb9dda
--- /dev/null
+++ b/components/camel-lumberjack/src/main/java/org/apache/camel/component/lumberjack/LumberjackComponent.java
@@ -0,0 +1,60 @@
+/**
+ * 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.camel.component.lumberjack;
+
+import java.util.Map;
+
+import org.apache.camel.Endpoint;
+import org.apache.camel.impl.UriEndpointComponent;
+
+/**
+ * The class is the Camel component for the Lumberjack server
+ */
+public class LumberjackComponent extends UriEndpointComponent {
+    static final int DEFAULT_PORT = 5044;
+
+    public LumberjackComponent() {
+        this(LumberjackEndpoint.class);
+    }
+
+    protected LumberjackComponent(Class<? extends LumberjackEndpoint> endpointClass) {
+        super(endpointClass);
+    }
+
+    @Override
+    protected Endpoint createEndpoint(String uri, String remaining, Map<String, Object> parameters) throws Exception {
+        // Extract host and port
+        String host;
+        int port;
+        int separatorIndex = remaining.indexOf(':');
+        if (separatorIndex >= 0) {
+            host = remaining.substring(0, separatorIndex);
+            port = Integer.parseInt(remaining.substring(separatorIndex + 1));
+        } else {
+            host = remaining;
+            port = DEFAULT_PORT;
+        }
+
+        Endpoint answer = createEndpoint(uri, host, port);
+        setProperties(answer, parameters);
+        return answer;
+    }
+
+    protected LumberjackEndpoint createEndpoint(String uri, String host, int port) {
+        return new LumberjackEndpoint(uri, this, host, port);
+    }
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/3d0379d0/components/camel-lumberjack/src/main/java/org/apache/camel/component/lumberjack/LumberjackConsumer.java
----------------------------------------------------------------------
diff --git a/components/camel-lumberjack/src/main/java/org/apache/camel/component/lumberjack/LumberjackConsumer.java b/components/camel-lumberjack/src/main/java/org/apache/camel/component/lumberjack/LumberjackConsumer.java
new file mode 100644
index 0000000..affdaaf
--- /dev/null
+++ b/components/camel-lumberjack/src/main/java/org/apache/camel/component/lumberjack/LumberjackConsumer.java
@@ -0,0 +1,68 @@
+/**
+ * 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.camel.component.lumberjack;
+
+import java.util.concurrent.ThreadFactory;
+import javax.net.ssl.SSLContext;
+
+import org.apache.camel.Exchange;
+import org.apache.camel.Processor;
+import org.apache.camel.component.lumberjack.io.LumberjackMessageProcessor;
+import org.apache.camel.component.lumberjack.io.LumberjackServer;
+import org.apache.camel.impl.DefaultConsumer;
+import org.apache.camel.util.concurrent.CamelThreadFactory;
+
+class LumberjackConsumer extends DefaultConsumer {
+    private final LumberjackServer lumberjackServer;
+
+    LumberjackConsumer(LumberjackEndpoint endpoint, Processor processor, String host, int port, SSLContext sslContext) {
+        super(endpoint, processor);
+        lumberjackServer = new LumberjackServer(host, port, sslContext, getThreadFactory(), this::onMessageReceived);
+    }
+
+    @Override
+    protected void doStart() throws Exception {
+        super.doStart();
+        lumberjackServer.start();
+    }
+
+    @Override
+    protected void doResume() throws Exception {
+        super.doResume();
+        lumberjackServer.start();
+    }
+
+    @Override
+    protected void doSuspend() throws Exception {
+        lumberjackServer.stop();
+        super.doSuspend();
+    }
+
+    private ThreadFactory getThreadFactory() {
+        String threadNamePattern = getEndpoint().getCamelContext().getExecutorServiceManager().getThreadNamePattern();
+        return new CamelThreadFactory(threadNamePattern, "LumberjackNettyExecutor", true);
+    }
+
+    private void onMessageReceived(Object payload, LumberjackMessageProcessor.Callback callback) {
+        // Create the exchange
+        Exchange exchange = getEndpoint().createExchange();
+        exchange.getIn().setBody(payload);
+
+        // Process the exchange
+        getAsyncProcessor().process(exchange, doneSync -> callback.onComplete(!exchange.isFailed()));
+    }
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/3d0379d0/components/camel-lumberjack/src/main/java/org/apache/camel/component/lumberjack/LumberjackEndpoint.java
----------------------------------------------------------------------
diff --git a/components/camel-lumberjack/src/main/java/org/apache/camel/component/lumberjack/LumberjackEndpoint.java b/components/camel-lumberjack/src/main/java/org/apache/camel/component/lumberjack/LumberjackEndpoint.java
new file mode 100644
index 0000000..0b0d37e
--- /dev/null
+++ b/components/camel-lumberjack/src/main/java/org/apache/camel/component/lumberjack/LumberjackEndpoint.java
@@ -0,0 +1,54 @@
+/**
+ * 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.camel.component.lumberjack;
+
+import org.apache.camel.Processor;
+import org.apache.camel.Producer;
+import org.apache.camel.impl.DefaultEndpoint;
+import org.apache.camel.spi.Metadata;
+import org.apache.camel.spi.UriEndpoint;
+import org.apache.camel.spi.UriPath;
+
+@UriEndpoint(scheme = "lumberjack", title = "Lumberjack", syntax = "lumberjack:host:port", consumerClass = LumberjackConsumer.class, label = "log")
+class LumberjackEndpoint extends DefaultEndpoint {
+    @UriPath(description = "Network interface on which to listen for Lumberjack")
+    @Metadata(required = "true")
+    final String host;
+    @UriPath(description = "Network port on which to listen for Lumberjack", defaultValue = "" + LumberjackComponent.DEFAULT_PORT)
+    final int port;
+
+    LumberjackEndpoint(String endpointUri, LumberjackComponent component, String host, int port) {
+        super(endpointUri, component);
+        this.host = host;
+        this.port = port;
+    }
+
+    @Override
+    public Producer createProducer() throws Exception {
+        throw new UnsupportedOperationException("The Lumberjack component cannot be used as a producer");
+    }
+
+    @Override
+    public LumberjackConsumer createConsumer(Processor processor) throws Exception {
+        return new LumberjackConsumer(this, processor, host, port, null);
+    }
+
+    @Override
+    public boolean isSingleton() {
+        return true;
+    }
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/3d0379d0/components/camel-lumberjack/src/main/java/org/apache/camel/component/lumberjack/LumberjacksComponent.java
----------------------------------------------------------------------
diff --git a/components/camel-lumberjack/src/main/java/org/apache/camel/component/lumberjack/LumberjacksComponent.java b/components/camel-lumberjack/src/main/java/org/apache/camel/component/lumberjack/LumberjacksComponent.java
new file mode 100644
index 0000000..3d5bfb2
--- /dev/null
+++ b/components/camel-lumberjack/src/main/java/org/apache/camel/component/lumberjack/LumberjacksComponent.java
@@ -0,0 +1,31 @@
+/**
+ * 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.camel.component.lumberjack;
+
+/**
+ * The class is the Camel component for the Lumberjack server with SSL
+ */
+public class LumberjacksComponent extends LumberjackComponent {
+    public LumberjacksComponent() {
+        super(LumberjacksEndpoint.class);
+    }
+
+    @Override
+    protected LumberjacksEndpoint createEndpoint(String uri, String host, int port) {
+        return new LumberjacksEndpoint(uri, this, host, port);
+    }
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/3d0379d0/components/camel-lumberjack/src/main/java/org/apache/camel/component/lumberjack/LumberjacksEndpoint.java
----------------------------------------------------------------------
diff --git a/components/camel-lumberjack/src/main/java/org/apache/camel/component/lumberjack/LumberjacksEndpoint.java b/components/camel-lumberjack/src/main/java/org/apache/camel/component/lumberjack/LumberjacksEndpoint.java
new file mode 100644
index 0000000..db02d3b
--- /dev/null
+++ b/components/camel-lumberjack/src/main/java/org/apache/camel/component/lumberjack/LumberjacksEndpoint.java
@@ -0,0 +1,45 @@
+/**
+ * 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.camel.component.lumberjack;
+
+import org.apache.camel.Processor;
+import org.apache.camel.spi.UriEndpoint;
+import org.apache.camel.spi.UriParam;
+import org.apache.camel.util.jsse.SSLContextParameters;
+
+@UriEndpoint(scheme = "lumberjacks", title = "Lumberjacks", syntax = "lumberjacks:host:port", consumerClass = LumberjackConsumer.class, label = "log")
+class LumberjacksEndpoint extends LumberjackEndpoint {
+    @UriParam(description = "SSL configuration")
+    private SSLContextParameters sslContextParameters;
+
+    LumberjacksEndpoint(String endpointUri, LumberjackComponent component, String host, int port) {
+        super(endpointUri, component, host, port);
+    }
+
+    @Override
+    public LumberjackConsumer createConsumer(Processor processor) throws Exception {
+        if (sslContextParameters == null) {
+            throw new IllegalStateException("The sslContextParameters attribute must be defined for lumberjacks");
+        }
+        return new LumberjackConsumer(this, processor, host, port, sslContextParameters.createSSLContext(getCamelContext()));
+    }
+
+    @SuppressWarnings("unused")
+    public void setSslContextParameters(SSLContextParameters sslContextParameters) {
+        this.sslContextParameters = sslContextParameters;
+    }
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/3d0379d0/components/camel-lumberjack/src/main/java/org/apache/camel/component/lumberjack/io/LumberjackChannelInitializer.java
----------------------------------------------------------------------
diff --git a/components/camel-lumberjack/src/main/java/org/apache/camel/component/lumberjack/io/LumberjackChannelInitializer.java b/components/camel-lumberjack/src/main/java/org/apache/camel/component/lumberjack/io/LumberjackChannelInitializer.java
new file mode 100644
index 0000000..903fa94
--- /dev/null
+++ b/components/camel-lumberjack/src/main/java/org/apache/camel/component/lumberjack/io/LumberjackChannelInitializer.java
@@ -0,0 +1,62 @@
+/**
+ * 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.camel.component.lumberjack.io;
+
+import javax.net.ssl.SSLContext;
+import javax.net.ssl.SSLEngine;
+
+import io.netty.channel.Channel;
+import io.netty.channel.ChannelInitializer;
+import io.netty.channel.ChannelPipeline;
+import io.netty.handler.ssl.SslHandler;
+import io.netty.util.concurrent.EventExecutorGroup;
+
+final class LumberjackChannelInitializer extends ChannelInitializer<Channel> {
+    private final SSLContext sslContext;
+    private final EventExecutorGroup messageExecutorService;
+    private final LumberjackMessageProcessor messageProcessor;
+
+    LumberjackChannelInitializer(SSLContext sslContext, EventExecutorGroup messageExecutorService,
+                                 LumberjackMessageProcessor messageProcessor) {
+        this.sslContext = sslContext;
+        this.messageExecutorService = messageExecutorService;
+        this.messageProcessor = messageProcessor;
+    }
+
+    @Override
+    protected void initChannel(Channel ch) throws Exception {
+        ChannelPipeline pipeline = ch.pipeline();
+
+        // Add SSL support if configured
+        if (sslContext != null) {
+            SSLEngine sslEngine = sslContext.createSSLEngine();
+            sslEngine.setUseClientMode(false);
+            pipeline.addLast(new SslHandler(sslEngine));
+        }
+
+        LumberjackSessionHandler sessionHandler = new LumberjackSessionHandler();
+
+        // Add the primary lumberjack frame decoder
+        pipeline.addLast(new LumberjackFrameDecoder(sessionHandler));
+
+        // Add the secondary lumberjack frame decoder, used when the first one is processing compressed frames
+        pipeline.addLast(new LumberjackFrameDecoder(sessionHandler));
+
+        // Add the bridge to Camel
+        pipeline.addLast(messageExecutorService, new LumberjackMessageHandler(sessionHandler, messageProcessor));
+    }
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/3d0379d0/components/camel-lumberjack/src/main/java/org/apache/camel/component/lumberjack/io/LumberjackConstants.java
----------------------------------------------------------------------
diff --git a/components/camel-lumberjack/src/main/java/org/apache/camel/component/lumberjack/io/LumberjackConstants.java b/components/camel-lumberjack/src/main/java/org/apache/camel/component/lumberjack/io/LumberjackConstants.java
new file mode 100644
index 0000000..37ca5e6
--- /dev/null
+++ b/components/camel-lumberjack/src/main/java/org/apache/camel/component/lumberjack/io/LumberjackConstants.java
@@ -0,0 +1,46 @@
+/**
+ * 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.camel.component.lumberjack.io;
+
+final class LumberjackConstants {
+    static final int VERSION_V1 = '1';
+    static final int VERSION_V2 = '2';
+
+    static final int TYPE_ACKNOWLEDGE = 'A';
+
+    static final int TYPE_WINDOW = 'W';
+    static final int TYPE_COMPRESS = 'C';
+    static final int TYPE_JSON = 'J';
+    static final int TYPE_DATA = 'D';
+
+    static final int INT_LENGTH = 4;
+
+    static final int FRAME_HEADER_LENGTH = 1 + 1; // version(byte) + type(byte)
+
+    static final int FRAME_ACKNOWLEDGE_LENGTH = FRAME_HEADER_LENGTH + INT_LENGTH; // sequence number(int)
+
+    static final int FRAME_JSON_HEADER_LENGTH = INT_LENGTH + INT_LENGTH; // sequence number(int) + payload length(int)
+
+    static final int FRAME_DATA_HEADER_LENGTH = INT_LENGTH + INT_LENGTH; // sequence number(int) + key/value pair count(int)
+
+    static final int FRAME_WINDOW_HEADER_LENGTH = INT_LENGTH; // window size(int)
+
+    static final int FRAME_COMPRESS_HEADER_LENGTH = INT_LENGTH; // compressed payload length(int)
+
+    private LumberjackConstants() {
+    }
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/3d0379d0/components/camel-lumberjack/src/main/java/org/apache/camel/component/lumberjack/io/LumberjackFrameDecoder.java
----------------------------------------------------------------------
diff --git a/components/camel-lumberjack/src/main/java/org/apache/camel/component/lumberjack/io/LumberjackFrameDecoder.java b/components/camel-lumberjack/src/main/java/org/apache/camel/component/lumberjack/io/LumberjackFrameDecoder.java
new file mode 100644
index 0000000..c3fa454
--- /dev/null
+++ b/components/camel-lumberjack/src/main/java/org/apache/camel/component/lumberjack/io/LumberjackFrameDecoder.java
@@ -0,0 +1,217 @@
+/**
+ * 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.camel.component.lumberjack.io;
+
+import java.nio.charset.StandardCharsets;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.zip.Inflater;
+
+import com.google.gson.Gson;
+import io.netty.buffer.ByteBuf;
+import io.netty.channel.ChannelHandlerContext;
+import io.netty.handler.codec.ByteToMessageDecoder;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import static org.apache.camel.component.lumberjack.io.LumberjackConstants.FRAME_COMPRESS_HEADER_LENGTH;
+import static org.apache.camel.component.lumberjack.io.LumberjackConstants.FRAME_DATA_HEADER_LENGTH;
+import static org.apache.camel.component.lumberjack.io.LumberjackConstants.FRAME_HEADER_LENGTH;
+import static org.apache.camel.component.lumberjack.io.LumberjackConstants.FRAME_JSON_HEADER_LENGTH;
+import static org.apache.camel.component.lumberjack.io.LumberjackConstants.FRAME_WINDOW_HEADER_LENGTH;
+import static org.apache.camel.component.lumberjack.io.LumberjackConstants.INT_LENGTH;
+import static org.apache.camel.component.lumberjack.io.LumberjackConstants.TYPE_COMPRESS;
+import static org.apache.camel.component.lumberjack.io.LumberjackConstants.TYPE_DATA;
+import static org.apache.camel.component.lumberjack.io.LumberjackConstants.TYPE_JSON;
+import static org.apache.camel.component.lumberjack.io.LumberjackConstants.TYPE_WINDOW;
+
+/**
+ * Decode lumberjack protocol frames. Support protocol V1 and V2 and frame types D, J, W and C.<br/>
+ * <p>
+ * For more info, see:
+ * <ul>
+ * <li><a href="https://github.com/elastic/beats">https://github.com/elastic/beats</a></li>
+ * <li><a href="https://github.com/logstash-plugins/logstash-input-beats/blob/master/PROTOCOL.md">https://github.com/logstash-plugins/logstash-input-beats/blob/master/PROTOCOL.md</a></li>
+ * <li><a href="https://github.com/elastic/logstash-forwarder/blob/master/PROTOCOL.md">https://github.com/elastic/logstash-forwarder/blob/master/PROTOCOL.md</a></li>
+ * <li><a href="https://github.com/elastic/libbeat/issues/279">https://github.com/elastic/libbeat/issues/279</a></li>
+ * </ul>
+ */
+final class LumberjackFrameDecoder extends ByteToMessageDecoder {
+    private static final Logger LOG = LoggerFactory.getLogger(LumberjackFrameDecoder.class);
+
+    private final LumberjackSessionHandler sessionHandler;
+    private final Gson gson;
+
+    LumberjackFrameDecoder(LumberjackSessionHandler sessionHandler) {
+        this.sessionHandler = sessionHandler;
+        gson = new Gson();
+    }
+
+    @Override
+    protected void decode(ChannelHandlerContext ctx, ByteBuf in, List<Object> out) throws Exception {
+        // mark the reader index to be able to start decoding from the same position if there is not enough data to finish the frame decoding
+        in.markReaderIndex();
+
+        boolean frameDecoded = false;
+
+        try {
+            if (!in.isReadable(FRAME_HEADER_LENGTH)) {
+                return;
+            }
+
+            int frameVersion = in.readUnsignedByte();
+            sessionHandler.versionRead(frameVersion);
+
+            int frameType = in.readUnsignedByte();
+            LOG.debug("Received a lumberjack frame of type {}", (char) frameType);
+
+            switch (frameType) {
+            case TYPE_JSON:
+                frameDecoded = handleJsonFrame(in, out);
+                break;
+            case TYPE_DATA:
+                frameDecoded = handleDataFrame(in, out);
+                break;
+            case TYPE_WINDOW:
+                frameDecoded = handleWindowFrame(in);
+                break;
+            case TYPE_COMPRESS:
+                frameDecoded = handleCompressedFrame(ctx, in, out);
+                break;
+            default:
+                throw new RuntimeException("Unsupported frame type=" + frameType);
+            }
+        } finally {
+            if (!frameDecoded) {
+                LOG.debug("Not enough data to decode a complete frame, retry when more data is available. Reader index was {}", in.readerIndex());
+                in.resetReaderIndex();
+            }
+        }
+    }
+
+    private boolean handleJsonFrame(ByteBuf in, List<Object> out) {
+        if (!in.isReadable(FRAME_JSON_HEADER_LENGTH)) {
+            return false;
+        }
+
+        int sequenceNumber = in.readInt();
+
+        // read message string and then decode it as JSON
+        String jsonStr = readLengthPrefixedString(in);
+        if (jsonStr == null) {
+            return false;
+        }
+
+        Object jsonMessage = gson.fromJson(jsonStr, Object.class);
+
+        // put message in the pipeline
+        out.add(new LumberjackMessage(sequenceNumber, jsonMessage));
+        return true;
+    }
+
+    private boolean handleDataFrame(ByteBuf in, List<Object> out) {
+        if (!in.isReadable(FRAME_DATA_HEADER_LENGTH)) {
+            return false;
+        }
+
+        int sequenceNumber = in.readInt();
+        int entriesCount = in.readInt();
+
+        Map<String, String> dataMessage = new LinkedHashMap<>();
+
+        while (entriesCount-- > 0) {
+            String key = readLengthPrefixedString(in);
+            if (key == null) {
+                return false;
+            }
+
+            String value = readLengthPrefixedString(in);
+            if (value == null) {
+                return false;
+            }
+
+            dataMessage.put(key, value);
+        }
+
+        out.add(new LumberjackMessage(sequenceNumber, dataMessage));
+        return true;
+    }
+
+    private boolean handleWindowFrame(ByteBuf in) {
+        if (!in.isReadable(FRAME_WINDOW_HEADER_LENGTH)) {
+            return false;
+        }
+
+        // update window size
+        sessionHandler.windowSizeRead(in.readInt());
+        return true;
+    }
+
+    private boolean handleCompressedFrame(ChannelHandlerContext ctx, ByteBuf in, List<Object> out) throws Exception {
+        if (!in.isReadable(FRAME_COMPRESS_HEADER_LENGTH)) {
+            return false;
+        }
+
+        int compressedPayloadLength = in.readInt();
+        if (!in.isReadable(compressedPayloadLength)) {
+            return false;
+        }
+
+        // decompress payload
+        Inflater inflater = new Inflater();
+        if (in.hasArray()) {
+            inflater.setInput(in.array(), in.arrayOffset() + in.readerIndex(), compressedPayloadLength);
+            in.skipBytes(compressedPayloadLength);
+        } else {
+            byte[] array = new byte[compressedPayloadLength];
+            in.readBytes(array);
+            inflater.setInput(array);
+        }
+
+        while (!inflater.finished()) {
+            ByteBuf decompressed = ctx.alloc().heapBuffer(1024, 1024);
+            byte[] outArray = decompressed.array();
+            int count = inflater.inflate(outArray, decompressed.arrayOffset(), decompressed.writableBytes());
+            decompressed.writerIndex(count);
+            // put data in the pipeline
+            out.add(decompressed);
+        }
+
+        return true;
+    }
+
+    /**
+     * Read a string that is prefixed by its length encoded by a 4 bytes integer.
+     *
+     * @param in the buffer to consume
+     * @return the read string or {@code null} if not enough data available to read the whole string
+     */
+    private String readLengthPrefixedString(ByteBuf in) {
+        if (!in.isReadable(INT_LENGTH)) {
+            return null;
+        }
+        int length = in.readInt();
+        if (!in.isReadable(length)) {
+            return null;
+        }
+
+        String str = in.toString(in.readerIndex(), length, StandardCharsets.UTF_8);
+        in.skipBytes(length);
+        return str;
+    }
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/3d0379d0/components/camel-lumberjack/src/main/java/org/apache/camel/component/lumberjack/io/LumberjackMessage.java
----------------------------------------------------------------------
diff --git a/components/camel-lumberjack/src/main/java/org/apache/camel/component/lumberjack/io/LumberjackMessage.java b/components/camel-lumberjack/src/main/java/org/apache/camel/component/lumberjack/io/LumberjackMessage.java
new file mode 100644
index 0000000..466179f
--- /dev/null
+++ b/components/camel-lumberjack/src/main/java/org/apache/camel/component/lumberjack/io/LumberjackMessage.java
@@ -0,0 +1,38 @@
+/**
+ * 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.camel.component.lumberjack.io;
+
+/**
+ * A received lumberjack message, that contains it's sequence number and payload.
+ */
+final class LumberjackMessage {
+    private final int sequenceNumber;
+    private final Object payload;
+
+    LumberjackMessage(int sequenceNumber, Object payload) {
+        this.sequenceNumber = sequenceNumber;
+        this.payload = payload;
+    }
+
+    int getSequenceNumber() {
+        return sequenceNumber;
+    }
+
+    Object getPayload() {
+        return payload;
+    }
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/3d0379d0/components/camel-lumberjack/src/main/java/org/apache/camel/component/lumberjack/io/LumberjackMessageHandler.java
----------------------------------------------------------------------
diff --git a/components/camel-lumberjack/src/main/java/org/apache/camel/component/lumberjack/io/LumberjackMessageHandler.java b/components/camel-lumberjack/src/main/java/org/apache/camel/component/lumberjack/io/LumberjackMessageHandler.java
new file mode 100644
index 0000000..f6b50d8
--- /dev/null
+++ b/components/camel-lumberjack/src/main/java/org/apache/camel/component/lumberjack/io/LumberjackMessageHandler.java
@@ -0,0 +1,67 @@
+/**
+ * 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.camel.component.lumberjack.io;
+
+import java.io.IOException;
+
+import io.netty.channel.ChannelHandlerContext;
+import io.netty.channel.SimpleChannelInboundHandler;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * This handler connects the Netty pipeline to the Camel endpoint.
+ */
+final class LumberjackMessageHandler extends SimpleChannelInboundHandler<LumberjackMessage> {
+    private static final Logger LOG = LoggerFactory.getLogger(LumberjackMessageHandler.class);
+
+    private final LumberjackSessionHandler sessionHandler;
+    private final LumberjackMessageProcessor messageProcessor;
+
+    private volatile boolean process = true;
+
+    LumberjackMessageHandler(LumberjackSessionHandler sessionHandler, LumberjackMessageProcessor messageProcessor) {
+        this.sessionHandler = sessionHandler;
+        this.messageProcessor = messageProcessor;
+    }
+
+    @Override
+    public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception {
+        if (cause instanceof IOException) {
+            LOG.debug("IO exception (client connection closed ?)", cause);
+        } else {
+            LOG.warn("Caught an exception while reading, closing channel.", cause);
+        }
+        ctx.close();
+    }
+
+    @Override
+    protected void channelRead0(ChannelHandlerContext ctx, LumberjackMessage msg) throws Exception {
+        if (process) {
+            messageProcessor.onMessageReceived(msg.getPayload(), success -> {
+                if (success) {
+                    sessionHandler.notifyMessageProcessed(ctx, msg.getSequenceNumber());
+                } else {
+                    ctx.close();
+
+                    // Mark that we shouldn't process the next messages that are already decoded and are waiting in netty queues
+                    process = false;
+                }
+            });
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/3d0379d0/components/camel-lumberjack/src/main/java/org/apache/camel/component/lumberjack/io/LumberjackMessageProcessor.java
----------------------------------------------------------------------
diff --git a/components/camel-lumberjack/src/main/java/org/apache/camel/component/lumberjack/io/LumberjackMessageProcessor.java b/components/camel-lumberjack/src/main/java/org/apache/camel/component/lumberjack/io/LumberjackMessageProcessor.java
new file mode 100644
index 0000000..a11e09c
--- /dev/null
+++ b/components/camel-lumberjack/src/main/java/org/apache/camel/component/lumberjack/io/LumberjackMessageProcessor.java
@@ -0,0 +1,44 @@
+/**
+ * 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.camel.component.lumberjack.io;
+
+/**
+ * This functional interface defines a processor that will be called when a lumberjack message is received
+ */
+@FunctionalInterface
+public interface LumberjackMessageProcessor {
+    /**
+     * Called when a message is received. The {@code callback} must be called with the status of the processing
+     *
+     * @param payload Lumberjack message payload
+     * @param callback Callback to call when the processing is complete
+     */
+    void onMessageReceived(Object payload, Callback callback);
+
+    /**
+     * This functional interface defines the callback to call when the processing of a Lumberjack message is complete
+     */
+    @FunctionalInterface
+    interface Callback {
+        /**
+         * Called when the processing is complete.
+         *
+         * @param success {@code true} is the processing is a success, {@code false} otherwise
+         */
+        void onComplete(boolean success);
+    }
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/3d0379d0/components/camel-lumberjack/src/main/java/org/apache/camel/component/lumberjack/io/LumberjackServer.java
----------------------------------------------------------------------
diff --git a/components/camel-lumberjack/src/main/java/org/apache/camel/component/lumberjack/io/LumberjackServer.java b/components/camel-lumberjack/src/main/java/org/apache/camel/component/lumberjack/io/LumberjackServer.java
new file mode 100644
index 0000000..4e7c5db
--- /dev/null
+++ b/components/camel-lumberjack/src/main/java/org/apache/camel/component/lumberjack/io/LumberjackServer.java
@@ -0,0 +1,111 @@
+/**
+ * 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.camel.component.lumberjack.io;
+
+import java.util.concurrent.ThreadFactory;
+import javax.net.ssl.SSLContext;
+
+import io.netty.bootstrap.ServerBootstrap;
+import io.netty.channel.Channel;
+import io.netty.channel.ChannelHandler;
+import io.netty.channel.ChannelOption;
+import io.netty.channel.EventLoopGroup;
+import io.netty.channel.nio.NioEventLoopGroup;
+import io.netty.channel.socket.nio.NioServerSocketChannel;
+import io.netty.util.concurrent.DefaultEventExecutorGroup;
+import io.netty.util.concurrent.EventExecutorGroup;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * This class defines the Lumberjack server that will receive Lumberjack messages
+ */
+public final class LumberjackServer {
+    private static final Logger LOG = LoggerFactory.getLogger(LumberjackServer.class);
+    private static final int WORKER_THREADS = 16;
+
+    private final String host;
+    private final int port;
+    private final SSLContext sslContext;
+    private final ThreadFactory threadFactory;
+    private final LumberjackMessageProcessor messageProcessor;
+
+    private EventExecutorGroup executorService;
+    private EventLoopGroup bossGroup;
+    private EventLoopGroup workerGroup;
+    private Channel channel;
+
+    public LumberjackServer(String host, int port, SSLContext sslContext, ThreadFactory threadFactory,
+                            LumberjackMessageProcessor messageProcessor) {
+        this.host = host;
+        this.port = port;
+        this.sslContext = sslContext;
+        this.threadFactory = threadFactory;
+        this.messageProcessor = messageProcessor;
+    }
+
+    /**
+     * Starts the server.
+     *
+     * @throws InterruptedException when interrupting while connecting the socket
+     */
+    public void start() throws InterruptedException {
+        LOG.info("Starting the LUMBERJACK server (host={}, port={}).", host, port);
+
+        // Create the group that will listen for incoming connections
+        bossGroup = new NioEventLoopGroup(1);
+        // Create the group that will process the connections
+        workerGroup = new NioEventLoopGroup(WORKER_THREADS);
+        // Create the executor service that will process the payloads without blocking netty threads
+        executorService = new DefaultEventExecutorGroup(WORKER_THREADS, threadFactory);
+
+        // Create the channel initializer
+        ChannelHandler initializer = new LumberjackChannelInitializer(sslContext, executorService, messageProcessor);
+
+        // Bootstrap the netty server
+        ServerBootstrap serverBootstrap = new ServerBootstrap()  //
+                .group(bossGroup, workerGroup)               //
+                .channel(NioServerSocketChannel.class)           //
+                .option(ChannelOption.SO_BACKLOG, 100)           //
+                .childHandler(initializer);                      //
+
+        // Connect the socket
+        channel = serverBootstrap.bind(host, port).sync().channel();
+
+        LOG.info("LUMBERJACK server is started (host={}, port={}).", host, port);
+    }
+
+    /**
+     * Stops the server.
+     *
+     * @throws InterruptedException when interrupting while stopping the socket
+     */
+    public void stop() throws InterruptedException {
+        LOG.info("Stopping the LUMBERJACK server (host={}, port={}).", host, port);
+
+        try {
+            // Wait for the channel to be indeed closed before shutting the groups & service
+            channel.close().sync();
+        } finally {
+            bossGroup.shutdownGracefully();
+            workerGroup.shutdownGracefully();
+            executorService.shutdownGracefully();
+        }
+
+        LOG.info("LUMBERJACK server is stopped (host={}, port={}).", host, port);
+    }
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/3d0379d0/components/camel-lumberjack/src/main/java/org/apache/camel/component/lumberjack/io/LumberjackSessionHandler.java
----------------------------------------------------------------------
diff --git a/components/camel-lumberjack/src/main/java/org/apache/camel/component/lumberjack/io/LumberjackSessionHandler.java b/components/camel-lumberjack/src/main/java/org/apache/camel/component/lumberjack/io/LumberjackSessionHandler.java
new file mode 100644
index 0000000..6c16656
--- /dev/null
+++ b/components/camel-lumberjack/src/main/java/org/apache/camel/component/lumberjack/io/LumberjackSessionHandler.java
@@ -0,0 +1,65 @@
+/**
+ * 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.camel.component.lumberjack.io;
+
+import io.netty.buffer.ByteBuf;
+import io.netty.channel.ChannelHandlerContext;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import static org.apache.camel.component.lumberjack.io.LumberjackConstants.FRAME_ACKNOWLEDGE_LENGTH;
+import static org.apache.camel.component.lumberjack.io.LumberjackConstants.TYPE_ACKNOWLEDGE;
+import static org.apache.camel.component.lumberjack.io.LumberjackConstants.VERSION_V1;
+import static org.apache.camel.component.lumberjack.io.LumberjackConstants.VERSION_V2;
+
+/**
+ * Handles lumberjack window and send acknowledge when required.
+ */
+final class LumberjackSessionHandler {
+    private static final Logger LOG = LoggerFactory.getLogger(LumberjackSessionHandler.class);
+
+    private volatile int version = -1;
+    private volatile int windowSize = 1;
+
+    void versionRead(int version) {
+        if (this.version == -1) {
+            if (version != VERSION_V1 && version != VERSION_V2) {
+                throw new RuntimeException("Unsupported frame version=" + version);
+            }
+            LOG.debug("Lumberjack protocol version is {}", (char) version);
+            this.version = version;
+        } else if (this.version != version) {
+            throw new IllegalStateException("Protocol version changed during session from " + this.version + " to " + version);
+        }
+    }
+
+    void windowSizeRead(int windowSize) {
+        LOG.debug("Lumberjack window size is {}", windowSize);
+        this.windowSize = windowSize;
+    }
+
+    void notifyMessageProcessed(ChannelHandlerContext ctx, int sequenceNumber) {
+        if (sequenceNumber == windowSize) {
+            LOG.debug("Sequence number is {}. Sending ACK", sequenceNumber);
+            ByteBuf response = ctx.alloc().heapBuffer(FRAME_ACKNOWLEDGE_LENGTH, FRAME_ACKNOWLEDGE_LENGTH);
+            response.writeByte(version);
+            response.writeByte(TYPE_ACKNOWLEDGE);
+            response.writeInt(sequenceNumber);
+            ctx.writeAndFlush(response);
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/3d0379d0/components/camel-lumberjack/src/main/resources/LICENSE.txt
----------------------------------------------------------------------
diff --git a/components/camel-lumberjack/src/main/resources/LICENSE.txt b/components/camel-lumberjack/src/main/resources/LICENSE.txt
new file mode 100644
index 0000000..6b0b127
--- /dev/null
+++ b/components/camel-lumberjack/src/main/resources/LICENSE.txt
@@ -0,0 +1,203 @@
+
+                                 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.
+

http://git-wip-us.apache.org/repos/asf/camel/blob/3d0379d0/components/camel-lumberjack/src/main/resources/META-INF/services/org/apache/camel/component/lumberjack
----------------------------------------------------------------------
diff --git a/components/camel-lumberjack/src/main/resources/META-INF/services/org/apache/camel/component/lumberjack b/components/camel-lumberjack/src/main/resources/META-INF/services/org/apache/camel/component/lumberjack
new file mode 100644
index 0000000..7011d94
--- /dev/null
+++ b/components/camel-lumberjack/src/main/resources/META-INF/services/org/apache/camel/component/lumberjack
@@ -0,0 +1,17 @@
+# 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.
+#
+
+class=org.apache.camel.component.lumberjack.LumberjackComponent

http://git-wip-us.apache.org/repos/asf/camel/blob/3d0379d0/components/camel-lumberjack/src/main/resources/META-INF/services/org/apache/camel/component/lumberjacks
----------------------------------------------------------------------
diff --git a/components/camel-lumberjack/src/main/resources/META-INF/services/org/apache/camel/component/lumberjacks b/components/camel-lumberjack/src/main/resources/META-INF/services/org/apache/camel/component/lumberjacks
new file mode 100644
index 0000000..e542717
--- /dev/null
+++ b/components/camel-lumberjack/src/main/resources/META-INF/services/org/apache/camel/component/lumberjacks
@@ -0,0 +1,17 @@
+# 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.
+#
+
+class=org.apache.camel.component.lumberjack.LumberjacksComponent

http://git-wip-us.apache.org/repos/asf/camel/blob/3d0379d0/components/camel-lumberjack/src/main/resources/NOTICE.txt
----------------------------------------------------------------------
diff --git a/components/camel-lumberjack/src/main/resources/NOTICE.txt b/components/camel-lumberjack/src/main/resources/NOTICE.txt
new file mode 100644
index 0000000..2e215bf
--- /dev/null
+++ b/components/camel-lumberjack/src/main/resources/NOTICE.txt
@@ -0,0 +1,11 @@
+   =========================================================================
+   ==  NOTICE file corresponding to the section 4 d of                    ==
+   ==  the Apache License, Version 2.0,                                   ==
+   ==  in this case for the Apache Camel distribution.                    ==
+   =========================================================================
+
+   This product includes software developed by
+   The Apache Software Foundation (http://www.apache.org/).
+
+   Please read the different LICENSE files present in the licenses directory of
+   this distribution.

http://git-wip-us.apache.org/repos/asf/camel/blob/3d0379d0/components/camel-lumberjack/src/test/java/org/apache/camel/component/lumberjack/LumberjackComponentTest.java
----------------------------------------------------------------------
diff --git a/components/camel-lumberjack/src/test/java/org/apache/camel/component/lumberjack/LumberjackComponentTest.java b/components/camel-lumberjack/src/test/java/org/apache/camel/component/lumberjack/LumberjackComponentTest.java
new file mode 100644
index 0000000..3a0d0f9
--- /dev/null
+++ b/components/camel-lumberjack/src/test/java/org/apache/camel/component/lumberjack/LumberjackComponentTest.java
@@ -0,0 +1,69 @@
+/**
+ * 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.camel.component.lumberjack;
+
+import java.util.Arrays;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.mock.MockEndpoint;
+import org.apache.camel.test.AvailablePortFinder;
+import org.apache.camel.test.junit4.CamelTestSupport;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+public class LumberjackComponentTest extends CamelTestSupport {
+    private static int port;
+
+    @BeforeClass
+    public static void beforeClass() {
+        port = AvailablePortFinder.getNextAvailable();
+    }
+
+    @Override
+    protected RouteBuilder createRouteBuilder() {
+        return new RouteBuilder() {
+            public void configure() {
+                // Lumberjack configured with a specific port
+                from("lumberjack:0.0.0.0:" + port).to("mock:output");
+            }
+        };
+    }
+
+    @Test
+    public void shouldListenToMessages() throws Exception {
+        // We're expecting 25 messages with Maps
+        MockEndpoint mock = getMockEndpoint("mock:output");
+        mock.expectedMessageCount(25);
+        mock.allMessages().body().isInstanceOf(Map.class);
+
+        // When sending messages
+        List<Integer> responses = LumberjackUtil.sendMessages(port, null);
+
+        // Then we should have the messages we're expecting
+        mock.assertIsSatisfied();
+
+        // And the first map should contains valid data (we're assuming it's also valid for the other ones)
+        Map first = mock.getExchanges().get(0).getIn().getBody(Map.class);
+        assertEquals("log", first.get("input_type"));
+        assertEquals("/home/qatest/collectNetwork/log/data-integration/00000000-f000-0000-1541-8da26f200001/absorption.log", first.get("source"));
+
+        // And we should have replied with 2 acknowledgments for each window frame
+        assertEquals(responses, Arrays.asList(10, 15));
+    }
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/3d0379d0/components/camel-lumberjack/src/test/java/org/apache/camel/component/lumberjack/LumberjackDisconnectionTest.java
----------------------------------------------------------------------
diff --git a/components/camel-lumberjack/src/test/java/org/apache/camel/component/lumberjack/LumberjackDisconnectionTest.java b/components/camel-lumberjack/src/test/java/org/apache/camel/component/lumberjack/LumberjackDisconnectionTest.java
new file mode 100644
index 0000000..3a34603
--- /dev/null
+++ b/components/camel-lumberjack/src/test/java/org/apache/camel/component/lumberjack/LumberjackDisconnectionTest.java
@@ -0,0 +1,82 @@
+/**
+ * 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.camel.component.lumberjack;
+
+import java.util.List;
+import java.util.Map;
+
+import org.apache.camel.Exchange;
+import org.apache.camel.Processor;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.mock.MockEndpoint;
+import org.apache.camel.test.AvailablePortFinder;
+import org.apache.camel.test.junit4.CamelTestSupport;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+@SuppressWarnings("unchecked")
+public class LumberjackDisconnectionTest extends CamelTestSupport {
+    private static int port;
+
+    @BeforeClass
+    public static void beforeClass() {
+        port = AvailablePortFinder.getNextAvailable();
+    }
+
+    @Override
+    protected RouteBuilder createRouteBuilder() {
+        return new RouteBuilder() {
+            public void configure() {
+                // Lumberjack configured with something that throws an exception
+                from("lumberjack:0.0.0.0:" + port).process(new ErrorProcessor()).to("mock:output");
+            }
+        };
+    }
+
+    @Test
+    public void shouldDisconnectUponError() throws Exception {
+        // We're expecting 3 messages with Maps
+        // The fourth one crashed and we didn't received the next ones
+        MockEndpoint mock = getMockEndpoint("mock:output");
+        mock.expectedMessageCount(3);
+        mock.allMessages().body().isInstanceOf(Map.class);
+
+        // When sending messages
+        List<Integer> responses = LumberjackUtil.sendMessages(port, null);
+
+        // Then we should have the messages we're expecting
+        mock.assertIsSatisfied();
+
+        // And no acknowledgment is received
+        assertCollectionSize(responses, 0);
+    }
+
+    /**
+     * This processor throws an exception as the fourth message received.
+     */
+    private static final class ErrorProcessor implements Processor {
+        int count;
+
+        @Override
+        public void process(Exchange exchange) throws Exception {
+            count++;
+            if (count == 4) {
+                throw new RuntimeException("Ooops");
+            }
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/3d0379d0/components/camel-lumberjack/src/test/java/org/apache/camel/component/lumberjack/LumberjackUtil.java
----------------------------------------------------------------------
diff --git a/components/camel-lumberjack/src/test/java/org/apache/camel/component/lumberjack/LumberjackUtil.java b/components/camel-lumberjack/src/test/java/org/apache/camel/component/lumberjack/LumberjackUtil.java
new file mode 100644
index 0000000..2dcfbbb
--- /dev/null
+++ b/components/camel-lumberjack/src/test/java/org/apache/camel/component/lumberjack/LumberjackUtil.java
@@ -0,0 +1,112 @@
+/**
+ * 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.camel.component.lumberjack;
+
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.concurrent.TimeUnit;
+import javax.net.ssl.SSLEngine;
+
+import io.netty.bootstrap.Bootstrap;
+import io.netty.buffer.ByteBuf;
+import io.netty.channel.Channel;
+import io.netty.channel.ChannelHandlerContext;
+import io.netty.channel.ChannelInitializer;
+import io.netty.channel.ChannelPipeline;
+import io.netty.channel.SimpleChannelInboundHandler;
+import io.netty.channel.nio.NioEventLoopGroup;
+import io.netty.channel.socket.nio.NioSocketChannel;
+import io.netty.handler.ssl.SslHandler;
+import org.apache.camel.util.jsse.SSLContextParameters;
+
+import static io.netty.buffer.Unpooled.wrappedBuffer;
+import static org.junit.Assert.assertEquals;
+
+final class LumberjackUtil {
+    private LumberjackUtil() {
+    }
+
+    static List<Integer> sendMessages(int port, SSLContextParameters sslContextParameters) throws InterruptedException {
+        NioEventLoopGroup eventLoopGroup = new NioEventLoopGroup();
+        try {
+            // This list will hold the acknowledgment response sequence numbers
+            List<Integer> responses = new ArrayList<>();
+
+            // This initializer configures the SSL and an acknowledgment recorder
+            ChannelInitializer<Channel> initializer = new ChannelInitializer<Channel>() {
+                @Override
+                protected void initChannel(Channel ch) throws Exception {
+                    ChannelPipeline pipeline = ch.pipeline();
+                    if (sslContextParameters != null) {
+                        SSLEngine sslEngine = sslContextParameters.createSSLContext(null).createSSLEngine();
+                        sslEngine.setUseClientMode(true);
+                        pipeline.addLast(new SslHandler(sslEngine));
+                    }
+
+                    // Add the response recorder
+                    pipeline.addLast(new SimpleChannelInboundHandler<ByteBuf>() {
+                        @Override
+                        protected void channelRead0(ChannelHandlerContext ctx, ByteBuf msg) throws Exception {
+                            assertEquals(msg.readUnsignedByte(), (short) '2');
+                            assertEquals(msg.readUnsignedByte(), (short) 'A');
+                            synchronized (responses) {
+                                responses.add(msg.readInt());
+                            }
+                        }
+                    });
+                }
+            };
+
+            // Connect to the server
+            Channel channel = new Bootstrap()                     //
+                    .group(eventLoopGroup)                        //
+                    .channel(NioSocketChannel.class)              //
+                    .handler(initializer)                         //
+                    .connect("127.0.0.1", port).sync().channel(); //
+
+            // Send the 2 window frames
+            channel.writeAndFlush(readSample("io/window10"));
+            TimeUnit.MILLISECONDS.sleep(100);
+            channel.writeAndFlush(readSample("io/window15"));
+            TimeUnit.MILLISECONDS.sleep(100);
+
+            channel.close();
+
+            synchronized (responses) {
+                return responses;
+            }
+        } finally {
+            eventLoopGroup.shutdownGracefully();
+        }
+    }
+
+    private static ByteBuf readSample(String resource) {
+        try (InputStream stream = LumberjackUtil.class.getResourceAsStream(resource)) {
+            ByteArrayOutputStream output = new ByteArrayOutputStream();
+            int input;
+            while ((input = stream.read()) != -1) {
+                output.write(input);
+            }
+            return wrappedBuffer(output.toByteArray());
+        } catch (IOException e) {
+            throw new RuntimeException("Cannot read sample data", e);
+        }
+    }
+}