이 콘텐츠는 선택한 언어로 제공되지 않습니다.
Chapter 80. Value to Key Action
Replace the Kafka record key with a new key formed from a fields subset coming from the message body.
80.1. Configuration Options 링크 복사링크가 클립보드에 복사되었습니다!
The following table summarizes the configuration options available for the value-to-key-action Kamelet:
| Property | Name | Description | Type | Default | Example |
|---|---|---|---|---|---|
| fields * | Fields | Comma separated list of fields to be used to form the new key. | string |
* = Fields marked with an asterisk are mandatory.
80.2. Dependencies 링크 복사링크가 클립보드에 복사되었습니다!
80.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-jackson</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>
80.3. Usage 링크 복사링크가 클립보드에 복사되었습니다!
80.3.1. Camel JBang usage 링크 복사링크가 클립보드에 복사되었습니다!
80.3.1.1. Prerequisites for JBang 링크 복사링크가 클립보드에 복사되었습니다!
- Install JBang.
You have executed the following command:
jbang app install camel@apache/camel
80.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
80.3.2. Knative Action 링크 복사링크가 클립보드에 복사되었습니다!
You can use the value-to-key-action Kamelet as an intermediate step in a Knative binding.
value-to-key-action-binding.yaml
apiVersion: camel.apache.org/v1
kind: Pipe
metadata:
name: value-to-key-action-binding
spec:
source:
ref:
kind: Kamelet
apiVersion: camel.apache.org/v1
name: timer-source
properties:
message: "Hello"
steps:
- ref:
kind: Kamelet
apiVersion: camel.apache.org/v1
name: value-to-key-action
properties:
fields: "The Fields"
sink:
ref:
kind: Channel
apiVersion: messaging.knative.dev/v1
name: mychannel
80.3.3. Kafka Action 링크 복사링크가 클립보드에 복사되었습니다!
You can use the value-to-key-action Kamelet as an intermediate step in a Kafka binding.
value-to-key-action-binding.yaml
apiVersion: camel.apache.org/v1
kind: Pipe
metadata:
name: value-to-key-action-binding
spec:
source:
ref:
kind: Kamelet
apiVersion: camel.apache.org/v1
name: timer-source
properties:
message: "Hello"
steps:
- ref:
kind: Kamelet
apiVersion: camel.apache.org/v1
name: value-to-key-action
properties:
fields: "The Fields"
sink:
ref:
kind: KafkaTopic
apiVersion: kafka.strimzi.io/v1beta1
name: my-topic