Uploaded image for project: 'Camel'
  1. Camel
  2. CAMEL-21391

camel-core - Add configuring dataFormats into model DSL

    XMLWordPrintableJSON

Details

    • New Feature
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • None
    • 4.9.0
    • camel-core
    • None
    • Unknown

    Description

      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:

       

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

      Attachments

        Issue Links

          Activity

            People

              davsclaus Claus Ibsen
              davsclaus Claus Ibsen
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: