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 2023/05/22 12:09:45 UTC

[camel-kamelets-examples] branch main updated (38fd845 -> 9eb72cf)

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

acosentino pushed a change to branch main
in repository https://gitbox.apache.org/repos/asf/camel-kamelets-examples.git


    from 38fd845  XML and Java bean example
     new 202296e  Add example for securely connecting to Kafka - Terraform part
     new 958522a  Add example for securely connecting to Kafka - README
     new 94a48c2  Add example for securely connecting to Kafka - External properties file
     new 9eb72cf  Add example for securely connecting to Kafka - Routes

The 4 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.


Summary of changes:
 jbang/azure-eventhubs-kafka-ibm-mq/README.adoc     | 142 +++++++++++++++++++++
 .../azure-eventhubs-kafka-ibm-mq/azure.properties  |   4 +
 .../kafka-mq.yaml                                  |   8 +-
 .../mq-log.yaml                                    |   0
 .../azure-eventhubs-kafka-ibm-mq/terraform/main.tf |  67 ++++++++++
 .../timer-kafka.yaml}                              |  18 +--
 jbang/kafka-mq/kafka-mq.yaml                       |   1 -
 7 files changed, 227 insertions(+), 13 deletions(-)
 create mode 100644 jbang/azure-eventhubs-kafka-ibm-mq/README.adoc
 create mode 100644 jbang/azure-eventhubs-kafka-ibm-mq/azure.properties
 copy jbang/{kafka-mq => azure-eventhubs-kafka-ibm-mq}/kafka-mq.yaml (87%)
 copy jbang/{kafka-mq => azure-eventhubs-kafka-ibm-mq}/mq-log.yaml (100%)
 create mode 100644 jbang/azure-eventhubs-kafka-ibm-mq/terraform/main.tf
 copy jbang/{aws-s3-cdc/aws-s3-cdc-log.yaml => azure-eventhubs-kafka-ibm-mq/timer-kafka.yaml} (76%)


[camel-kamelets-examples] 02/04: Add example for securely connecting to Kafka - README

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

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

commit 958522af364b9e17f2921fdd53be260f32ab9d58
Author: Andrea Cosentino <an...@gmail.com>
AuthorDate: Mon May 22 14:07:36 2023 +0200

    Add example for securely connecting to Kafka - README
    
    Signed-off-by: Andrea Cosentino <an...@gmail.com>
---
 jbang/azure-eventhubs-kafka-ibm-mq/README.adoc | 142 +++++++++++++++++++++++++
 1 file changed, 142 insertions(+)

diff --git a/jbang/azure-eventhubs-kafka-ibm-mq/README.adoc b/jbang/azure-eventhubs-kafka-ibm-mq/README.adoc
new file mode 100644
index 0000000..b57923b
--- /dev/null
+++ b/jbang/azure-eventhubs-kafka-ibm-mq/README.adoc
@@ -0,0 +1,142 @@
+== Azure Event Hubs Kafka Enabled to IBM MQ
+
+In this sample you'll use the Kafka Source to IBM MQ with Kafka enabled feature
+
+=== Install JBang
+
+First install JBang according to https://www.jbang.dev
+
+When JBang is installed then you should be able to run from a shell:
+
+[source,sh]
+----
+$ jbang --version
+----
+
+This will output the version of JBang.
+
+To run this example you can either install Camel on JBang via:
+
+[source,sh]
+----
+$ jbang app install camel@apache/camel
+----
+
+Which allows to run CamelJBang with `camel` as shown below.
+
+=== Setup the Azure Event hubs with Kafka enabled
+
+Running the terraform configuration provided in terraform folder.
+
+[source,sh]
+----
+cd terraform/
+----
+
+and then run
+
+[source,sh]
+----
+terraform init
+----
+
+At this point you should be to run the configuration
+
+[source,sh]
+----
+terraform apply
+----
+
+Enter yes and wait for the terraform configuration to end.
+
+Once the configuration end you'll need to obtain the connection string for accessing the Azure Event Hubs
+
+[source,sh]
+----
+az eventhubs eventhub authorization-rule keys list --resource-group example-resources --namespace-name test12345678910 --eventhub-name camel-test --name navi
+----
+
+Open the file `azure.properties` and copy the primary connection string in both `camel.kamelet.kafka-sink.password` and `camel.kamelet.kafka-source.password`.
+
+=== Set up IBM MQ
+
+We could do this through running the following docker container:
+
+```bash
+docker volume create qm1data
+```
+
+and then run
+
+```bash
+docker run --env LICENSE=accept --env MQ_QMGR_NAME=QM1 --volume qm1data:/mnt/mqm --publish 1414:1414 --publish 9443:9443 --detach --env MQ_APP_PASSWORD=passw0rd --name QM1 icr.io/ibm-messaging/mq:latest
+```
+
+To check everything is fine:
+
+```bash
+docker exec -ti QM1 bash
+dspmq
+```
+
+This should give a RUNNING state.
+
+=== How to run
+
+=== Kafka to MQ
+
+Then you can run this example using:
+
+[source,sh]
+----
+$ camel run --properties=azure.properties --local-kamelet-dir=<your-local-kamelets-path> kafka-mq.yaml
+----
+
+Or run with JBang using the longer command line (without installing camel as app in JBang):
+
+[source,sh]
+----
+$ jbang camel@apache/camel run --properties=azure.properties --local-kamelet-dir=<your-local-kamelets-path> kafka-mq.yaml
+----
+
+=== MQ to log
+
+Then you can run this example using:
+
+[source,sh]
+----
+$ camel run mq-log.yaml
+----
+
+Or run with JBang using the longer command line (without installing camel as app in JBang):
+
+[source,sh]
+----
+$ jbang camel@apache/camel run mq-log.yaml
+----
+
+=== Send data to Kafka on Eventhubs
+
+You can run the timer to kafka route.
+
+[source,sh]
+----
+$ camel run --properties=azure.properties --local-kamelet-dir=<your-local-kamelets-path> timer-kafka.yaml
+----
+
+Or run with JBang using the longer command line (without installing camel as app in JBang):
+
+[source,sh]
+----
+$ jbang camel@apache/camel run --properties=azure.properties --local-kamelet-dir=<your-local-kamelets-path> timer-kafka.yaml
+----
+
+=== Help and contributions
+
+If you hit any problem using Camel or have some feedback, then please
+https://camel.apache.org/community/support/[let us know].
+
+We also love contributors, so
+https://camel.apache.org/community/contributing/[get involved] :-)
+
+The Camel riders!


[camel-kamelets-examples] 01/04: Add example for securely connecting to Kafka - Terraform part

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

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

commit 202296e672c8d919c675bad1b2c54b3c8354bee5
Author: Andrea Cosentino <an...@gmail.com>
AuthorDate: Mon May 22 13:20:43 2023 +0200

    Add example for securely connecting to Kafka - Terraform part
    
    Signed-off-by: Andrea Cosentino <an...@gmail.com>
---
 .../azure-eventhubs-kafka-ibm-mq/terraform/main.tf | 67 ++++++++++++++++++++++
 jbang/kafka-mq/kafka-mq.yaml                       |  1 -
 2 files changed, 67 insertions(+), 1 deletion(-)

diff --git a/jbang/azure-eventhubs-kafka-ibm-mq/terraform/main.tf b/jbang/azure-eventhubs-kafka-ibm-mq/terraform/main.tf
new file mode 100644
index 0000000..f26d802
--- /dev/null
+++ b/jbang/azure-eventhubs-kafka-ibm-mq/terraform/main.tf
@@ -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.
+ */
+
+# We strongly recommend using the required_providers block to set the
+# Azure Provider source and version being used
+terraform {
+  required_providers {
+    azurerm = {
+      source  = "hashicorp/azurerm"
+      version = "=3.0.0"
+    }
+  }
+}
+
+# Configure the Microsoft Azure Provider
+provider "azurerm" {
+  features {}
+}
+
+resource "azurerm_resource_group" "example" {
+  name     = "example-resources"
+  location = "West Europe"
+}
+
+resource "azurerm_eventhub_namespace" "example" {
+  name                = "test12345678910"
+  location            = azurerm_resource_group.example.location
+  resource_group_name = azurerm_resource_group.example.name
+  sku                 = "Standard"
+  capacity            = 1
+
+  tags = {
+    environment = "Development"
+  }
+}
+
+resource "azurerm_eventhub" "example" {
+  name                = "camel-test"
+  namespace_name      = azurerm_eventhub_namespace.example.name
+  resource_group_name = azurerm_resource_group.example.name
+  partition_count     = 2
+  message_retention   = 1
+}
+
+resource "azurerm_eventhub_authorization_rule" "example" {
+  name                = "navi"
+  namespace_name      = azurerm_eventhub_namespace.example.name
+  eventhub_name       = azurerm_eventhub.example.name
+  resource_group_name = azurerm_resource_group.example.name
+  listen              = true
+  send                = true
+  manage              = true
+}
diff --git a/jbang/kafka-mq/kafka-mq.yaml b/jbang/kafka-mq/kafka-mq.yaml
index bff0eea..1298e70 100644
--- a/jbang/kafka-mq/kafka-mq.yaml
+++ b/jbang/kafka-mq/kafka-mq.yaml
@@ -36,4 +36,3 @@
             serverName: 172.17.0.2
             serverPort: 1414
             username: app
-


[camel-kamelets-examples] 03/04: Add example for securely connecting to Kafka - External properties file

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

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

commit 94a48c2fdfb38a2a0e18c7b3484bc7f44c8be5c0
Author: Andrea Cosentino <an...@gmail.com>
AuthorDate: Mon May 22 14:08:05 2023 +0200

    Add example for securely connecting to Kafka - External properties file
    
    Signed-off-by: Andrea Cosentino <an...@gmail.com>
