You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ac...@apache.org on 2020/09/15 10:02:41 UTC

[camel-kafka-connector-examples] 01/01: Added a MinioSink example

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

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

commit 87c552ef60a0b097313ec72974c8b52c0189a976
Author: Andrea Cosentino <an...@gmail.com>
AuthorDate: Tue Sep 15 12:02:16 2020 +0200

    Added a MinioSink example
---
 minio/minio-sink/README.adoc                       | 79 ++++++++++++++++++++++
 .../config/CamelMinioSinkConnector.properties      | 31 +++++++++
 2 files changed, 110 insertions(+)

diff --git a/minio/minio-sink/README.adoc b/minio/minio-sink/README.adoc
new file mode 100644
index 0000000..1fd83d9
--- /dev/null
+++ b/minio/minio-sink/README.adoc
@@ -0,0 +1,79 @@
+# Camel-Kafka-connector AWS2 MinIO Sink
+
+## Introduction
+
+This is an example for Camel-Kafka-connector MinIO
+
+## What is needed
+
+- A MinIO instance running
+
+## 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-minio-kafka-connector/0.5.0/camel-minio-kafka-connector-0.5.0-package.zip
+> unzip camel-minio-kafka-connector-0.5.0-package.zip
+```
+
+Now we need to setup a MinIO instance
+
+```
+> wget https://dl.min.io/server/minio/release/linux-amd64/minio
+> chmod +x minio
+> export MINIO_ACCESS_KEY=minio
+> export MINIO_SECRET_KEY=miniostorage
+> mkdir data
+> ./minio server data/
+```
+
+Now it's time to setup the connectors
+
+Open the Minio configuration File
+
+```
+name=CamelMinioSinkConnector
+connector.class=org.apache.camel.kafkaconnector.minio.CamelMinioSinkConnector
+key.converter=org.apache.kafka.connect.storage.StringConverter
+value.converter=org.apache.kafka.connect.storage.StringConverter
+
+topics=mytopic
+
+camel.sink.path.bucketName=bucket
+camel.sink.endpoint.endpoint=http://localhost:9000
+camel.sink.endpoint.keyName=${date:now:yyyyMMdd-HHmmssSSS}-${exchangeId}
+camel.component.minio.access-key=minio
+camel.component.minio.secret-key=miniostorage
+```
+
+Now you can run the example
+
+```
+$KAFKA_HOME/bin/connect-standalone.sh $KAFKA_HOME/config/connect-standalone.properties config/CamelMinioSinkConnector.properties
+```
+
+Just connect to your MinIO console and look into your bucket.
+
+On a different terminal run the kafka-producer and you should see messages from the Kafka Broker arriving into bucket.
+
+```
+bin/kafka-console-producer.sh --topic mytopic --broker-list localhost:9092
+>From Kafka to Minio
+```
+
diff --git a/minio/minio-sink/config/CamelMinioSinkConnector.properties b/minio/minio-sink/config/CamelMinioSinkConnector.properties
new file mode 100644
index 0000000..e57d7f2
--- /dev/null
+++ b/minio/minio-sink/config/CamelMinioSinkConnector.properties
@@ -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.
+#
+
+name=CamelMinioSourceConnector
+connector.class=org.apache.camel.kafkaconnector.minio.CamelMinioSourceConnector
+key.converter=org.apache.kafka.connect.storage.StringConverter
+value.converter=org.apache.kafka.connect.storage.StringConverter
+
+camel.source.maxPollDuration=10000
+
+topics=mytopic
+
+camel.source.path.bucketName=bucket
+camel.source.endpoint.endpoint=http://localhost:9000
+camel.component.minio.access-key=minio
+camel.component.minio.secret-key=miniostorage
+