kamelets.caffeine-action.kamelet.yaml Maven / Gradle / Ivy
The newest version!
# ---------------------------------------------------------------------------
# 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/v1
kind: Kamelet
metadata:
name: caffeine-action
annotations:
camel.apache.org/kamelet.support.level: "Stable"
camel.apache.org/catalog.version: "4.8.0"
camel.apache.org/kamelet.icon: "data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4KPCEtLSBHZW5lcmF0b3I6IEFkb2JlIElsbHVzdHJhdG9yIDIxLjAuMCwgU1ZHIEV4cG9ydCBQbHVnLUluIC4gU1ZHIFZlcnNpb246IDYuMDAgQnVpbGQgMCkgIC0tPgo8c3ZnIHZlcnNpb249IjEuMSIgaWQ9ItCh0LvQvtC5XzEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHg9IjBweCIgeT0iMHB4IgoJIHZpZXdCb3g9IjAgMCAyODEuOCAyNzMuOCIgc3R5bGU9ImVuYWJsZS1iYWNrZ3JvdW5kOm5ldyAwIDAgMjgxLjggMjczLjg7IiB4bWw6c3BhY2U9InByZXNlcnZlIj4KPGc+Cgk8cmVjdCB4PSIxODYuNyIgeT0iMTIxLjYiIHdpZHRoPSIyLjQiIGhlaWdodD0iNDUuNiIvPgoJPHJlY3QgeD0iNDMuNCIge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0xLjgsNy44YzAsNC4zLDEuOCw3LjcsMS44LDcuN0MxMTcuNSw0MC4xLDEyMC42LDQxLjksMTIwLjYsNDEuOXogTTExOS4xLDIyLjhjMS4yLTIuNiwzLjUtNCwzLjUtNAoJCWMyLjItMS40LDUuMS0xLjQsNS4xLTEuNGMyLjksMCw1LjEsMS40LDUuMSwxLjRjMi4yLDEuNCwzLjUsNCwzLjUsNGMxLjIsMi42LDEuMiw2LjIsMS4yLDYuMmMwLDMuNi0xLjIsNi4yLTEuMiw2LjIKCQljLTEuMiwyLjYtMy41LDQtMy41LDRjLTIuMiwxLjQtNSwxLjQtNSwxLjRjLTIuOCwwLTUtMS40LTUtMS40Yy0yLjItMS40LTMuNS00LTMuNS00Yy0xLjItMi42LTEuMi02LjEtMS4yLTYuMQoJCUMxMTcuOSwyNS41LDExOS4xLDIyLjgsMTE5LjEsMjIuOHoiLz4KCTxwb2x5Z29uIHBvaW50cz0iMjM5LjcsMTk4LjUgMjM5LjYsMTk4LjUgMjI1LjMsMTc2LjIgMjIxLjMsMTc2LjIgMjIxLjMsMjA0LjkgMjI0LjksMjA0LjkgMjI0LjksMTgyLjUgMjI1LDE4Mi41IDIzOS40LDIwNC45IAoJCTI0My4zLDIwNC45IDI0My4zLDE3Ni4yIDIzOS43LDE3Ni4yIAkiLz4KCTxwb2x5Z29uIHBvaW50cz0iMjI0LjksODkuMyAyMjUsODkuMyAyMzkuNCwxMTEuNyAyNDMuMywxMTEuNyAyNDMuMyw4MyAyMzkuNyw4MyAyMzkuNywxMDUuMyAyMzkuNiwxMDUuMyAyMjUuMyw4MyAyMjEuMyw4MyAKCQkyMjEuMywxMTEuNyAyMjQuOSwxMTEuNyAJIi8+CjwvZz4KPC9zdmc+Cg=="
camel.apache.org/provider: "Apache Software Foundation"
camel.apache.org/kamelet.group: "Caffeine"
camel.apache.org/kamelet.namespace: "Cache"
labels:
camel.apache.org/kamelet.type: "action"
spec:
definition:
title: "Caffeine Action"
description: |-
Perform operations on a caffeine cache
The Kamelet expects the following headers to be set:
- `caffeine-key` / `ce-caffeinekey`: as the cache key used in the operation
- `caffeine-operation` / `ce-caffeineoperation`: as the operation to perform. It can be PUT, GET, INVALIDATE and CLEANUP.
If the caffeine-key header won't be set the exchange ID will be used as key.
If the caffeine-operation header won't be set, the GET operation will be performed.
required:
- cacheName
type: object
properties:
cacheName:
title: Cache name
description: The name of the cache we want to use
type: string
default: caffeine-cache
dependencies:
- "camel:core"
- "camel:caffeine"
- "camel:kamelet"
template:
from:
uri: "kamelet:source"
steps:
- choice:
when:
- simple: "${header[caffeine-key]}"
steps:
- setHeader:
name: CamelCaffeineKey
simple: "${header[caffeine-key]}"
- simple: "${header[ce-caffeinekey]}"
steps:
- setHeader:
name: CamelCaffeineKey
simple: "${header[ce-caffeinekey]}"
otherwise:
steps:
- setHeader:
name: CamelCaffeineKey
simple: "${body}"
- choice:
when:
- simple: "${header[caffeine-operation]}"
steps:
- setHeader:
name: CamelCaffeineAction
simple: "${header[caffeine-operation]}"
- simple: "${header[ce-caffeineoperation]}"
steps:
- setHeader:
name: CamelCaffeineAction
simple: "${header[ce-caffeineoperation]}"
otherwise:
steps:
- setHeader:
name: CamelCaffeineAction
constant: "GET"
- to:
uri: "caffeine-cache:{{cacheName}}"