This is an automated email from the ASF dual-hosted git repository.

acosentino pushed a commit to branch file-source
in repository 
https://gitbox.apache.org/repos/asf/camel-kafka-connector-examples.git

commit 9216b06eb32f92beca49b8d96019bc4e52b2a7b2
Author: Andrea Cosentino <anco...@gmail.com>
AuthorDate: Tue May 19 16:55:51 2020 +0200

    Added a file source example
---
 file/file-source/README.md                         | 68 ++++++++++++++++++++++
 .../config/CamelFileSourceConnector.properties     | 29 +++++++++
 2 files changed, 97 insertions(+)

diff --git a/file/file-source/README.md b/file/file-source/README.md
new file mode 100644
index 0000000..13efba2
--- /dev/null
+++ b/file/file-source/README.md
@@ -0,0 +1,68 @@
+# Camel-Kafka-connector File Source
+
+## Introduction
+
+This is an example for Camel-Kafka-connector File source
+
+## What is needed
+
+- A File System
+
+## Running Kafka
+
+```
+$KAFKA_HOME/bin/zookeeper-server-start.sh config/zookeeper.properties
+$KAFKA_HOME/bin/kafka-server-start.sh config/server.properties
+$KAFKA_HOME/bin/kafka-topics.sh --create --bootstrap-server localhost:9092 
--replication-factor 1 --partitions 1 --topic mytopic
+```
+
+## Setting up the needed bits and running the example
+
+You'll need to setup the plugin.path property in your kafka
+
+Open the `$KAFKA_HOME/config/connect-standalone.properties`
+
+and set the `plugin.path` property to your choosen location
+
+In this example we'll use `/home/oscerd/connectors/`
+
+```
+> cd /home/oscerd/connectors/
+> wget 
https://repo1.maven.org/maven2/org/apache/camel/kafkaconnector/camel-file-kafka-connector/0.1.0/camel-file-kafka-connector-0.1.0-package.zip
+> unzip camel-file-kafka-connector-0.1.0-package.zip
+```
+
+Now it's time to setup the connectors
+
+Open the File connector configuration file
+
+```
+name=CamelFileSourceConnector
+connector.class=org.apache.camel.kafkaconnector.file.CamelFileSourceConnector
+key.converter=org.apache.kafka.connect.storage.StringConverter
+value.converter=org.apache.kafka.connect.storage.StringConverter
+
+camel.source.maxPollDuration=10000
+
+camel.source.kafka.topic=mytopic
+
+camel.source.path.directoryName=/tmp/kafkastuff/
+camel.source.endpoint.idempotent=true
+```
+
+Now you can run the example
+
+```
+$KAFKA_HOME/bin/connect-standalone.sh 
$KAFKA_HOME/config/connect-standalone.properties 
config/CamelFileSourceConnector.properties
+```
+
+Create files into the /tmp/kafkastuff folder
+
+On a different terminal run the kafka-consumer and you should see messages 
from the SQS queue arriving through Kafka Broker.
+
+```
+bin/kafka-console-consumer.sh --bootstrap-server localhost:9092 --topic 
mytopic --from-beginning
+GenericFile[/tmp/kafkastuff/temp.txt]
+GenericFile[/tmp/kafkastuff/tttt.txt]
+```
+
diff --git a/file/file-source/config/CamelFileSourceConnector.properties 
b/file/file-source/config/CamelFileSourceConnector.properties
new file mode 100644
index 0000000..7d59544
--- /dev/null
+++ b/file/file-source/config/CamelFileSourceConnector.properties
@@ -0,0 +1,29 @@
+#
+# 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.
+#
+
+name=CamelFileSourceConnector
+connector.class=org.apache.camel.kafkaconnector.file.CamelFileSourceConnector
+key.converter=org.apache.kafka.connect.storage.StringConverter
+value.converter=org.apache.kafka.connect.storage.StringConverter
+
+camel.source.maxPollDuration=10000
+
+camel.source.kafka.topic=mytopic
+
+camel.source.path.directoryName=/tmp/kafkastuff/
+camel.source.endpoint.idempotent=true
+

Reply via email to