Skip to content

Commit

Permalink
Use Data Type Transformer API provided by Camel 4.0
Browse files Browse the repository at this point in the history
- Camel 4.0 introduces a data type support based on the transformer API. Use this instead of the interim implementation in utils
- Remove data type transformers that are now provided by Camel core
- Remove interim data type processor implementation in this repository and use data type processor implementation provided by Camel 4
- Refactor data type action Kamelet to use new Camel 4 data type processor
- Keep those data type transformer implementations (Avro, Json Struct, ...) that have not been ported to Camel core yet
- Update to YAKS 0.16.0 as it allows to explicitly set the camel-kamelets version in Camel JBang
- Update aws-ddb-sink Kamelet to use new data type transform API
  • Loading branch information
christophd committed Aug 31, 2023
1 parent efa068a commit 542ffb5
Show file tree
Hide file tree
Showing 47 changed files with 187 additions and 1,875 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/yaks-tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ concurrency:
cancel-in-progress: true

env:
YAKS_VERSION: 0.15.1
YAKS_RUN_OPTIONS: "--timeout=15m --local -e YAKS_CAMELK_MAX_ATTEMPTS=10 -e YAKS_JBANG_CAMEL_VERSION=4.0.0 -e YAKS_JBANG_KAMELETS_LOCAL_DIR=../../../kamelets -e YAKS_CAMELK_KAMELET_API_VERSION=v1alpha1"
YAKS_VERSION: 0.16.0
YAKS_RUN_OPTIONS: "--timeout=15m --local -e YAKS_CAMELK_MAX_ATTEMPTS=10 -e YAKS_JBANG_CAMEL_VERSION=4.0.0 -e YAKS_JBANG_KAMELETS_VERSION=4.0.0-SNAPSHOT -e YAKS_JBANG_KAMELETS_LOCAL_DIR=../../../kamelets -e YAKS_CAMELK_KAMELET_API_VERSION=v1alpha1"

jobs:
test:
Expand Down
13 changes: 2 additions & 11 deletions kamelets/aws-ddb-sink.kamelet.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -114,23 +114,14 @@ spec:
- "camel:aws2-ddb"
- "camel:kamelet"
template:
beans:
- name: dataTypeRegistry
type: "#class:org.apache.camel.kamelets.utils.format.DefaultDataTypeRegistry"
- name: dataTypeProcessor
type: "#class:org.apache.camel.kamelets.utils.format.DataTypeProcessor"
properties:
scheme: 'aws2-ddb'
format: 'application-json'
registry: '#bean:{{dataTypeRegistry}}'
from:
uri: "kamelet:source"
steps:
- set-property:
name: operation
constant: "{{operation}}"
- process:
ref: "{{dataTypeProcessor}}"
- transform:
to-type: "aws2-ddb:application-json"
- to:
uri: "aws2-ddb:{{table}}"
parameters:
Expand Down
27 changes: 16 additions & 11 deletions kamelets/data-type-action.kamelet.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,28 +40,33 @@ spec:
title: Component Scheme
description: The data type component scheme enables users to apply Camel component specific data type conversions.
type: string
default: "camel"
example: "camel"
format:
title: Data Type Format
description: Defines the data type that will be applied by this action. The Kamelet catalog supports different data types and performs automatic message conversion according to the given type.
description: Defines the data type that will be applied by this action. Apache Camel and the Kamelet catalog support different data types and performs automatic message conversion according to the given type.
type: string
dependencies:
- "mvn:org.apache.camel.kamelets:camel-kamelets-utils:4.0.0-SNAPSHOT"
- "camel:kamelet"
- "camel:core"
template:
beans:
- name: dataTypeRegistry
type: "#class:org.apache.camel.kamelets.utils.format.DefaultDataTypeRegistry"
- name: dataTypeProcessor
type: "#class:org.apache.camel.kamelets.utils.format.DataTypeProcessor"
properties:
scheme: '{{scheme}}'
format: '{{format}}'
registry: '#bean:{{dataTypeRegistry}}'
type: "#class:org.apache.camel.processor.transformer.DataTypeProcessor"
from:
uri: "kamelet:source"
steps:
- process:
- choice:
when:
- simple: "'{{?scheme}}' != ''"
steps:
- set-property:
name: CamelDataType
simple: "{{scheme}}:{{format}}"
otherwise:
steps:
- set-property:
name: CamelDataType
simple: "{{format}}"
- bean:
ref: "{{dataTypeProcessor}}"
method: process

This file was deleted.

This file was deleted.

Loading

0 comments on commit 542ffb5

Please sign in to comment.