이 콘텐츠는 선택한 언어로 제공되지 않습니다.

Chapter 130. Smooks Data Format


The Smooks Data Format uses Smooks to transform from one data format to another and back again. A configuration for a Smooks Data Format should not allocate system resources because the data format does not close those resources. Use this data format when you are primarily interested in transformation and binding. For other Smooks features like routing use the Smooks component starter.

130.1. Dependencies

When using camel-smooks component starter with Red Hat build of Camel Spring Boot, add the following Maven dependency to your pom.xml to have support for auto configuration:

<dependency>
    <groupId>org.apache.camel.springboot</groupId>
    <artifactId>camel-smooks-starter</artifactId>
</dependency>
Copy to Clipboard Toggle word wrap

130.2. Usage

Below is an example of using the Smooks Data Format to unmarshal a CSV into a java.util.List of org.smooks.example.Customer instances:

Java

from("direct:unmarshal")
    .unmarshal().smooks("csv-smooks-unmarshal-config.xml")
    .log("Unmarshalled customers: ${body}");
Copy to Clipboard Toggle word wrap

YAML

- from:
    uri: direct:unmarshal
    steps:
      - unmarshal:
          smooks:
            smooksConfig: csv-smooks-unmarshal-config.xml
      - log: "Unmarshalled customers: ${body}"
Copy to Clipboard Toggle word wrap

The Smooks configuration in csv-smooks-unmarshal-config.xml is as follows:

<smooks-resource-list xmlns="https://www.smooks.org/xsd/smooks-2.0.xsd"
    xmlns:core="https://www.smooks.org/xsd/smooks/smooks-core-1.6.xsd"
    xmlns:csv="https://www.smooks.org/xsd/smooks/csv-1.7.xsd">

    <core:exports>
        <core:result type="org.smooks.io.sink.JavaSink" extract="result"/>
    </core:exports>

    <csv:reader fields="firstName,lastName,gender,age,country">
        <csv:listBinding beanId="result" class="org.smooks.example.Customer"/>
    </csv:reader>

</smooks-resource-list>
Copy to Clipboard Toggle word wrap

130.3. Smooks Data Format Options

The Smooks dataformat supports 1 option:

Expand
NameDescriptionDefaultJava Type

smooksConfig (common)a

Required Path to the Smooks configuration file.

 

String

130.4. Spring Boot Auto-Configuration

The component supports 6 options, which are listed below.

Expand
NameDescriptionDefaultType

camel.component.smooks.autowired-enabled

Whether autowiring is enabled. This is used for automatic autowiring options (the option must be marked as autowired) by looking up in the registry to find if there is a single instance of matching type, which then gets configured on the component. This can be used for automatic configuring JDBC data sources, JMS connection factories, AWS Clients, etc.

true

Boolean

camel.component.smooks.enabled

Whether to enable auto configuration of the smooks component. This is enabled by default.

 

Boolean

camel.component.smooks.lazy-start-producer

Whether the producer should be started lazy (on the first message). By starting lazy you can use this to allow CamelContext and routes to startup in situations where a producer may otherwise fail during starting and cause the route to fail being started. By deferring this startup to be lazy then the startup failure can be handled during routing messages via Camel’s routing error handlers. Beware that when the first message is processed then creating and starting the producer may take a little time and prolong the total processing time of the processing.

false

Boolean

camel.component.smooks.smooks-factory

To use a custom factory for creating Smooks. The option is a org.smooks.SmooksFactory type.

 

SmooksFactory

camel.dataformat.smooks.enabled

Whether to enable auto configuration of the smooks data format. This is enabled by default.

 

Boolean

camel.dataformat.smooks.smooks-config

Path to the Smooks configuration file.

 

String

Red Hat logoGithubredditYoutubeTwitter

자세한 정보

평가판, 구매 및 판매

커뮤니티

Red Hat 문서 정보

Red Hat을 사용하는 고객은 신뢰할 수 있는 콘텐츠가 포함된 제품과 서비스를 통해 혁신하고 목표를 달성할 수 있습니다. 최신 업데이트를 확인하세요.

보다 포괄적 수용을 위한 오픈 소스 용어 교체

Red Hat은 코드, 문서, 웹 속성에서 문제가 있는 언어를 교체하기 위해 최선을 다하고 있습니다. 자세한 내용은 다음을 참조하세요.Red Hat 블로그.

Red Hat 소개

Red Hat은 기업이 핵심 데이터 센터에서 네트워크 에지에 이르기까지 플랫폼과 환경 전반에서 더 쉽게 작업할 수 있도록 강화된 솔루션을 제공합니다.

Theme

© 2026 Red Hat
맨 위로 이동