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-k-examples.git
The following commit(s) were added to refs/heads/master by this push: new 36fd3cf Added Azure Storage Blob quickstart new a98e38b Merge pull request #25 from luigidemasi/ENTESB-14039 36fd3cf is described below commit 36fd3cfdbde6464e82b59c84f27d180a32277d24 Author: Luigi De Masi <ldem...@redhat.com> AuthorDate: Wed Jul 29 16:01:21 2020 +0200 Added Azure Storage Blob quickstart --- .../azure-storage-blob-channel.yaml | 7 + .../azure-storage-blob-consumer.groovy | 21 +++ .../azure-storage-blob-producer.groovy | 69 ++++++++ .../azure-storage-blob-source.yaml | 32 ++++ .../azure-storage-blob.properties | 5 + 08-azure-storage-blob-basic/readme.didact.md | 181 +++++++++++++++++++++ 08-azure-storage-blob-basic/readme.md | 181 +++++++++++++++++++++ 7 files changed, 496 insertions(+) diff --git a/08-azure-storage-blob-basic/azure-storage-blob-channel.yaml b/08-azure-storage-blob-basic/azure-storage-blob-channel.yaml new file mode 100644 index 0000000..1d1e08a --- /dev/null +++ b/08-azure-storage-blob-basic/azure-storage-blob-channel.yaml @@ -0,0 +1,7 @@ +# +# Knative Channel +# +apiVersion: messaging.knative.dev/v1alpha1 +kind: InMemoryChannel +metadata: + name: azure-blob diff --git a/08-azure-storage-blob-basic/azure-storage-blob-consumer.groovy b/08-azure-storage-blob-basic/azure-storage-blob-consumer.groovy new file mode 100644 index 0000000..6aa78d3 --- /dev/null +++ b/08-azure-storage-blob-basic/azure-storage-blob-consumer.groovy @@ -0,0 +1,21 @@ +// camel-k: dependency=camel-azure-storage-blob +// +// Apache Camel Azure Storage Blob Consumer +// +import static org.apache.camel.support.processor.idempotent.MemoryIdempotentRepository.memoryIdempotentRepository + +from('knative:channel/azure-blob') + .setHeader('orderId', xpath("/order/@id",String.class)) +//use idempotent consumer to process an order only once + .idempotentConsumer(header("orderId"), memoryIdempotentRepository(50)) + .log('Received:\n${body}') + .split() + .xpath('/order/item') + .setHeader('lineItemId', xpath("/item/@id",String.class)) + .setHeader('CamelAzureStorageBlobBlobName', simple('${header.lineItemId}-${header.orderId}.xml')) + .log('Uploading Item ${header.CamelAzureStorageBlobBlobName}:\n${body}') + .to('azure-storage-blob:{{azure.blob.accountName}}/{{azure.blob.itemsContainerName}}?accessKey=RAW({{azure.blob.accessKey}})&operation=uploadBlockBlob') + + + + diff --git a/08-azure-storage-blob-basic/azure-storage-blob-producer.groovy b/08-azure-storage-blob-basic/azure-storage-blob-producer.groovy new file mode 100644 index 0000000..e866bfa --- /dev/null +++ b/08-azure-storage-blob-basic/azure-storage-blob-producer.groovy @@ -0,0 +1,69 @@ +// camel-k: dependency=camel-azure-storage-blob +// +// Apache Camel Azure Storage Blob Producer +// +// This is just a sample producer for Azure that creates a blob in a container +import com.azure.storage.blob.models.BlobStorageException + +from('timer:java?period=3000&repeatCount=1') +//create needed containers if not exist + .doTry() + .to('azure-storage-blob:{{azure.blob.accountName}}/{{azure.blob.ordersContainerName}}?accessKey=RAW({{azure.blob.accessKey}})&operation=createBlobContainer') + .doCatch(BlobStorageException.class) + .log('{{azure.blob.ordersContainerName}} container already exist! ') + .end() + + .doTry() + .to('azure-storage-blob:{{azure.blob.accountName}}/{{azure.blob.itemsContainerName}}?accessKey=RAW({{azure.blob.accessKey}})&operation=createBlobContainer') + .doCatch(BlobStorageException.class) + .log('{{azure.blob.itemsContainerName}} container already exist!') + .end() +//send the order + .setBody() + .constant(''' +<?xml version="1.0" encoding="UTF-8"?> +<order id="5ece4797eaf5e"> + <item id="item1"> + <name>Precision</name> + <mfg>Fender</mfg> + </item> + <item id="item2"> + <name>Jazz</name> + <mfg>Fender</mfg> + </item> + <item id="item3"> + <name>Thunderbird</name> + <mfg>Gibson</mfg> + </item> + <item id="item4"> + <name>Ripper</name> + <mfg>Gibson</mfg> + </item> + <item id="item5"> + <name>4003</name> + <mfg>Rickenbacker</mfg> + </item> + <item id="item6"> + <name>Metroline</name> + <mfg>Sadowsky</mfg> + </item> + <item id="item7"> + <name>Imperial Elite</name> + <mfg>Fodera</mfg> + </item> + <item id="item8"> + <name>Yin Yang Std 4</name> + <mfg>Fodera</mfg> + </item> + <item id="item9"> + <name>BN5</name> + <mfg>Furlanetto</mfg> + </item> + <item id="item10"> + <name>VF4-P</name> + <mfg>Furlanetto</mfg> + </item> +</order> +''') + .to('azure-storage-blob:{{azure.blob.accountName}}/{{azure.blob.ordersContainerName}}?accessKey=RAW({{azure.blob.accessKey}})&blobName={{azure.blob.blobName}}&operation=uploadBlockBlob') + .log('Message sent: ${body}') diff --git a/08-azure-storage-blob-basic/azure-storage-blob-source.yaml b/08-azure-storage-blob-basic/azure-storage-blob-source.yaml new file mode 100644 index 0000000..3c21342 --- /dev/null +++ b/08-azure-storage-blob-basic/azure-storage-blob-source.yaml @@ -0,0 +1,32 @@ +# +# Apache Camel Azure Storage Blob Source +# +apiVersion: sources.knative.dev/v1alpha1 +kind: CamelSource +metadata: + name: camel-azure-storage-blob +spec: + source: + integration: + configuration: + - type: secret + value: azure-storage-blob + dependencies: + # Needed for the Azure Storage Blob component + - camel:camel-azure-storage-blob + flow: + from: + # On the URI below, the Azure account name named 'camelazure' and container name named 'orders' + # can be adjusted to any values suitable in your scenario + uri: azure-storage-blob:camelazure/orders + parameters: + blobName: "{{azure.blob.blobName}}" + accessKey: "{{azure.blob.accessKey}}" + + steps: + - to: "log:received?showAll=true&multiline=true" + sink: + ref: + apiVersion: messaging.knative.dev/v1beta1 + kind: InMemoryChannel + name: azure-blob diff --git a/08-azure-storage-blob-basic/azure-storage-blob.properties b/08-azure-storage-blob-basic/azure-storage-blob.properties new file mode 100644 index 0000000..4f65533 --- /dev/null +++ b/08-azure-storage-blob-basic/azure-storage-blob.properties @@ -0,0 +1,5 @@ +azure.blob.accessKey=FillMe +azure.blob.accountName=FillMe +azure.blob.ordersContainerName=orders +azure.blob.itemsContainerName=line-item-outbox +azure.blob.blobName=orders.xml diff --git a/08-azure-storage-blob-basic/readme.didact.md b/08-azure-storage-blob-basic/readme.didact.md new file mode 100644 index 0000000..538f58c --- /dev/null +++ b/08-azure-storage-blob-basic/readme.didact.md @@ -0,0 +1,181 @@ +# Camel Azure Storage Blob Source Basic Example + +This example demonstrates how to get started with Camel based Knative sources by showing you some of the most important +features that you should know before trying to develop more complex examples. + +You can find more information about Apache Camel and Apache Camel K on the [official Camel website](https://camel.apache.org). + +## Before you begin + +Read the general instructions in the [root README.md file](../README.md) for setting up your environment and the Kubernetes cluster before looking at this example. + +Make sure you've read the [installation instructions](https://camel.apache.org/camel-k/latest/installation/installation.html) for your specific +cluster before starting the example. + +You should open this file with [Didact](https://marketplace.visualstudio.com/items?itemName=redhat.vscode-didact) if available on your IDE. + +## Requirements + +<a href='didact://?commandId=vscode.didact.validateAllRequirements' title='Validate all requirements!'><button>Validate all Requirements at Once!</button></a> + +**Kubectl CLI** + +The Kubernetes `kubectl` CLI tool will be used to interact with the Kubernetes cluster. + +[Check if the Kubectl CLI is installed](didact://?commandId=vscode.didact.cliCommandSuccessful&text=kubectl-requirements-status$$kubectl%20help&completion=Checked%20kubectl%20tool%20availability "Tests to see if `kubectl help` returns a 0 return code"){.didact} + +*Status: unknown*{#kubectl-requirements-status} + +**Connection to a Kubernetes cluster** + +You need to connect to a Kubernetes cluster in order to run the example. + +[Check if you're connected to a Kubernetes cluster](didact://?commandId=vscode.didact.cliCommandSuccessful&text=cluster-requirements-status$$kubectl%20get%20pod&completion=Checked%20Kubernetes%20connection "Tests to see if `kubectl get pod` returns a 0 return code"){.didact} + +*Status: unknown*{#cluster-requirements-status} + +**Apache Camel K CLI ("kamel")** + +You need the Apache Camel K CLI ("kamel") in order to access all Camel K features. + +[Check if the Apache Camel K CLI ("kamel") is installed](didact://?commandId=vscode.didact.requirementCheck&text=kamel-requirements-status$$kamel%20version$$Camel%20K%20Client&completion=Checked%20if%20Camel%20K%20CLI%20is%20available%20on%20this%20system. "Tests to see if `kamel version` returns a result"){.didact} + +*Status: unknown*{#kamel-requirements-status} + +**Knative installed on the cluster** + +The cluster also needs to have Knative installed and working. Refer to the [official Knative documentation](https://knative.dev/v0.15-docs/install/) for information on how to install it in your cluster. + +[Check if the Knative Serving is installed](didact://?commandId=vscode.didact.requirementCheck&text=kserving-project-check$$kubectl%20api-resources%20--api-group=serving.knative.dev$$kservice%2Cksvc&completion=Verified%20Knative%20services%20installation. "Verifies if Knative Serving is installed"){.didact} + +*Status: unknown*{#kserving-project-check} + +[Check if the Knative Eventing is installed](didact://?commandId=vscode.didact.requirementCheck&text=keventing-project-check$$kubectl%20api-resources%20--api-group=messaging.knative.dev$$inmemorychannels&completion=Verified%20Knative%20eventing%20services%20installation. "Verifies if Knative Eventing is installed"){.didact} + +*Status: unknown*{#keventing-project-check} + +**Knative Camel Source installed on the cluster** + +The cluster also needs to have installed the Knative Camel Source from the camel.yaml in the [Eventing Sources release page](https://github.com/knative/eventing-contrib/releases/tag/v0.15.0) + +[Check if the Knative Camel Source is installed](didact://?commandId=vscode.didact.requirementCheck&text=kservice-project-check$$kubectl%20api-resources%20--api-group=sources.knative.dev$$camelsources&completion=Verified%20Knative%20Camel%20Source%20installation. "Verifies if Knative Camel Source is installed"){.didact} + +*Status: unknown*{#kservice-project-check} + +### Optional Requirements + +The following requirements are optional. They don't prevent the execution of the demo, but may make it easier to follow. + +**VS Code Extension Pack for Apache Camel** + +The VS Code Extension Pack for Apache Camel provides a collection of useful tools for Apache Camel K developers, +such as code completion and integrated lifecycle management. They are **recommended** for the tutorial, but they are **not** +required. + +You can install it from the VS Code Extensions marketplace. + +[Check if the VS Code Extension Pack for Apache Camel by Red Hat is installed](didact://?commandId=vscode.didact.extensionRequirementCheck&text=extension-requirement-status$$redhat.apache-camel-extension-pack&completion=Camel%20extension%20pack%20is%20available%20on%20this%20system. "Checks the VS Code workspace to make sure the extension pack is installed"){.didact} + +*Status: unknown*{#extension-requirement-status} + +## 1. Preparing the namespace + +Let's open a terminal and go to the example directory: + +``` +cd 08-azure-storage-blob-basic +``` +([^ execute](didact://?commandId=vscode.didact.sendNamedTerminalAString&text=camelTerm$$cd%2008-azure-storage-blob-basic&completion=Executed%20command. "Opens a new terminal and sends the command above"){.didact}) + + +We're going to create a namespace named `camel-k-azure-blob-knative` for running the example. To create it, execute the following command: + +``` +kubectl create namespace camel-k-azure-blob-knative +``` +([^ execute](didact://?commandId=vscode.didact.sendNamedTerminalAString&text=camelTerm$$kubectl%20create%20namespace%20camel-k-azure-blob-knative&completion=New%20project%20creation. "Opens a new terminal and sends the command above"){.didact}) + +Now we can set the `camel-k-azure-blob-knative` namespace as default namespace for the following commands: + +``` +kubectl config set-context --current --namespace=camel-k-azure-blob-knative +``` +([^ execute](didact://?commandId=vscode.didact.sendNamedTerminalAString&text=camelTerm$$kubectl%20config%20set-context%20--current%20--namespace%3Dcamel-k-azure-blob-knative&completion=New%20project%20creation. "Opens a new terminal and sends the command above"){.didact}) + +You need to install Camel K in the `camel-k-azure-blob-knative` namespace (or globally in the whole cluster). +In many settings (e.g. OpenShift, CRC), it's sufficient to execute the following command to install Camel K: + +``` +kamel install +``` +([^ execute](didact://?commandId=vscode.didact.sendNamedTerminalAString&text=camelTerm$$kamel%20install&completion=Installing%20Camel%20K. "Opens a new terminal and sends the command above"){.didact}) + +NOTE: The `kamel install` command requires some prerequisites to be successful in some situations, e.g. you need to enable the registry addon on Minikube. Refer to the [Camel K install guide](https://camel.apache.org/camel-k/latest/installation/installation.html) for cluster-specific instructions. + +To check that Camel K is installed we'll retrieve the IntegrationPlatform object from the namespace: + +``` +kubectl get integrationplatform +``` +([^ execute](didact://?commandId=vscode.didact.sendNamedTerminalAString&text=camelTerm$$kubectl%20get%20integrationplatform&completion=Executed%20Command. "Opens a new terminal and sends the command above"){.didact}) + +You should find an IntegrationPlatform in status `Ready`. + +You can now proceed to the next section. + +## 2. Preparing the environment + +This repository contains a simple [azure-storage-blob.properties](didact://?commandId=vscode.openFolder&projectFilePath=08-azure-storage-blob-basic/azure-storage-blob.properties&completion=Opened%20the%azure-storage-blob.properties%20file "Opens the azure-storage-blob.properties file"){.didact} that contains the access key for accessing the Azure Storage Blob containers. + +``` +kubectl create secret generic azure-storage-blob --from-file=azure-storage-blob.properties +``` +([^ execute](didact://?commandId=vscode.didact.sendNamedTerminalAString&text=camelTerm$$kubectl%20create%20secret%20generic%20azure-storage-blob%20--from-file%3Dazure-storage-blob.properties&completion=secret%20%22azure-storage-blob%22%20created. "Create a secret with Azure Storage credentials"){.didact}) + +As the example levareges [Knative Eventing channels](https://knative.dev/v0.15-docs/eventing/channels/), we need to create the one that the example will use: + +``` +kubectl apply -f azure-storage-blob-channel.yaml +``` +([^ execute](didact://?commandId=vscode.didact.sendNamedTerminalAString&text=camelTerm$$kubectl%20apply%20-f%20azure-storage-blob-channel.yaml&completion=inmemorychannel.messaging.knative.dev/azure-blob$20created. "Create a Knative InMemoryChannel named azure-blob"){.didact}) + + +## 2. Running a Camel Source + +This repository contains a simple Camel Source based on the [Azure Storage Blob Service component](https://camel.apache.org/components/latest/azure-storage-blob-component.html) that forward messages events received on the Azure Blob container orders to a Knative channel named `azure-blob`. + +Use the following command to deploy the Camel Source: + +``` +kubectl apply -f azure-storage-blob-source.yaml +``` +([^ execute](didact://?commandId=vscode.didact.sendNamedTerminalAString&text=camelTerm$$kubectl%20apply%20-f%20azure-storage-blob-source.yaml&completion=camelsource.sources.knative.dev/camel-azure-storage-blob%20created. "Opens a new terminal and sends the command above"){.didact}) + +## 2. Running a basic integration to create Azure Storage Blob for consumption by the Camel Source + +You need a producer adding data to `orders` Azure Blob Container to try this example. This integration +comes with a sample producer that will upload a xml file. + +``` +kamel run --secret azure-storage-blob azure-storage-blob-producer.groovy +``` +([^ execute](didact://?commandId=vscode.didact.sendNamedTerminalAString&text=camelTerm$$kamel%20run%20--secret%20azure-storage-blob%20azure-storage-blob-producer.groovy&completion=Camel%20K%20azure-storage-blob-producer%20integration%20run%20in%20dev%20mode. "Opens a new terminal and sends the command above"){.didact}) + +If everything is ok, after the build phase finishes, you should see the Camel integration running. + +## 3. Running a basic integration that split the order in line items and forward them to `line-item-outbox` container +``` +kamel run azure-storage-blob-consumer.groovy --dev --secret azure-storage-blob +``` +([^ execute](didact://?commandId=vscode.didact.sendNamedTerminalAString&text=camelTerm$$kamel%20run%20azure-storage-blob-consumer.groovy%20--dev%20--secret%20azure-storage-blob&completion=Camel%20K%20azure-storage-blob-consumer%20integration%20run%20in%20dev%20mode. "Opens a new terminal and sends the command above"){.didact}) + +If everything is ok, after the build phase finishes, you should see the Camel integration running. + + +## 4. Uninstall + +To cleanup everything, execute the following command: + +```kubectl delete namespace camel-k-azure-blob-knative``` + +([^ execute](didact://?commandId=vscode.didact.sendNamedTerminalAString&text=camelTerm$$kubectl%20delete%20namespace%20camel-k-azure-blob-knative&completion=Removed%20the%20namespace%20from%20the%20cluster. "Cleans up the cluster after running the example"){.didact}) diff --git a/08-azure-storage-blob-basic/readme.md b/08-azure-storage-blob-basic/readme.md new file mode 100644 index 0000000..888260f --- /dev/null +++ b/08-azure-storage-blob-basic/readme.md @@ -0,0 +1,181 @@ +# Camel Azure Storage Blob Source Basic Example + +This example demonstrates how to get started with Camel based Knative sources by showing you some of the most important +features that you should know before trying to develop more complex examples. + +You can find more information about Apache Camel and Apache Camel K on the [official Camel website](https://camel.apache.org). + +## Before you begin + +Read the general instructions in the [root README.md file](../README.md) for setting up your environment and the Kubernetes cluster before looking at this example. + +Make sure you've read the [installation instructions](https://camel.apache.org/camel-k/latest/installation/installation.html) for your specific +cluster before starting the example. + +You should open this file with [Didact](https://marketplace.visualstudio.com/items?itemName=redhat.vscode-didact) if available on your IDE. + +## Requirements + +<a href='didact://?commandId=vscode.didact.validateAllRequirements' title='Validate all requirements!'><button>Validate all Requirements at Once!</button></a> + +**Kubectl CLI** + +The Kubernetes `kubectl` CLI tool will be used to interact with the Kubernetes cluster. + +[Check if the Kubectl CLI is installed](didact://?commandId=vscode.didact.cliCommandSuccessful&text=kubectl-requirements-status$$kubectl%20help&completion=Checked%20kubectl%20tool%20availability "Tests to see if `kubectl help` returns a 0 return code"){.didact} + +*Status: unknown*{#kubectl-requirements-status} + +**Connection to a Kubernetes cluster** + +You need to connect to a Kubernetes cluster in order to run the example. + +[Check if you're connected to a Kubernetes cluster](didact://?commandId=vscode.didact.cliCommandSuccessful&text=cluster-requirements-status$$kubectl%20get%20pod&completion=Checked%20Kubernetes%20connection "Tests to see if `kubectl get pod` returns a 0 return code"){.didact} + +*Status: unknown*{#cluster-requirements-status} + +**Apache Camel K CLI ("kamel")** + +You need the Apache Camel K CLI ("kamel") in order to access all Camel K features. + +[Check if the Apache Camel K CLI ("kamel") is installed](didact://?commandId=vscode.didact.requirementCheck&text=kamel-requirements-status$$kamel%20version$$Camel%20K%20Client&completion=Checked%20if%20Camel%20K%20CLI%20is%20available%20on%20this%20system. "Tests to see if `kamel version` returns a result"){.didact} + +*Status: unknown*{#kamel-requirements-status} + +**Knative installed on the cluster** + +The cluster also needs to have Knative installed and working. Refer to the [official Knative documentation](https://knative.dev/v0.15-docs/install/) for information on how to install it in your cluster. + +[Check if the Knative Serving is installed](didact://?commandId=vscode.didact.requirementCheck&text=kserving-project-check$$kubectl%20api-resources%20--api-group=serving.knative.dev$$kservice%2Cksvc&completion=Verified%20Knative%20services%20installation. "Verifies if Knative Serving is installed"){.didact} + +*Status: unknown*{#kserving-project-check} + +[Check if the Knative Eventing is installed](didact://?commandId=vscode.didact.requirementCheck&text=keventing-project-check$$kubectl%20api-resources%20--api-group=messaging.knative.dev$$inmemorychannels&completion=Verified%20Knative%20eventing%20services%20installation. "Verifies if Knative Eventing is installed"){.didact} + +*Status: unknown*{#keventing-project-check} + +**Knative Camel Source installed on the cluster** + +The cluster also needs to have installed the Knative Camel Source from the camel.yaml in the [Eventing Sources release page](https://github.com/knative/eventing-contrib/releases/tag/v0.15.0) + +[Check if the Knative Camel Source is installed](didact://?commandId=vscode.didact.requirementCheck&text=kservice-project-check$$kubectl%20api-resources%20--api-group=sources.knative.dev$$camelsources&completion=Verified%20Knative%20Camel%20Source%20installation. "Verifies if Knative Camel Source is installed"){.didact} + +*Status: unknown*{#kservice-project-check} + +### Optional Requirements + +The following requirements are optional. They don't prevent the execution of the demo, but may make it easier to follow. + +**VS Code Extension Pack for Apache Camel** + +The VS Code Extension Pack for Apache Camel provides a collection of useful tools for Apache Camel K developers, +such as code completion and integrated lifecycle management. They are **recommended** for the tutorial, but they are **not** +required. + +You can install it from the VS Code Extensions marketplace. + +[Check if the VS Code Extension Pack for Apache Camel by Red Hat is installed](didact://?commandId=vscode.didact.extensionRequirementCheck&text=extension-requirement-status$$redhat.apache-camel-extension-pack&completion=Camel%20extension%20pack%20is%20available%20on%20this%20system. "Checks the VS Code workspace to make sure the extension pack is installed"){.didact} + +*Status: unknown*{#extension-requirement-status} + +## 1. Preparing the namespace + +Let's open a terminal and go to the example directory: + +``` +cd 08-azure-storage-blob-basic +``` +([^ execute](didact://?commandId=vscode.didact.sendNamedTerminalAString&text=camelTerm$$cd%2008-azure-storage-blob-basic&completion=Executed%20command. "Opens a new terminal and sends the command above"){.didact}) + + +We're going to create a namespace named `camel-k-azure-blob-knative` for running the example. To create it, execute the following command: + +``` +kubectl create namespace camel-k-azure-blob-knative +``` +([^ execute](didact://?commandId=vscode.didact.sendNamedTerminalAString&text=camelTerm$$kubectl%20create%20namespace%20camel-k-azure-blob-knative&completion=New%20project%20creation. "Opens a new terminal and sends the command above"){.didact}) + +Now we can set the `camel-k-azure-blob-knative` namespace as default namespace for the following commands: + +``` +kubectl config set-context --current --namespace=camel-k-azure-blob-knative +``` +([^ execute](didact://?commandId=vscode.didact.sendNamedTerminalAString&text=camelTerm$$kubectl%20config%20set-context%20--current%20--namespace%3Dcamel-k-azure-blob-knative&completion=New%20project%20creation. "Opens a new terminal and sends the command above"){.didact}) + +You need to install Camel K in the `camel-k-azure-blob-knative` namespace (or globally in the whole cluster). +In many settings (e.g. OpenShift, CRC), it's sufficient to execute the following command to install Camel K: + +``` +kamel install +``` +([^ execute](didact://?commandId=vscode.didact.sendNamedTerminalAString&text=camelTerm$$kamel%20install&completion=Installing%20Camel%20K. "Opens a new terminal and sends the command above"){.didact}) + +NOTE: The `kamel install` command requires some prerequisites to be successful in some situations, e.g. you need to enable the registry addon on Minikube. Refer to the [Camel K install guide](https://camel.apache.org/camel-k/latest/installation/installation.html) for cluster-specific instructions. + +To check that Camel K is installed we'll retrieve the IntegrationPlatform object from the namespace: + +``` +kubectl get integrationplatform +``` +([^ execute](didact://?commandId=vscode.didact.sendNamedTerminalAString&text=camelTerm$$kubectl%20get%20integrationplatform&completion=Executed%20Command. "Opens a new terminal and sends the command above"){.didact}) + +You should find an IntegrationPlatform in status `Ready`. + +You can now proceed to the next section. + +## 2. Preparing the environment + +This repository contains a simple [azure-storage-blob.properties](didact://?commandId=vscode.openFolder&projectFilePath=08-azure-storage-blob-basic/azure-storage-blob.properties&completion=Opened%20the%azure-storage-blob.properties%20file "Opens the azure-storage-blob.properties file"){.didact} that contains basic configuration properties for the Azure Storage Blob component. + +``` +kubectl create secret generic azure-storage-blob --from-file=azure-storage-blob.properties +``` +([^ execute](didact://?commandId=vscode.didact.sendNamedTerminalAString&text=camelTerm$$kubectl%20create%20secret%20generic%20azure-storage-blob%20--from-file%3Dazure-storage-blob.properties&completion=secret%20%22azure-storage-blob%22%20created. "Create a secret with Azure Storage credentials"){.didact}) + +As the example levareges [Knative Eventing channels](https://knative.dev/v0.15-docs/eventing/channels/), we need to create the one that the example will use: + +``` +kubectl apply -f azure-storage-blob-channel.yaml +``` +([^ execute](didact://?commandId=vscode.didact.sendNamedTerminalAString&text=camelTerm$$kubectl%20apply%20-f%20azure-storage-blob-channel.yaml&completion=inmemorychannel.messaging.knative.dev/azure-blob$20created. "Create a Knative InMemoryChannel named azure-blob"){.didact}) + + +## 2. Running a Camel Source + +This repository contains a simple Camel Source based on the [Azure Storage Blob Service component](https://camel.apache.org/components/latest/azure-storage-blob-component.html) that forward messages events received on the Azure Blob container orders to a Knative channel named `azure-blob`. + +Use the following command to deploy the Camel Source: + +``` +kubectl apply -f azure-storage-blob-source.yaml +``` +([^ execute](didact://?commandId=vscode.didact.sendNamedTerminalAString&text=camelTerm$$kubectl%20apply%20-f%20azure-storage-blob-source.yaml&completion=camelsource.sources.knative.dev/camel-azure-storage-blob%20created. "Opens a new terminal and sends the command above"){.didact}) + +## 2. Running a basic integration to create Azure Storage Blob for consumption by the Camel Source + +You need a producer adding data to `orders` Azure Blob Container to try this example. This integration +comes with a sample producer that will upload a xml file. + +``` +kamel run --secret azure-storage-blob azure-storage-blob-producer.groovy +``` +([^ execute](didact://?commandId=vscode.didact.sendNamedTerminalAString&text=camelTerm$$kamel%20run%20--secret%20azure-storage-blob%20azure-storage-blob-producer.groovy&completion=Camel%20K%20azure-storage-blob-producer%20integration%20run%20in%20dev%20mode. "Opens a new terminal and sends the command above"){.didact}) + +If everything is ok, after the build phase finishes, you should see the Camel integration running. + +## 3. Running a basic integration that split the order in line items and forward them to `line-item-outbox` container +``` +kamel run azure-storage-blob-consumer.groovy --dev --secret azure-storage-blob +``` +([^ execute](didact://?commandId=vscode.didact.sendNamedTerminalAString&text=camelTerm$$kamel%20run%20azure-storage-blob-consumer.groovy%20--dev%20--secret%20azure-storage-blob&completion=Camel%20K%20azure-storage-blob-consumer%20integration%20run%20in%20dev%20mode. "Opens a new terminal and sends the command above"){.didact}) + +If everything is ok, after the build phase finishes, you should see the Camel integration running. + + +## 4. Uninstall + +To cleanup everything, execute the following command: + +```kubectl delete namespace camel-k-azure-blob-knative``` + +([^ execute](didact://?commandId=vscode.didact.sendNamedTerminalAString&text=camelTerm$$kubectl%20delete%20namespace%20camel-k-azure-blob-knative&completion=Removed%20the%20namespace%20from%20the%20cluster. "Cleans up the cluster after running the example"){.didact}) \ No newline at end of file