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.git
commit 1cee50bf8f0a668939707dee5990241c860edeed Author: Andrea Cosentino <anco...@gmail.com> AuthorDate: Wed Sep 8 13:55:50 2021 +0200 Added Google pubsub Source Kamelet --- .../images/kamelets/google-pubsub-source.svg | 1 + docs/modules/ROOT/pages/google-pubsub-source.adoc | 131 +++++++++++++++++++++ 2 files changed, 132 insertions(+) diff --git a/docs/modules/ROOT/assets/images/kamelets/google-pubsub-source.svg b/docs/modules/ROOT/assets/images/kamelets/google-pubsub-source.svg new file mode 100644 index 0000000..449dd6e --- /dev/null +++ b/docs/modules/ROOT/assets/images/kamelets/google-pubsub-source.svg @@ -0,0 +1 @@ +<svg height="2500" viewBox="-1.63323543 7.03260933 131.26574682 114.43939067" width="2500" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"><linearGradient id="a" gradientUnits="userSpaceOnUse" x1="64" x2="64" y1="7.034" y2="120.789"><stop offset="0" stop-color="#4387fd"/><stop offset="1" stop-color="#4683ea"/></linearGradient><path d="m27.79 115.217-26.25-45.468a11.499 11.499 0 0 1 0-11.499l26.25-45.467a11.5 11.5 0 0 1 9.96-5.75h52.5a11.5 11.5 0 0 1 9.959 5. [...] \ No newline at end of file diff --git a/docs/modules/ROOT/pages/google-pubsub-source.adoc b/docs/modules/ROOT/pages/google-pubsub-source.adoc new file mode 100644 index 0000000..5c31312 --- /dev/null +++ b/docs/modules/ROOT/pages/google-pubsub-source.adoc @@ -0,0 +1,131 @@ +// THIS FILE IS AUTOMATICALLY GENERATED: DO NOT EDIT += image:kamelets/google-pubsub-source.svg[] Google Pubsub Source + +*Provided by: "Apache Software Foundation"* + +*Support Level for this Kamelet is: "Preview"* + +Consume messages from Google Pubsub. + +The serviceAccountKey property needs to be encoded in base64, so when you pass it as parameter, don't forget to encode it. + +== Configuration Options + +The following table summarizes the configuration options available for the `google-pubsub-source` Kamelet: +[width="100%",cols="2,^2,3,^2,^2,^3",options="header"] +|=== +| Property| Name| Description| Type| Default| Example +| *projectId {empty}* *| Project Id| The Google Cloud PubSub Project Id| string| | +| *serviceAccountKey {empty}* *| Service Account Key| The Service account key that can be used as credentials for the PubSub publisher/subscriber| binary| | +| maxMessagesPerPoll| Max Messages Per Poll| The max number of messages to receive from the server in a single API call| integer| `1`| +| subscriptionName| Subscription Name| The Subscription Name| string| | +| synchronousPull| Synchronous Pull| If Synchronously pull batches of messages is enabled or not| boolean| `false`| +|=== + +NOTE: Fields marked with ({empty}*) are mandatory. + +== Usage + +This section summarizes how the `google-pubsub-source` can be used in various contexts. + +=== Knative Source + +The `google-pubsub-source` Kamelet can be used as Knative source by binding it to a Knative object. + +.google-pubsub-source-binding.yaml +[source,yaml] +---- +apiVersion: camel.apache.org/v1alpha1 +kind: KameletBinding +metadata: + name: google-pubsub-source-binding +spec: + source: + ref: + kind: Kamelet + apiVersion: camel.apache.org/v1alpha1 + name: google-pubsub-source + properties: + projectId: "The Project Id" + serviceAccountKey: "The Service Account Key" + 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 `google-pubsub-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 google-pubsub-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 google-pubsub-source -p "source.projectId=The Project Id" -p "source.serviceAccountKey=The Service Account Key" channel/mychannel +---- + +This will create the KameletBinding under the hood and apply it to the current namespace in the cluster. + +=== Kafka Source + +The `google-pubsub-source` Kamelet can be used as Kafka source by binding it to a Kafka topic. + +.google-pubsub-source-binding.yaml +[source,yaml] +---- +apiVersion: camel.apache.org/v1alpha1 +kind: KameletBinding +metadata: + name: google-pubsub-source-binding +spec: + source: + ref: + kind: Kamelet + apiVersion: camel.apache.org/v1alpha1 + name: google-pubsub-source + properties: + projectId: "The Project Id" + serviceAccountKey: "The Service Account Key" + 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 `google-pubsub-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 google-pubsub-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 google-pubsub-source -p "source.projectId=The Project Id" -p "source.serviceAccountKey=The Service Account Key" 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