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 2021/02/04 17:29:09 UTC

[camel-kafka-connector-examples] branch quartz-connector-sample created (now 37f19a5)

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

acosentino pushed a change to branch quartz-connector-sample
in repository https://gitbox.apache.org/repos/asf/camel-kafka-connector-examples.git.


      at 37f19a5  Added Quartz Source connector example

This branch includes the following new commits:

     new 37f19a5  Added Quartz Source connector example

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



[camel-kafka-connector-examples] 01/01: Added Quartz Source connector example

Posted by ac...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 37f19a542b1b666dbf27b8b87f42a1f07f430c2f
Author: Andrea Cosentino <an...@gmail.com>
AuthorDate: Thu Feb 4 18:28:43 2021 +0100

    Added Quartz Source connector example
---
 quartz/quartz-source/README.adoc                   | 94 ++++++++++++++++++++++
 .../config/CamelQuartzSourceConnector.properties   | 29 +++++++
 2 files changed, 123 insertions(+)

diff --git a/quartz/quartz-source/README.adoc b/quartz/quartz-source/README.adoc
new file mode 100644
index 0000000..90ba087
--- /dev/null
+++ b/quartz/quartz-source/README.adoc
@@ -0,0 +1,94 @@
+= Camel-Kafka-connector Quartz Source 
+
+This is an example for Camel-Kafka-connector Quartz Source
+
+== Standalone
+
+=== Running Kafka
+
+[source]
+----
+$KAFKA_HOME/bin/zookeeper-server-start.sh $KAFKA_HOME/config/zookeeper.properties
+$KAFKA_HOME/bin/kafka-server-start.sh $KAFKA_HOME/config/server.properties
+$KAFKA_HOME/bin/kafka-topics.sh --create --bootstrap-server localhost:9092 --replication-factor 1 --partitions 1 --topic mytopic
+----
+
+=== Download the connector package
+
+Download the connector package zip and extract the content to a directory. In this example we'll use `/home/oscerd/connectors/`
+
+[source]
+----
+> cd /home/oscerd/connectors/
+> wget https://repo1.maven.org/maven2/org/apache/camel/kafkaconnector/camel-quartz-kafka-connector/0.7.1/camel-quartz-kafka-connector-0.7.1-package.zip
+> unzip camel-quartz-kafka-connector-0.7.1-package.zip
+----
+
+In 0.7.1, you'll need to add also camel-quartz and quartz dependency.
+
+[source]
+----
+> cd /home/oscerd/connectors/camel-quartz-kafka-connector
+----
+
+We are now ready
+
+=== Configuring Kafka Connect
+
+You'll need to set up 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:
+
+[source]
+----
+...
+plugin.path=/home/oscerd/connectors
+...
+----
+
+=== Setup the connectors
+
+Open the Cron configuration file at `$EXAMPLES/quartz/quartz-source/config/CamelQuartzSourceConnector.properties`
+
+[source]
+----
+name=CamelQuartzSourceConnector
+connector.class=org.apache.camel.kafkaconnector.quartz.CamelQuartzSourceConnector
+tasks.max=1
+
+key.converter=org.apache.kafka.connect.storage.StringConverter
+value.converter=org.apache.kafka.connect.storage.StringConverter
+
+topics=mytopic
+
+camel.source.path.groupName=Camel
+camel.source.path.triggerName=quartz-sample
+camel.source.endpoint.cron=0/5+*+*+*+*+?
+----
+
+In this case we are using local unix socket.
+
+For the containerId you'll need to use the value of the running debian container.
+
+=== Running the example
+
+Run the kafka connect with the Quartz Source connector:
+
+[source]
+----
+$KAFKA_HOME/bin/connect-standalone.sh $KAFKA_HOME/config/connect-standalone.properties $EXAMPLES/quartz/quartz-source/config/CamelQuartzSourceConnector.properties
+----
+
+We'll get multiple message with statistics
+
+On a different terminal run the kafkacat consumer
+
+[source]
+----
+./kafkacat -b localhost:9092 -t mytopic -f 'Headers: %h: Message value: %s\n'
+% Auto-selecting Consumer mode (use -P or -C to override)
+% Reached end of topic quartz-topic1 [0] at offset 0
+Headers: CamelHeader.fireTime=2021-02-04T18:25:35.550Z,CamelHeader.jobRunTime=11,CamelHeader.nextFireTime=2021-02-04T18:25:40.000Z,CamelHeader.refireCount=0,CamelHeader.scheduledFireTime=2021-02-04T18:25:35.000Z,CamelHeader.triggerGroup=Camel,CamelHeader.triggerName=quartz-sample,CamelProperty.CamelToEndpoint=direct://end?pollingConsumerBlockTimeout=0&pollingConsumerBlockWhenFull=true&pollingConsumerQueueSize=1000: Message value: 
+% Reached end of topic mytopic [0] at offset 1
+
+----
diff --git a/quartz/quartz-source/config/CamelQuartzSourceConnector.properties b/quartz/quartz-source/config/CamelQuartzSourceConnector.properties
new file mode 100644
index 0000000..b3066d1
--- /dev/null
+++ b/quartz/quartz-source/config/CamelQuartzSourceConnector.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=CamelQuartzSourceConnector
+connector.class=org.apache.camel.kafkaconnector.quartz.CamelQuartzSourceConnector
+tasks.max=1
+
+key.converter=org.apache.kafka.connect.storage.StringConverter
+value.converter=org.apache.kafka.connect.storage.StringConverter
+
+topics=mytopic
+
+camel.source.path.groupName=Camel
+camel.source.path.triggerName=quartz-sample
+camel.source.endpoint.cron=0/5+*+*+*+*+?