Claus Ibsen created CAMEL-21391:
-----------------------------------

             Summary: camel-core - Add configuring dataFormats into model DSL
                 Key: CAMEL-21391
                 URL: https://issues.apache.org/jira/browse/CAMEL-21391
             Project: Camel
          Issue Type: New Feature
          Components: camel-core
            Reporter: Claus Ibsen
             Fix For: 4.x


In the old OSGi blueprint/spring xml via <beans> they had special support for 
configuring data formats globally in <dataFormats>. This is not in the DSL 
model of camel-core.

 

We could considering add this, so its out of the box in xml-io and yaml DSL as 
well. 

However you would then refer to these global dataformats using <custom 
ref="xxx"> style such as:

 
{code:java}
    <bean id="aesKey" class="SpringCryptoDataFormat" factory-method="getAESKey" 
/>
    <bean id="initializationVector" class="SpringCryptoDataFormat" 
factory-method="getIV" />
    <bean id="gcmParamSpec" class="SpringCryptoDataFormat" 
factory-method="getGCMParameterSpec" />      <!-- embed Camel with routes -->
    <camelContext xmlns="http://camel.apache.org/schema/spring";>
        <dataFormats>
            <crypto id="aes-gcm-encryption" algorithm="AES/GCM/NoPadding" 
keyRef="aesKey" algorithmParameterRef="gcmParamSpec" />
        </dataFormats>        <route>
            <from uri="timer:xml?period=1000"/>
            <setBody>
                <simple>Hello Camel from ${routeId}</simple>
            </setBody>
            <log message="Orig: ${body}"/>
            <marshal><custom ref="aes-gcm-encryption" /></marshal>
            <log message="Encrypted: ${body}"/>
            <unmarshal><custom ref="aes-gcm-encryption" /></unmarshal>
            <log message="Decrypted: ${body}"/>
        </route>
    </camelContext> {code}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to