// THIS FILE IS AUTOMATICALLY GENERATED: DO NOT EDIT
= image:kamelets/azure-cosmosdb-source.svg[] Azure CosmosDB Source

*Provided by: "Apache Software Foundation"*

*Support Level for this Kamelet is: "Preview"*

Consume Changes from a CosmosDB instance

== Configuration Options

The following table summarizes the configuration options available for the `azure-cosmosdb-source` Kamelet:
[width="100%",cols="2,^2,3,^2,^2,^3",options="header"]
|===
| Property| Name| Description| Type| Default| Example
| *accountKey {empty}* *| Account Key| The Azure Cosmos account Key.| string| | 
| *containerName {empty}* *| Container Name| The Azure Cosmos container name.| string| | 
| *databaseEndpoint {empty}* *| Database Endpoint| Sets the Azure Cosmos database endpoint the component will connect to.| string| | 
| *databaseName {empty}* *| Database Name| The Azure Cosmos database name.| string| | 
| createLeaseContainerIfNotExists| Autocreate Lease Container| Sets if the component should create Cosmos lease container for the consumer automatically in case it doesn’t exist in Cosmos database.| boolean| `false`| 
| createLeaseDatabaseIfNotExists| Autocreate Lease Database| Sets if the component should create Cosmos lease database for the consumer automatically in case it doesn’t exist in Cosmos account.| boolean| `false`| 
| leaseContainerName| Lease Container Name| Sets the lease database where the leaseContainerName will be stored.| string| | 
| leaseDatabaseName| Lease Database Name| Sets the lease container which acts as a state storage and coordinates processing the change feed across multiple workers.| string| | 
|===

NOTE: Fields marked with ({empty}*) are mandatory.

== Usage

This section summarizes how the `azure-cosmosdb-source` can be used in various contexts.

=== Knative Source

The `azure-cosmosdb-source` Kamelet can be used as Knative source by binding it to a Knative object.

.azure-cosmosdb-source-binding.yaml
[source,yaml]
----
apiVersion: camel.apache.org/v1alpha1
kind: KameletBinding
metadata:
  name: azure-cosmosdb-source-binding
spec:
  source:
    ref:
      kind: Kamelet
      apiVersion: camel.apache.org/v1alpha1
      name: azure-cosmosdb-source
    properties:
      accountKey: "The Account Key"
      containerName: "The Container Name"
      databaseEndpoint: "The Database Endpoint"
      databaseName: "The Database Name"
  sink:
    ref:
      kind: InMemoryChannel
      apiVersion: messaging.knative.dev/v1
      name: mychannel
  
----
Make sure you have xref:latest@camel-k::installation/installation.adoc[Camel K installed] into the Kubernetes cluster you're connected to.

Save the `azure-cosmosdb-source-binding.yaml` file into your hard drive, then configure it according to your needs.

You can run the source using the following command:

[source,shell]
----
kubectl apply -f azure-cosmosdb-source-binding.yaml
----

==== *Binding to Knative using the Kamel CLI:*

The procedure described above can be simplified into a single execution of the `kamel bind` command:

[source,shell]
----
kamel bind azure-cosmosdb-source -p "source.accountKey=The Account Key" -p "source.containerName=The Container Name" -p "source.databaseEndpoint=The Database Endpoint" -p "source.databaseName=The Database Name" channel/mychannel
----

This will create the KameletBinding under the hood and apply it to the current namespace in the cluster.

=== Kafka Source

The `azure-cosmosdb-source` Kamelet can be used as Kafka source by binding it to a Kafka topic.

.azure-cosmosdb-source-binding.yaml
[source,yaml]
----
apiVersion: camel.apache.org/v1alpha1
kind: KameletBinding
metadata:
  name: azure-cosmosdb-source-binding
spec:
  source:
    ref:
      kind: Kamelet
      apiVersion: camel.apache.org/v1alpha1
      name: azure-cosmosdb-source
    properties:
      accountKey: "The Account Key"
      containerName: "The Container Name"
      databaseEndpoint: "The Database Endpoint"
      databaseName: "The Database Name"
  sink:
    ref:
      kind: KafkaTopic
      apiVersion: kafka.strimzi.io/v1beta1
      name: my-topic
  
----

Ensure that you've installed https://strimzi.io/[Strimzi] and created a topic named `my-topic` in the current namespace.
Make also sure you have xref:latest@camel-k::installation/installation.adoc[Camel K installed] into the Kubernetes cluster you're connected to.

Save the `azure-cosmosdb-source-binding.yaml` file into your hard drive, then configure it according to your needs.

You can run the source using the following command:

[source,shell]
----
kubectl apply -f azure-cosmosdb-source-binding.yaml
----

==== *Binding to Kafka using the Kamel CLI:*

The procedure described above can be simplified into a single execution of the `kamel bind` command:

[source,shell]
----
kamel bind azure-cosmosdb-source -p "source.accountKey=The Account Key" -p "source.containerName=The Container Name" -p "source.databaseEndpoint=The Database Endpoint" -p "source.databaseName=The Database Name" kafka.strimzi.io/v1beta1:KafkaTopic:my-topic
----

This will create the KameletBinding under the hood and apply it to the current namespace in the cluster.

// THIS FILE IS AUTOMATICALLY GENERATED: DO NOT EDIT
