Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Solr Sink Kamelet #596

Merged
merged 13 commits into from
Dec 2, 2021
1 change: 1 addition & 0 deletions docs/modules/ROOT/assets/images/kamelets/solr-sink.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions docs/modules/ROOT/nav.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@
* xref:ROOT:sftp-source.adoc[image:kamelets/sftp-source.svg[] SFTP Source]
* xref:ROOT:slack-sink.adoc[image:kamelets/slack-sink.svg[] Slack Sink]
* xref:ROOT:slack-source.adoc[image:kamelets/slack-source.svg[] Slack Source]
* xref:ROOT:solr-sink.adoc[image:kamelets/solr-sink.svg[] Solr Sink]
* xref:ROOT:sqlserver-sink.adoc[image:kamelets/sqlserver-sink.svg[] Microsoft SQL Server Sink]
* xref:ROOT:sqlserver-source.adoc[image:kamelets/sqlserver-source.svg[] Microsoft SQL Server Source]
* xref:ROOT:ssh-source.adoc[image:kamelets/ssh-source.svg[] SSH Source]
Expand Down
152 changes: 152 additions & 0 deletions docs/modules/ROOT/pages/solr-sink.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,152 @@
// THIS FILE IS AUTOMATICALLY GENERATED: DO NOT EDIT

= image:kamelets/solr-sink.svg[] Solr Sink

*Provided by: "Apache Software Foundation"*

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

Send documents to Solr Collection.

== Configuration Options

The following table summarizes the configuration options available for the `solr-sink` Kamelet:
[width="100%",cols="2,^2,3,^2,^2,^3",options="header"]
|===
| Property| Name| Description| Type| Default| Example
| *collection {empty}* *| Collection| Solr Collection name| string| |
| *servers {empty}* *| Servers| Comma separated list of Solr Servers and ports| string| |
| autocommit| Autocommit| If autocommit should be enabled or not| boolean| `false`|
|===

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


== Dependencies

At runtime, the `solr-sink` Kamelet relies upon the presence of the following dependencies:

- camel:solr
- camel:core
- camel:jackson
- camel:kamelet

== Usage

This section describes how you can use the `solr-sink`.

=== Knative Sink

You can use the `solr-sink` Kamelet as a Knative sink by binding it to a Knative object.

.solr-sink-binding.yaml
[source,yaml]
----
apiVersion: camel.apache.org/v1alpha1
kind: KameletBinding
metadata:
name: solr-sink-binding
spec:
source:
ref:
kind: Channel
apiVersion: messaging.knative.dev/v1
name: mychannel
sink:
ref:
kind: Kamelet
apiVersion: camel.apache.org/v1alpha1
name: solr-sink
properties:
collection: "The Collection"
servers: "The Servers"

----

==== *Prerequisite*

You have xref:{camel-k-version}@camel-k::installation/installation.adoc[Camel K installed] on the cluster.

==== *Procedure for using the cluster CLI*

. Save the `solr-sink-binding.yaml` file to your local drive, and then edit it as needed for your configuration.

. Run the sink by using the following command:
+
[source,shell]
----
kubectl apply -f solr-sink-binding.yaml
----

==== *Procedure for using the Kamel CLI*

Configure and run the sink by using the following command:

[source,shell]
----
kamel bind channel:mychannel solr-sink -p "sink.collection=The Collection" -p "sink.servers=The Servers"
----

This command creates the KameletBinding in the current namespace on the cluster.

=== Kafka Sink

You can use the `solr-sink` Kamelet as a Kafka sink by binding it to a Kafka topic.

.solr-sink-binding.yaml
[source,yaml]
----
apiVersion: camel.apache.org/v1alpha1
kind: KameletBinding
metadata:
name: solr-sink-binding
spec:
source:
ref:
kind: KafkaTopic
apiVersion: kafka.strimzi.io/v1beta1
name: my-topic
sink:
ref:
kind: Kamelet
apiVersion: camel.apache.org/v1alpha1
name: solr-sink
properties:
collection: "The Collection"
servers: "The Servers"

----

==== *Prerequisites*

* You've installed https://strimzi.io/[Strimzi].
* You've created a topic named `my-topic` in the current namespace.
* You have xref:{camel-k-version}@camel-k::installation/installation.adoc[Camel K installed] on the cluster.

==== *Procedure for using the cluster CLI*

. Save the `solr-sink-binding.yaml` file to your local drive, and then edit it as needed for your configuration.

. Run the sink by using the following command:
+
[source,shell]
----
kubectl apply -f solr-sink-binding.yaml
----

