Este contenido no está disponible en el idioma seleccionado.

Chapter 11. Atlasmap Component


Note

Only producer is supported.

You can use the AtlasMap component to process data mapping using an AtlasMap data mapping definition. When you export the AtlasMap mapping from the AtlasMap Data Mapper UI, it is packaged as an ADM archive file.

NOTE: Although it is possible to load a mapping definition JSON file that is not packaged into an ADM archive file, some features will not work. We recommend that you always use the ADM archive file for production purposes.

To use the component with Maven, add the following dependency to your pom.xml:

<dependency>
    <groupId>org.apache.camel</groupId>
    <artifactId>camel-atlasmap</artifactId>
    <version>x.x.x</version>
    <!-- use the same version as your Camel core version -->
</dependency>

Optionally, you can include the Apache Daffodil module DFDL module:

<dependency>
    <groupId>io.atlasmap</groupId>
    <artifactId>atlas-dfdl-module</artifactId>
    <version>x.x.x</version>
    <!-- use the same version as atlasmap-core in camel-atlasmap -->
</dependency>

11.1. URI format

atlas:mappingName[?options]

The mappingName is the classpath-local URI of the AtlasMap mapping definition to process, either an ADM archive file (preferably) or a mapping definition JSON file.

11.2. Configuring Options

Camel components are configured on two separate levels:

  • component level
  • endpoint level

11.2.1. Configuring Component Level Options

The component level is the highest configuration level. It contains general and common configurations for all endpoints.

You can configure components with the Component DSL, in a configuration file (application.properties|yaml), or directly with Java code.

Some components only have a few options, and others may have many. A component may have security settings, credentials for authentication, URLs for network connection, and so on.

Components typically have preconfigured defaults for the most common cases, so you may not need to configure any options, or only configure a few.

11.2.2. Component Options

The AtlasMap component supports 4 options:

NameDescriptionCommentDefaultType

lazyStartProducer (producer)

Lazy start of the producer.

The producer starts on the first message.

Allows CamelContext and routes to start in situations where a producer fails to start and causes the route to fail.

When lazy start is enabled, you can handle failures during routing messages via Camel’s routing error handlers.

When the first message is processed then creating and starting the producer may prolong the total processing time.

false

boolean

atlasContextFactory (advanced)

To use the AtlasContextFactory, otherwise a new engine is created.

 

AtlasContextFactory

autowiredEnabled (advanced)

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 configuration of JDBC data sources, JMS connection factories, AWS Clients, and so on.

true

boolean

propertiesFile (advanced)

The URI of the properties file used for AtlasContextFactory initialization.

11.2.3. Configuring Endpoint Level Options

At the endpoint level contains configurations for the endpoints themselves.

You can configure endpoints directly in the endpoint URI as path and query parameters. You can also use the Endpoint DSL and Data Format DSL as type safe ways of configuring endpoints in Java.

Endpoints often have many options that configure what you need the endpoint to do.

Endpoint options are categorized by their use, either as a consumer (from) or producer (to), or both.

A good practice when configuring options is to use Property Placeholders instead of hardcoded settings for urls, port numbers, and sensitive information.

Use placeholders to externalize the configuration from your code to make it more flexible and reusable.

11.2.4. Endpoint Options

The Apache Camel Component Reference endpoint is configured using URI syntax, with path and query parameters:

atlas:resourceUri

11.2.4.1. Path Parameters (1 parameters)

Name

Description

Default

Type

resourceUri (producer)

Required Path to the resource. You can prefix with: classpath, file, http, ref, or bean.

The prefix classpath, file, and http loads the resource using these protocols. The ref prefix looks up the resource in the registry. The prefix bean calls a bean method to be used as the resource by name, given after the dot: bean:myBean.myMethod.

classpath

String

11.2.4.2. Query Parameters (7 parameters)

Name

Description

Comments

Default

Type

allowContextMapAll (producer)

Allow access to all context map details.

By default, only access to message body and headers is allowed.

When enabled, allowContextMapAll allows full access to the current Exchange and CamelContext which imposes a potential security risk as this opens access to the full power of CamelContext API.

false

boolean

contentCache (producer)

Use the resource content cache.

 

false

boolean

forceReload (producer)

Use force reload mode.

This loads the ADM from a file on every Exchange.

By default, the ADM file is loaded from a file only on a first Exchange, and AtlasContext will be reused until the endpoint is recreated.

false

boolean

lazyStartProducer (producer)(advanced)

Lazy start of the producer.

The producer starts on the first message.

Allows CamelContext and routes to start in situations where a producer fails to start and causes the route to fail.

When lazy start is enabled, you can handle failures during routing messages via Camel’s routing error handlers.

When the first message is processed, creating and starting the producer may prolong the total processing time.

false

boolean

sourceMapName (producer)

The Exchange property name for a source message map which holds a java.util.Map<String, Message> where the key is AtlasMap Document ID.

AtlasMap consumes Message bodies as source documents, as well as message headers as source properties where the scope is equal to the Document ID.

 

String

targetMapMode (producer)

TargetMapMode enum value to specify how multiple target documents are delivered if they exist.

Enum values:

* MAP * MESSAGE_HEADER * EXCHANGE_PROPERTY

MAP: Stores documents in a java.util.Map. The java.util.Map is set to an exchange property if targetMapName is specified, otherwise it is set to the message body. MESSAGE_HEADER: Stores them into message headers. EXCHANGE_PROPERTY: Stores them in exchange properties. ).

MAP

TargetMapMode

11.3. Examples

11.3.1. Producer Example

The following example shows an export of and ADM archive file from AtlasMap Data Mapper UI:

from("activemq:My.Queue").
  to("atlas:atlasmap-mapping.adm");

The Apache Camel Component Reference endpoint has no path parameters.

Red Hat logoGithubRedditYoutubeTwitter

Aprender

Pruebe, compre y venda

Comunidades

Acerca de la documentación de Red Hat

Ayudamos a los usuarios de Red Hat a innovar y alcanzar sus objetivos con nuestros productos y servicios con contenido en el que pueden confiar.

Hacer que el código abierto sea más inclusivo

Red Hat se compromete a reemplazar el lenguaje problemático en nuestro código, documentación y propiedades web. Para más detalles, consulte el Blog de Red Hat.

Acerca de Red Hat

Ofrecemos soluciones reforzadas que facilitan a las empresas trabajar en plataformas y entornos, desde el centro de datos central hasta el perímetro de la red.

© 2024 Red Hat, Inc.