61.3. Usage


61.3.1. Camel JBang usage

61.3.1.1. Prerequisites for JBang

  • Install JBang.
  • You have executed the following command:

    jbang app install camel@apache/camel

61.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

61.3.2. Knative Action

You can use the protobuf-deserialize-action Kamelet as an intermediate step in a Knative binding.

protobuf-deserialize-action-binding.yaml

apiVersion: camel.apache.org/v1
kind: Pipe
metadata:
  name: protobuf-deserialize-action-binding
spec:
  source:
    ref:
      kind: Kamelet
      apiVersion: camel.apache.org/v1
      name: timer-source
    properties:
      message: '{"first": "John", "last":"Doe"}'
  steps:
  - ref:
      kind: Kamelet
      apiVersion: camel.apache.org/v1
      name: json-deserialize-action
  - ref:
      kind: Kamelet
      apiVersion: camel.apache.org/v1
      name: protobuf-serialize-action
    properties:
      schema: "message Person { required string first [id="protobuf_deserialize_action_1;_required_string_last_=_2;_}""][id="protobuf_deserialize_action_1;_required_string_last_=_2;_}""] = 1; required string last = 2; }"
  - ref:
      kind: Kamelet
      apiVersion: camel.apache.org/v1
      name: protobuf-deserialize-action
    properties:
      schema: "message Person { required string first [id="protobuf_deserialize_action_1;_required_string_last_=_2;_}""]
[id="protobuf_deserialize_action_1;_required_string_last_=_2;_}""] = 1; required string last = 2; }"
  sink:
    ref:
      kind: Channel
      apiVersion: messaging.knative.dev/v1
      name: mychannel

61.3.3. Kafka Action

You can use the protobuf-deserialize-action Kamelet as an intermediate step in a Kafka binding.

protobuf-deserialize-action-binding.yaml

apiVersion: camel.apache.org/v1
kind: Pipe
metadata:
  name: protobuf-deserialize-action-binding
spec:
  source:
    ref:
      kind: Kamelet
      apiVersion: camel.apache.org/v1
      name: timer-source
    properties:
      message: '{"first": "John", "last":"Doe"}'
  steps:
  - ref:
      kind: Kamelet
      apiVersion: camel.apache.org/v1
      name: json-deserialize-action
  - ref:
      kind: Kamelet
      apiVersion: camel.apache.org/v1
      name: protobuf-serialize-action
    properties:
      schema: "message Person { required string first [id="protobuf_deserialize_action_1;_required_string_last_=_2;_}""]
[id="protobuf_deserialize_action_1;_required_string_last_=_2;_}""]= 1; required string last = 2; }"
  - ref:
      kind: Kamelet
      apiVersion: camel.apache.org/v1
      name: protobuf-deserialize-action
    properties:
      schema: "message Person { required string first [id="protobuf_deserialize_action_1;_required_string_last_=_2;_}""]
[id="protobuf_deserialize_action_1;_required_string_last_=_2;_}""]= 1; required string last = 2; }"
  sink:
    ref:
      kind: KafkaTopic
      apiVersion: kafka.strimzi.io/v1beta1
      name: my-topic

Red Hat logoGithubredditYoutubeTwitter

学习

尝试、购买和销售

社区

關於紅帽

我们提供强化的解决方案,使企业能够更轻松地跨平台和环境(从核心数据中心到网络边缘)工作。

让开源更具包容性

红帽致力于替换我们的代码、文档和 Web 属性中存在问题的语言。欲了解更多详情,请参阅红帽博客.

关于红帽文档

Legal Notice

Theme

© 2026 Red Hat
返回顶部