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/01/20 13:39:21 UTC

[camel-kafka-connector-examples] branch master updated: Docker sink pull example: Added some possible approaches

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

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


The following commit(s) were added to refs/heads/master by this push:
     new 641a54c  Docker sink pull example: Added some possible approaches
641a54c is described below

commit 641a54c29e25b08caac62a0757e6d7bdd2f03a8c
Author: Andrea Cosentino <an...@gmail.com>
AuthorDate: Wed Jan 20 14:38:04 2021 +0100

    Docker sink pull example: Added some possible approaches
---
 docker/docker-sink-pull/README.adoc | 41 +++++++++++++++++++++++++++++++++++--
 1 file changed, 39 insertions(+), 2 deletions(-)

diff --git a/docker/docker-sink-pull/README.adoc b/docker/docker-sink-pull/README.adoc
index 35e916b..14e9319 100644
--- a/docker/docker-sink-pull/README.adoc
+++ b/docker/docker-sink-pull/README.adoc
@@ -78,6 +78,8 @@ Run the kafka connect with the Docker Source connector:
 $KAFKA_HOME/bin/connect-standalone.sh $KAFKA_HOME/config/connect-standalone.properties $EXAMPLES/docker/docker-sink-pull/config/CamelDockerSinkConnector.properties
 ----
 
+We just need to trigger the operation through a message
+
 On a different terminal run the kafkacat producer
 
 [source]
@@ -86,8 +88,6 @@ On a different terminal run the kafkacat producer
 % Auto-selecting Producer mode (use -P or -C to override)
 ----
 
-We just need to trigger the operation through a message
-
 After a while we should get a new memcached image in our Docker
 
 [source]
@@ -96,3 +96,40 @@ After a while we should get a new memcached image in our Docker
 REPOSITORY                                                               TAG                 IMAGE ID            CREATED             SIZE
 memcached                                                                latest              9f547b64a127        7 days ago          82.4MB
 ----
+
+You can use a different approach and define everything through headers. In this case the correct configuration for the connector would be
+
+[source]
+----
+name=CamelDockerSinkConnector
+connector.class=org.apache.camel.kafkaconnector.docker.CamelDockerSinkConnector
+tasks.max=1
+
+key.converter=org.apache.kafka.connect.storage.StringConverter
+value.converter=org.apache.kafka.connect.storage.StringConverter
+
+topics=mytopic
+
+camel.component.docker.host=/var/run/docker.sock
+camel.component.docker.socket=true
+camel.sink.path.operation=imagepull
+camel.sink.endpoint.username=<username>
+camel.sink.endpoint.password=<password>
+----
+
+And then send the following message
+
+[source]
+----
+> echo "test" | ./kafkacat -b localhost:9092 -t pereppe -H "CamelHeader.CamelDockerRepository=openjdk" -H "CamelHeader.CamelDockerTag=15.0.2-jdk"
+% Auto-selecting Producer mode (use -P or -C to override)
+----
+
+After a while you should see
+
+[source]
+----
+> docker images
+REPOSITORY                                                               TAG                 IMAGE ID            CREATED             SIZE
+openjdk                                                                  15.0.2-jdk          84a383f5b038        13 hours ago        486MB
+----