이 콘텐츠는 선택한 언어로 제공되지 않습니다.
Chapter 49. Kafka Sink
Send data to Kafka topics through Plain Login Module.
The Kamelet is able to understand the following headers to be set:
-
key/ce-key: as message key -
partition-key/ce-partitionkey: as message partition key
Both the headers are optional.
49.1. Configuration Options 링크 복사링크가 클립보드에 복사되었습니다!
The following table summarizes the configuration options available for the kafka-sink Kamelet:
| Property | Name | Description | Type | Default | Example |
|---|---|---|---|---|---|
| bootstrapServers * | Bootstrap Servers | Comma separated list of Kafka Broker URLs | string | ||
| password * | Password | Password to authenticate to kafka | string | ||
| topic * | Topic Names | Comma separated list of Kafka topic names | string | ||
| user * | Username | Username to authenticate to Kafka | string | ||
| saslMechanism | SASL Mechanism | The Simple Authentication and Security Layer (SASL) Mechanism used. | string | PLAIN | |
| securityProtocol | Security Protocol | Protocol used to communicate with brokers. SASL_PLAINTEXT, PLAINTEXT, SASL_SSL and SSL are supported | string | SASL_SSL |
* = Fields marked with an asterisk are mandatory.
49.2. Dependencies 링크 복사링크가 클립보드에 복사되었습니다!
49.2.1. Quarkus dependencies 링크 복사링크가 클립보드에 복사되었습니다!
<dependencies>
<dependency>
<groupId>org.apache.camel.quarkus</groupId>
<artifact>camel-quarkus-core</artifact>
</dependency>
<dependency>
<groupId>org.apache.camel.quarkus</groupId>
<artifact>camel-quarkus-kafka</artifact>
</dependency>
<dependency>
<groupId>org.apache.camel.quarkus</groupId>
<artifact>camel-quarkus-kamelet</artifact>
</dependency>
<dependency>
<groupId>org.apache.camel.kamelets</groupId>
<artifact>camel-kamelets-utils</artifact>
<version>4.8.5</version>
</dependency>
</dependencies>
49.3. Usage 링크 복사링크가 클립보드에 복사되었습니다!
49.3.1. Camel JBang usage 링크 복사링크가 클립보드에 복사되었습니다!
49.3.1.1. Prerequisites for JBang 링크 복사링크가 클립보드에 복사되었습니다!
- Install JBang.
You have executed the following command:
jbang app install camel@apache/camel
49.3.1.2. Running a route with JBang 링크 복사링크가 클립보드에 복사되었습니다!
Suppose you have a file named route.yaml with this content:
- route:
from:
uri: "kamelet:timer-source"
parameters:
period: 10000
message: 'test'
steps:
- to:
uri: "kamelet:log-sink"
You can now run it directly through the following command.
camel run route.yaml
49.3.2. Knative Sink 링크 복사링크가 클립보드에 복사되었습니다!
You can use the kafka-sink Kamelet as a Knative sink by binding it to a Knative object.
kafka-sink-binding.yaml
apiVersion: camel.apache.org/v1
kind: Pipe
metadata:
name: kafka-sink-binding
spec:
source:
ref:
kind: Channel
apiVersion: messaging.knative.dev/v1
name: mychannel
sink:
ref:
kind: Kamelet
apiVersion: camel.apache.org/v1
name: kafka-sink
properties:
bootstrapServers: "The Brokers"
password: "The Password"
topic: "The Topic Names"
user: "The Username"
49.3.3. Kafka Sink 링크 복사링크가 클립보드에 복사되었습니다!
You can use the kafka-sink Kamelet as a Kafka sink by binding it to a Kafka topic.
kafka-sink-binding.yaml
apiVersion: camel.apache.org/v1
kind: Pipe
metadata:
name: kafka-sink-binding
spec:
source:
ref:
kind: KafkaTopic
apiVersion: kafka.strimzi.io/v1beta1
name: my-topic
sink:
ref:
kind: Kamelet
apiVersion: camel.apache.org/v1
name: kafka-sink
properties:
bootstrapServers: "The Brokers"
password: "The Password"
topic: "The Topic Names"
user: "The Username"