==== *Procedure for using the Kamel CLI*

Configure and run the sink by using the following command:

[source,shell]
----
kamel bind kafka.strimzi.io/v1beta1:KafkaTopic:my-topic solr-sink -p "sink.collection=The Collection" -p "sink.servers=The Servers"
----

This command creates the KameletBinding in the current namespace on the cluster.

== Kamelet source file

https://github.com/apache/camel-kamelets/blob/main/kamelets/solr-sink.kamelet.yaml

// THIS FILE IS AUTOMATICALLY GENERATED: DO NOT EDIT
77 changes: 77 additions & 0 deletions kamelets/solr-sink.kamelet.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
# ---------------------------------------------------------------------------
# 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.
# ---------------------------------------------------------------------------
apiVersion: camel.apache.org/v1alpha1
kind: Kamelet
metadata:
name: solr-sink
annotations:
camel.apache.org/kamelet.support.level: "Preview"
camel.apache.org/catalog.version: "main-SNAPSHOT"
camel.apache.org/kamelet.icon: "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGhlaWdodD0iODAwIiB3aWR0aD0iMTIwMCIgdmlld0JveD0iLTQwLjYwMDk1IC0zNC4yMTc3NSAzNTEuODc0OSAyMDUuMzA2NSI+PGRlZnM+PGNsaXBQYXRoIGlkPSJhIiBjbGlwUGF0aFVuaXRzPSJ1c2VyU3BhY2VPblVzZSI+PHBhdGggZD0iTTAgMTAyLjY1NGgyMDMuMDA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TExIDkyLjA0MWwtMzMtMzUuNjc3IDQxLjQ3MyAxOS4xMzRhMzMuNDggMzMuNDggMCAwMS04LjQ3MiAxNi41NDNtLTI0LjQ4NSAxMC42MTNjLTQuNTcyIDAtOC45MjgtLjkxNy0xMi45LTIuNTcybC00LjQyOC0zNy4zMTQgMjIuMTI3IDM5LjUzOWEzMy43NTYgMzMuNzU2IDAgMDEtNC44LjM0N20zMy4yODctMjkuMjExTDE2My40MTUgNTEuNDVsMzYuODcgNC4zNzVhMzMuNDU2IDMzLjQ1NiAwIDAxMi40MjggMTcuNjE3bS0xNC40ODgtMzIuMTk0YTMzLjc0OCAzMy43NDggMCAwMTEwLjYxMiAxMS42MTlsLTM0LjU2LTYuODYzem0tMTEuOTc1IDYwLjcxMWwtMTkuMjM4LTQxLjY5NSAzNS42ODUgMzMuMDA2Yy00LjQ3NSA0LjMwNS0xMC4xMzUgNy4zODYtMTYuNDQ4IDguNjg5bS00LjAxNi02Ni4zMzdhMzMuMzcgMzMuMzcgMCAwMTEwLjU0IDIuNjM4bC0xOS4zNTggMi4yOTd6bS0zMy40MTQgNDcuMjU3YTMzLjM2NSAzMy4zNjUgMCAwMS0yLjgzLTEwLjc5Mmw1LjIxNi05LjMyem0xNC43OTggMTUuODIyYTMzLjczNiAzMy43MzYgMCAwMS0xMS44MzItMTAuNTY3bDQuODY3LTI0LjUwNHoiIGZpbGw9IiNkYTM1MjIiLz48L2c+PC9zdmc+"
camel.apache.org/provider: "Apache Software Foundation"
camel.apache.org/kamelet.group: "Solr"
labels:
camel.apache.org/kamelet.type: "sink"
spec:
definition:
title: "Solr Sink"
description: |-
Send documents to Solr Collection.
required:
- servers
- collection
type: object
properties:
collection:
title: Collection
description: Solr Collection name
type: string
servers:
title: Servers
description: Comma separated list of Solr Servers and ports
type: string
autocommit:
title: Autocommit
description: If autocommit should be enabled or not
type: boolean
default: false
x-descriptors:
- 'urn:alm:descriptor:com.tectonic.ui:checkbox'
types:
in:
mediaType: application/json
dependencies:
- "camel:solr"
- "camel:core"
- "camel:jackson"
- "camel:kamelet"
flow:
from:
uri: "kamelet:source"
steps:
- set-header:
name: "SolrOperation"
constant: "INSERT"
- unmarshal:
json:
library: Jackson
- remove-header:
name: "content-type"
- to:
uri: "solr:{{servers}}/solr/{{collection}}"
parameters:
autocommit: "{{autocommit}}"