---
 jbang/azure-eventhubs-kafka-ibm-mq/azure.properties | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/jbang/azure-eventhubs-kafka-ibm-mq/azure.properties b/jbang/azure-eventhubs-kafka-ibm-mq/azure.properties
new file mode 100644
index 0000000..e3e4426
--- /dev/null
+++ b/jbang/azure-eventhubs-kafka-ibm-mq/azure.properties
@@ -0,0 +1,4 @@
+camel.kamelet.kafka-source.user=$ConnectionString
+camel.kamelet.kafka-source.password=<password>
+camel.kamelet.kafka-sink.user=$ConnectionString
+camel.kamelet.kafka-sink.password=<password>


[camel-kamelets-examples] 04/04: Add example for securely connecting to Kafka - Routes

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

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

commit 9eb72cf08b8f1c948332733966d53d2eedef35c6
Author: Andrea Cosentino <an...@gmail.com>
AuthorDate: Mon May 22 14:08:48 2023 +0200

    Add example for securely connecting to Kafka - Routes
    
    Signed-off-by: Andrea Cosentino <an...@gmail.com>
---
 jbang/azure-eventhubs-kafka-ibm-mq/kafka-mq.yaml   | 39 ++++++++++++++++++++++
 jbang/azure-eventhubs-kafka-ibm-mq/mq-log.yaml     | 37 ++++++++++++++++++++
 .../azure-eventhubs-kafka-ibm-mq/timer-kafka.yaml  | 33 ++++++++++++++++++
 3 files changed, 109 insertions(+)

diff --git a/jbang/azure-eventhubs-kafka-ibm-mq/kafka-mq.yaml b/jbang/azure-eventhubs-kafka-ibm-mq/kafka-mq.yaml
new file mode 100644
index 0000000..ed950e0
--- /dev/null
+++ b/jbang/azure-eventhubs-kafka-ibm-mq/kafka-mq.yaml
@@ -0,0 +1,39 @@
+## ---------------------------------------------------------------------------
+## 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.
+## ---------------------------------------------------------------------------
+
+# camel-k: dependency=mvn:com.ibm.mq:com.ibm.mq.allclient:9.2.5.0
+
+- route:
+    from:
+      uri: "kamelet:kafka-source"
+      parameters:
+        bootstrapServers: "test12345678910.servicebus.windows.net:9093"
+        topic: camel-test
+        consumerGroup: "$Default"
+        deserializeHeaders: true
+      steps:
+      - to: 
+          uri: "kamelet:jms-ibm-mq-sink"
+          parameters:
+            channel: DEV.APP.SVRCONN
+            destinationName: DEV.QUEUE.1
+            password: "passw0rd" 
+            queueManager: QM1 
+            serverName: 172.17.0.2
+            serverPort: 1414
+            username: app
+
diff --git a/jbang/azure-eventhubs-kafka-ibm-mq/mq-log.yaml b/jbang/azure-eventhubs-kafka-ibm-mq/mq-log.yaml
new file mode 100644
index 0000000..084b898
--- /dev/null
+++ b/jbang/azure-eventhubs-kafka-ibm-mq/mq-log.yaml
@@ -0,0 +1,37 @@
+## ---------------------------------------------------------------------------
+## 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.
+## ---------------------------------------------------------------------------
+
+# camel-k: dependency=mvn:com.ibm.mq:com.ibm.mq.allclient:9.2.5.0
+
+- route:
+    from:
+      uri: "kamelet:jms-ibm-mq-source"
+      parameters:
+        channel: DEV.APP.SVRCONN
+        destinationName: DEV.QUEUE.1
+        password: "passw0rd" 
+        queueManager: QM1 
+        serverName: 172.17.0.2
+        serverPort: 1414
+        username: app
+      steps:
+      - to: 
+          uri: "kamelet:log-sink"
+          parameters:
+            showStreams: true
+            showHeaders: true
+            multiline: true
diff --git a/jbang/azure-eventhubs-kafka-ibm-mq/timer-kafka.yaml b/jbang/azure-eventhubs-kafka-ibm-mq/timer-kafka.yaml
new file mode 100644
index 0000000..73ea379
--- /dev/null
+++ b/jbang/azure-eventhubs-kafka-ibm-mq/timer-kafka.yaml
@@ -0,0 +1,33 @@
+## ---------------------------------------------------------------------------
+## 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.
+## ---------------------------------------------------------------------------
+
+- route:
+    from:
+      uri: "kamelet:timer-source"
+      parameters:
+        message: "test"
+        period: "10000"
+        repeatCount: 5
+      steps:
+      - set-header:
+          name: JMSCorrelationID
+          simple: test
+      - to: 
+          uri: "kamelet:kafka-sink"
+          parameters:
+            bootstrapServers: "test12345678910.servicebus.windows.net:9093"
+            topic: camel-test