Camel Components

Docling

Since Camel 4.15

Both producer and consumer are supported

The Docling component allows you to convert and process documents using IBM’s Docling AI document parser. Docling is a powerful Python library that can parse and convert various document formats including PDF, Word documents, PowerPoint presentations, and more into structured formats like Markdown, HTML, JSON, or plain text.

Maven users will need to add the following dependency to their pom.xml for this component:

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

Prerequisites

This component supports two modes of operation:

  1. CLI Mode (default): Requires Docling to be installed on your system via pip:

    pip install docling
  2. API Mode: Requires a running docling-serve instance. The component uses the official docling-java library for communication with docling-serve, providing robust API integration with native async support. You can run docling-serve using:

    # Install docling-serve
    pip install docling-serve
    
    # Run docling-serve
    docling-serve --host 0.0.0.0 --port 5001

    Or using Docker:

    docker run -p 5001:5001 ghcr.io/docling-project/docling-serve:latest

URI format

docling:operation[?options]

Where operation represents the document processing operation to perform.

Supported Operations

The component supports the following operations:

Operation Description

CONVERT_TO_MARKDOWN

Convert document to Markdown format (default)

CONVERT_TO_HTML

Convert document to HTML format

CONVERT_TO_JSON

Convert document to JSON format. Returns a DoclingDocument object (ai.docling.core.DoclingDocument) in both API and CLI modes.

EXTRACT_TEXT

Extract plain text content from document

EXTRACT_STRUCTURED_DATA

Extract structured data with table structure recognition enabled by default. Returns a DoclingDocument object in both API and CLI modes. Additional enrichment features (code, formula, picture classification) can be enabled via configuration.

EXTRACT_METADATA

Extract document metadata (title, page count, document type, MIME type, file name and size)

SUBMIT_ASYNC_CONVERSION

Submit an async conversion and return task ID (docling-serve only)

CHECK_CONVERSION_STATUS

Check the status of an async conversion task (docling-serve only)

CHUNK_HYBRID

Chunk document using HybridChunker — token-aware and structure-aware (docling-serve only)

CHUNK_HIERARCHICAL

Chunk document using HierarchicalChunker — structure-aware (docling-serve only)

Configuring Options

Camel components are configured on two separate levels:

  • component level

  • endpoint level

Configuring Component Options

At the component level, you set general and shared configurations that are, then, inherited by the endpoints. It is the highest configuration level.

For example, a component may have security settings, credentials for authentication, urls for network connection and so forth.

Some components only have a few options, and others may have many. Because components typically have pre-configured defaults that are commonly used, then you may often only need to configure a few options on a component; or none at all.

You can configure components using:

  • the Component DSL.

  • in a configuration file (application.properties, *.yaml files, etc).

  • directly in the Java code.

Configuring Endpoint Options

You usually spend more time setting up endpoints because they have many options. These options help you customize what you want the endpoint to do. The options are also categorized into whether the endpoint is used as a consumer (from), as a producer (to), or both.

Configuring endpoints is most often done directly in the endpoint URI as path and query parameters. You can also use the Endpoint DSL and DataFormat DSL as a type safe way of configuring endpoints and data formats in Java.

A good practice when configuring options is to use Property Placeholders.

Property placeholders provide a few benefits:

  • They help prevent using hardcoded urls, port numbers, sensitive information, and other settings.

  • They allow externalizing the configuration from the code.

  • They help the code to become more flexible and reusable.

The following two sections list all the options, firstly for the component followed by the endpoint.

Component Options

The Docling component supports the following options which are listed below.

Name Description Default Type

configuration (common)

The shared configuration of the endpoints: each endpoint starts from a copy of it.

DoclingConfiguration

contentInBody (common)

With the docling CLI, whether the message body is the content of the output file, which is then deleted. When false, the body is the path of the output file, which is moved to the directory of the input file. With the chunking operations, whether the body is the List of chunks instead of the ChunkDocumentResponse. The other docling-serve operations always return the content.

false

boolean

doclingServeUrl (common)

Base URL of the docling-serve API, used with useDoclingServe.

http://localhost:5001

String

enableOCR (common)

Whether to run OCR on the bitmap content of the documents, such as scanned pages. When false, the docling CLI gets --no-ocr and docling-serve gets do_ocr=false. When true, the docling CLI runs OCR, and docling-serve uses doOcr, ocrLanguage or its own default. The CamelDoclingEnableOCR header overrides it per message.

true

boolean

includeLayoutInfo (common)

Whether to pass --show-layout to the docling CLI, which draws the bounding boxes of the items on the page images. The docling CLI applies it only to the html_split_page output, which this component does not request. Not used with useDoclingServe.

false

boolean

ocrLanguage (common)

Language code for OCR processing. With the docling CLI, en is used when it is not set. With docling-serve, setting it turns OCR on (do_ocr=true) unless enableOCR or doOcr is false, and when it is not set the server uses its own default languages.

String

operation (common)

Required The operation to perform. The CamelDoclingOperation header overrides it per message.

Enum values:

  • CONVERT_TO_MARKDOWN

  • CONVERT_TO_HTML

  • CONVERT_TO_JSON

  • EXTRACT_TEXT

  • EXTRACT_STRUCTURED_DATA

  • SUBMIT_ASYNC_CONVERSION

  • CHECK_CONVERSION_STATUS

  • BATCH_CONVERT_TO_MARKDOWN

  • BATCH_CONVERT_TO_HTML

  • BATCH_CONVERT_TO_JSON

  • BATCH_EXTRACT_TEXT

  • BATCH_EXTRACT_STRUCTURED_DATA

  • EXTRACT_METADATA

  • CHUNK_HYBRID

  • CHUNK_HIERARCHICAL

CONVERT_TO_MARKDOWN

DoclingOperations

outputFormat (common)

Output format of the SUBMIT_ASYNC_CONVERSION operation; the other operations always use their own format. The html_split_page value is rejected, as docling-serve does not return the split pages; use html instead.

markdown

String

useDoclingServe (common)

Whether to call the docling-serve API at doclingServeUrl instead of running the docling CLI. The async, batch and chunking operations require it.

false

boolean

bridgeErrorHandler (consumer)

Allows for bridging the consumer to the Camel routing Error Handler, which mean any exceptions (if possible) occurred while the Camel consumer is trying to pickup incoming messages, or the likes, will now be processed as a message and handled by the routing Error Handler. Important: This is only possible if the 3rd party component allows Camel to be alerted if an exception was thrown. Some components handle this internally only, and therefore bridgeErrorHandler is not possible. In other situations we may improve the Camel component to hook into the 3rd party component and make this possible for future releases. By default the consumer will use the org.apache.camel.spi.ExceptionHandler to deal with exceptions, that will be logged at WARN or ERROR level and ignored.

false

boolean

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

abortOnError (advanced)

Whether docling-serve aborts the conversion on the first error. When not set, the server default applies. Used by the docling-serve conversions only.

Boolean

asyncPollInterval (advanced)

Interval in milliseconds between the status polls of an async docling-serve task, with useAsyncMode and SUBMIT_ASYNC_CONVERSION. It must be greater than 0.

2000

long

asyncTaskTtl (advanced)

Time in milliseconds that a task of SUBMIT_ASYNC_CONVERSION is kept in memory. A task that is older is cancelled and removed, and can no longer be checked or consumed. Only the value of the component configuration is used.

86400000

long

asyncTimeout (advanced)

Maximum time in milliseconds for an async docling-serve task to complete, with useAsyncMode and SUBMIT_ASYNC_CONVERSION. A task that takes longer fails. It must be greater than 0.

300000

long

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 configuring JDBC data sources, JMS connection factories, AWS Clients, etc.

true

boolean

doclingCommand (advanced)

The docling CLI command to run: a name found on the PATH, or the path of the executable. Not used with useDoclingServe.

String

doCodeEnrichment (advanced)

Whether docling-serve runs the code enrichment model on the code blocks. When not set, the server default applies. Used by the docling-serve conversions only.

Boolean

documentTimeout (advanced)

Timeout in seconds for docling-serve to process each document. When not set, the server default applies. Used by the docling-serve conversions only.

Long

doFormulaEnrichment (advanced)

Whether docling-serve recognizes the formulas and returns them as LaTeX. When not set, the server default applies. Used by the docling-serve conversions only.

Boolean

doOcr (advanced)

The do_ocr value sent to docling-serve. When not set, false is sent if enableOCR is false, true if ocrLanguage is set, and otherwise nothing, so the server default applies. Used by the docling-serve conversions only.

Boolean

doPictureClassification (advanced)

Whether docling-serve classifies the pictures of the documents. When not set, the server default applies. Used by the docling-serve conversions only.

Boolean

doPictureDescription (advanced)

Whether docling-serve describes the pictures of the documents with a vision-language model. When not set, the server default applies. Used by the docling-serve conversions only.

Boolean

doTableStructure (advanced)

Whether docling-serve extracts the structure of the tables. When not set, the server default applies, except EXTRACT_STRUCTURED_DATA and BATCH_EXTRACT_STRUCTURED_DATA, which send true. Used by the docling-serve conversions only.

Boolean

forceOcr (advanced)

Whether docling-serve replaces the existing text of the documents with the text from OCR (force_ocr). When not set, the server default applies. Used by the docling-serve conversions only.

Boolean

imageExportMode (advanced)

How docling-serve puts the images in the Markdown, HTML or JSON output: EMBEDDED, PLACEHOLDER or REFERENCED. When not set, the server default applies. Used by the docling-serve conversions only.

String

imagesScale (advanced)

Scale factor of the images that docling-serve exports. When not set, the server default applies. Used by the docling-serve conversions only.

Double

includeImages (advanced)

Whether docling-serve extracts the images of the documents. When not set, the server default applies. Used by the docling-serve conversions only.

Boolean

mdPageBreakPlaceholder (advanced)

Text that docling-serve puts between the pages of the Markdown output. Used by the docling-serve conversions only.

String

ocrEngine (advanced)

The OCR engine of docling-serve. When not set, the server default applies. Used by the docling-serve conversions only.

String

pdfBackend (advanced)

The backend docling-serve uses to parse PDF files. When not set, the server default applies. Used by the docling-serve conversions only.

String

pipeline (advanced)

The pipeline docling-serve uses to process the documents: STANDARD, VLM (vision-language model) or ASR (speech recognition for audio). When not set, the server default applies. Used by the docling-serve conversions only.

String

processTimeout (advanced)

Timeout in milliseconds. With the docling CLI, the time to wait for the process to exit before it is killed. With docling-serve, the read timeout of each HTTP request, which also bounds a sync conversion; it must be greater than 0.

30000

long

tableCellMatching (advanced)

Whether docling-serve matches the predicted table cells back to the cells of the PDF. When false, the table structure model defines the text cells. When not set, the server default applies. Used by the docling-serve conversions only.

Boolean

tableMode (advanced)

The mode of the TableFormer model that recognizes the table structure: ACCURATE or FAST. When not set, the server default applies. Used by the docling-serve conversions only.

String

useAsyncMode (advanced)

Whether the conversions use the async API of docling-serve: the task is submitted, its status is polled every asyncPollInterval, and the producer waits for the result up to asyncTimeout. Applies to the conversion and batch operations, not to EXTRACT_METADATA and the chunking operations. The CamelDoclingUseAsyncMode header overrides it per message.

false

boolean

workingDirectory (advanced)

Working directory of the docling CLI process. When not set, the process runs in the working directory of the JVM. Not used with useDoclingServe.

String

batchFailOnFirstError (batch)

Whether the batch stops at the first failed document: the documents not started yet are skipped and the exchange fails. When false, all documents are converted and the failures are in the results. The CamelDoclingBatchFailOnFirstError header overrides it per message.

true

boolean

batchParallelism (batch)

Number of threads that convert the documents of a batch in parallel. The CamelDoclingBatchParallelism header overrides it per message.

4

int

batchSize (batch)

Number of documents to submit per sub-batch. Documents are partitioned into sub-batches of this size and each sub-batch is processed before starting the next one. Within each sub-batch, up to batchParallelism threads are used concurrently. This controls memory usage and back-pressure when processing large document sets.

10

int

batchTimeout (batch)

Maximum time in milliseconds for the whole batch, across all its sub-batches. When it is exceeded, the pending documents are cancelled and the exchange fails. The CamelDoclingBatchTimeout header overrides it per message.

300000

long

splitBatchResults (batch)

Whether the body of a batch operation is a List of BatchConversionResult, one per document, to use with the Split EIP, instead of a single BatchProcessingResults. The CamelDoclingBatchSplitResults header overrides it per message.

false

boolean

chunkingIncludeRawText (chunking)

Whether each chunk of the chunking operations also holds raw_text, the text without the context of its headings, besides text.

false

Boolean

chunkingMaxTokens (chunking)

Maximum number of tokens per chunk of CHUNK_HYBRID. When not set, the server takes it from the tokenizer. The CamelDoclingChunkingMaxTokens header overrides it per message.

Integer

chunkingMergePeers (chunking)

Whether CHUNK_HYBRID merges undersized successive chunks that have the same headings. When not set, nothing is sent and the server default (true) applies. The CamelDoclingChunkingMergePeers header overrides it per message.

true

Boolean

chunkingTokenizer (chunking)

Hugging Face model whose tokenizer CHUNK_HYBRID uses to count tokens. When not set, the server uses sentence-transformers/all-MiniLM-L6-v2. The CamelDoclingChunkingTokenizer header overrides it per message.

String

chunkingUseMarkdownTables (chunking)

Whether the chunking operations serialize the tables in Markdown instead of as triplets.

false

Boolean

includeMetadataInHeaders (metadata)

Whether EXTRACT_METADATA also sets the extracted fields as CamelDoclingMetadata headers.

true

boolean

includeRawMetadata (metadata)

Whether EXTRACT_METADATA also returns the whole Docling document as a Map, in the rawMetadata of the DocumentMetadata and, with includeMetadataInHeaders, in the CamelDoclingMetadataRaw header.

false

boolean

allowFilePathSource (security)

Whether a String message body that starts with / or contains \ is interpreted as a local filesystem path to read. When disabled, such a body is rejected instead of being read. This does not affect the CamelDoclingInputFilePath header, nor File, byte[] or explicit path collection bodies used by the batch operations.

false

boolean

allowUrlSource (security)

Whether a String message body that starts with http:// or https:// is interpreted as a remote URL for Docling to fetch. When disabled, such a body is rejected instead of being fetched. This does not affect the CamelDoclingInputFilePath header, nor bodies of any other type.

false

boolean

apiKeyHeader (security)

Deprecated Header name for API key authentication. Deprecation note: Not used: the docling-serve client always sends the API key in the X-Api-Key header.

X-Api-Key

String

authenticationScheme (security)

How authenticationToken is sent to docling-serve: BEARER in the Authorization header, API_KEY in the X-Api-Key header, or NONE to send no token.

Enum values:

  • NONE

  • BEARER

  • API_KEY

NONE

AuthenticationScheme

authenticationToken (security)

The token sent to docling-serve: in the Authorization header as a Bearer token with authenticationScheme BEARER, or in the X-Api-Key header with API_KEY. It is not sent with NONE.

String

inputBaseDirectory (security)

When set, every local input file path must resolve inside this directory once normalized. Applies to the CamelDoclingInputFilePath header, to file path message bodies, and to the paths used by the batch operations. When empty, no directory restriction is applied.

String

maxFileSize (security)

Maximum file size in bytes for processing.

52428800

long

oauthProfile (security)

OAuth profile name for obtaining an access token via the OAuth 2.0 Client Credentials grant. When set, the token is acquired from the configured identity provider for each request and sent to docling-serve in the Authorization header as a Bearer token, whatever authenticationScheme is. Requires camel-oauth on the classpath.

String

outputBaseDirectory (security)

When set, the output directory passed to the docling CLI must resolve inside this directory once normalized. Applies to the CamelDoclingOutputFilePath header. The check is lexical and does not resolve symbolic links, matching inputBaseDirectory. When empty, the header value must be a relative path that does not leave the working directory once normalized; set this option to use absolute output directories.

String

Endpoint Options

The Docling endpoint is configured using URI syntax:

docling:operationId

With the following path and query parameters:

Path Parameters

Name Description Default Type

operationId (common)

Required The name of the operation, such as CONVERT_TO_MARKDOWN. When it is one of the operation values, it sets the operation unless the operation option is given; any other value is only a name.

String

Query Parameters

Name Description Default Type

contentInBody (common)

With the docling CLI, whether the message body is the content of the output file, which is then deleted. When false, the body is the path of the output file, which is moved to the directory of the input file. With the chunking operations, whether the body is the List of chunks instead of the ChunkDocumentResponse. The other docling-serve operations always return the content.

false

boolean

doclingServeUrl (common)

Base URL of the docling-serve API, used with useDoclingServe.

http://localhost:5001

String

enableOCR (common)

Whether to run OCR on the bitmap content of the documents, such as scanned pages. When false, the docling CLI gets --no-ocr and docling-serve gets do_ocr=false. When true, the docling CLI runs OCR, and docling-serve uses doOcr, ocrLanguage or its own default. The CamelDoclingEnableOCR header overrides it per message.

true

boolean

includeLayoutInfo (common)

Whether to pass --show-layout to the docling CLI, which draws the bounding boxes of the items on the page images. The docling CLI applies it only to the html_split_page output, which this component does not request. Not used with useDoclingServe.

false

boolean

ocrLanguage (common)

Language code for OCR processing. With the docling CLI, en is used when it is not set. With docling-serve, setting it turns OCR on (do_ocr=true) unless enableOCR or doOcr is false, and when it is not set the server uses its own default languages.

String

operation (common)

Required The operation to perform. The CamelDoclingOperation header overrides it per message.

Enum values:

  • CONVERT_TO_MARKDOWN

  • CONVERT_TO_HTML

  • CONVERT_TO_JSON

  • EXTRACT_TEXT

  • EXTRACT_STRUCTURED_DATA

  • SUBMIT_ASYNC_CONVERSION

  • CHECK_CONVERSION_STATUS

  • BATCH_CONVERT_TO_MARKDOWN

  • BATCH_CONVERT_TO_HTML

  • BATCH_CONVERT_TO_JSON

  • BATCH_EXTRACT_TEXT

  • BATCH_EXTRACT_STRUCTURED_DATA

  • EXTRACT_METADATA

  • CHUNK_HYBRID

  • CHUNK_HIERARCHICAL

CONVERT_TO_MARKDOWN

DoclingOperations

outputFormat (common)

Output format of the SUBMIT_ASYNC_CONVERSION operation; the other operations always use their own format. The html_split_page value is rejected, as docling-serve does not return the split pages; use html instead.

markdown

String

useDoclingServe (common)

Whether to call the docling-serve API at doclingServeUrl instead of running the docling CLI. The async, batch and chunking operations require it.

false

boolean

sendEmptyMessageWhenIdle (consumer)

If the polling consumer did not poll any files, you can enable this option to send an empty message (no body) instead.

false

boolean

bridgeErrorHandler (consumer (advanced))

Allows for bridging the consumer to the Camel routing Error Handler, which mean any exceptions (if possible) occurred while the Camel consumer is trying to pickup incoming messages, or the likes, will now be processed as a message and handled by the routing Error Handler. Important: This is only possible if the 3rd party component allows Camel to be alerted if an exception was thrown. Some components handle this internally only, and therefore bridgeErrorHandler is not possible. In other situations we may improve the Camel component to hook into the 3rd party component and make this possible for future releases. By default the consumer will use the org.apache.camel.spi.ExceptionHandler to deal with exceptions, that will be logged at WARN or ERROR level and ignored.

false

boolean

exceptionHandler (consumer (advanced))

To let the consumer use a custom ExceptionHandler. Notice if the option bridgeErrorHandler is enabled then this option is not in use. By default the consumer will deal with exceptions, that will be logged at WARN or ERROR level and ignored.

ExceptionHandler

exchangePattern (consumer (advanced))

Sets the exchange pattern when the consumer creates an exchange.

Enum values:

  • InOnly

  • InOut

ExchangePattern

pollStrategy (consumer (advanced))

A pluggable org.apache.camel.PollingConsumerPollingStrategy allowing you to provide your custom implementation to control error handling usually occurred during the poll operation before an Exchange have been created and being routed in Camel.

PollingConsumerPollStrategy

lazyStartProducer (producer (advanced))

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

abortOnError (advanced)

Whether docling-serve aborts the conversion on the first error. When not set, the server default applies. Used by the docling-serve conversions only.

Boolean

asyncPollInterval (advanced)

Interval in milliseconds between the status polls of an async docling-serve task, with useAsyncMode and SUBMIT_ASYNC_CONVERSION. It must be greater than 0.

2000

long

asyncTaskTtl (advanced)

Time in milliseconds that a task of SUBMIT_ASYNC_CONVERSION is kept in memory. A task that is older is cancelled and removed, and can no longer be checked or consumed. Only the value of the component configuration is used.

86400000

long

asyncTimeout (advanced)

Maximum time in milliseconds for an async docling-serve task to complete, with useAsyncMode and SUBMIT_ASYNC_CONVERSION. A task that takes longer fails. It must be greater than 0.

300000

long

doclingCommand (advanced)

The docling CLI command to run: a name found on the PATH, or the path of the executable. Not used with useDoclingServe.

String

doCodeEnrichment (advanced)

Whether docling-serve runs the code enrichment model on the code blocks. When not set, the server default applies. Used by the docling-serve conversions only.

Boolean

documentTimeout (advanced)

Timeout in seconds for docling-serve to process each document. When not set, the server default applies. Used by the docling-serve conversions only.

Long

doFormulaEnrichment (advanced)

Whether docling-serve recognizes the formulas and returns them as LaTeX. When not set, the server default applies. Used by the docling-serve conversions only.

Boolean

doOcr (advanced)

The do_ocr value sent to docling-serve. When not set, false is sent if enableOCR is false, true if ocrLanguage is set, and otherwise nothing, so the server default applies. Used by the docling-serve conversions only.

Boolean

doPictureClassification (advanced)

Whether docling-serve classifies the pictures of the documents. When not set, the server default applies. Used by the docling-serve conversions only.

Boolean

doPictureDescription (advanced)

Whether docling-serve describes the pictures of the documents with a vision-language model. When not set, the server default applies. Used by the docling-serve conversions only.

Boolean

doTableStructure (advanced)

Whether docling-serve extracts the structure of the tables. When not set, the server default applies, except EXTRACT_STRUCTURED_DATA and BATCH_EXTRACT_STRUCTURED_DATA, which send true. Used by the docling-serve conversions only.

Boolean

forceOcr (advanced)

Whether docling-serve replaces the existing text of the documents with the text from OCR (force_ocr). When not set, the server default applies. Used by the docling-serve conversions only.

Boolean

imageExportMode (advanced)

How docling-serve puts the images in the Markdown, HTML or JSON output: EMBEDDED, PLACEHOLDER or REFERENCED. When not set, the server default applies. Used by the docling-serve conversions only.

String

imagesScale (advanced)

Scale factor of the images that docling-serve exports. When not set, the server default applies. Used by the docling-serve conversions only.

Double

includeImages (advanced)

Whether docling-serve extracts the images of the documents. When not set, the server default applies. Used by the docling-serve conversions only.

Boolean

mdPageBreakPlaceholder (advanced)

Text that docling-serve puts between the pages of the Markdown output. Used by the docling-serve conversions only.

String

ocrEngine (advanced)

The OCR engine of docling-serve. When not set, the server default applies. Used by the docling-serve conversions only.

String

pdfBackend (advanced)

The backend docling-serve uses to parse PDF files. When not set, the server default applies. Used by the docling-serve conversions only.

String

pipeline (advanced)

The pipeline docling-serve uses to process the documents: STANDARD, VLM (vision-language model) or ASR (speech recognition for audio). When not set, the server default applies. Used by the docling-serve conversions only.

String

processTimeout (advanced)

Timeout in milliseconds. With the docling CLI, the time to wait for the process to exit before it is killed. With docling-serve, the read timeout of each HTTP request, which also bounds a sync conversion; it must be greater than 0.

30000

long

tableCellMatching (advanced)

Whether docling-serve matches the predicted table cells back to the cells of the PDF. When false, the table structure model defines the text cells. When not set, the server default applies. Used by the docling-serve conversions only.

Boolean

tableMode (advanced)

The mode of the TableFormer model that recognizes the table structure: ACCURATE or FAST. When not set, the server default applies. Used by the docling-serve conversions only.

String

useAsyncMode (advanced)

Whether the conversions use the async API of docling-serve: the task is submitted, its status is polled every asyncPollInterval, and the producer waits for the result up to asyncTimeout. Applies to the conversion and batch operations, not to EXTRACT_METADATA and the chunking operations. The CamelDoclingUseAsyncMode header overrides it per message.

false

boolean

workingDirectory (advanced)

Working directory of the docling CLI process. When not set, the process runs in the working directory of the JVM. Not used with useDoclingServe.

String

batchFailOnFirstError (batch)

Whether the batch stops at the first failed document: the documents not started yet are skipped and the exchange fails. When false, all documents are converted and the failures are in the results. The CamelDoclingBatchFailOnFirstError header overrides it per message.

true

boolean

batchParallelism (batch)

Number of threads that convert the documents of a batch in parallel. The CamelDoclingBatchParallelism header overrides it per message.

4

int

batchSize (batch)

Number of documents to submit per sub-batch. Documents are partitioned into sub-batches of this size and each sub-batch is processed before starting the next one. Within each sub-batch, up to batchParallelism threads are used concurrently. This controls memory usage and back-pressure when processing large document sets.

10

int

batchTimeout (batch)

Maximum time in milliseconds for the whole batch, across all its sub-batches. When it is exceeded, the pending documents are cancelled and the exchange fails. The CamelDoclingBatchTimeout header overrides it per message.

300000

long

splitBatchResults (batch)

Whether the body of a batch operation is a List of BatchConversionResult, one per document, to use with the Split EIP, instead of a single BatchProcessingResults. The CamelDoclingBatchSplitResults header overrides it per message.

false

boolean

chunkingIncludeRawText (chunking)

Whether each chunk of the chunking operations also holds raw_text, the text without the context of its headings, besides text.

false

Boolean

chunkingMaxTokens (chunking)

Maximum number of tokens per chunk of CHUNK_HYBRID. When not set, the server takes it from the tokenizer. The CamelDoclingChunkingMaxTokens header overrides it per message.

Integer

chunkingMergePeers (chunking)

Whether CHUNK_HYBRID merges undersized successive chunks that have the same headings. When not set, nothing is sent and the server default (true) applies. The CamelDoclingChunkingMergePeers header overrides it per message.

true

Boolean

chunkingTokenizer (chunking)

Hugging Face model whose tokenizer CHUNK_HYBRID uses to count tokens. When not set, the server uses sentence-transformers/all-MiniLM-L6-v2. The CamelDoclingChunkingTokenizer header overrides it per message.

String

chunkingUseMarkdownTables (chunking)

Whether the chunking operations serialize the tables in Markdown instead of as triplets.

false

Boolean

includeMetadataInHeaders (metadata)

Whether EXTRACT_METADATA also sets the extracted fields as CamelDoclingMetadata headers.

true

boolean

includeRawMetadata (metadata)

Whether EXTRACT_METADATA also returns the whole Docling document as a Map, in the rawMetadata of the DocumentMetadata and, with includeMetadataInHeaders, in the CamelDoclingMetadataRaw header.

false

boolean

backoffErrorThreshold (scheduler)

The number of subsequent error polls (failed due some error) that should happen before the backoffMultipler should kick-in.

int

backoffIdleThreshold (scheduler)

The number of subsequent idle polls that should happen before the backoffMultipler should kick-in.

int

backoffMultiplier (scheduler)

To let the scheduled polling consumer backoff if there has been a number of subsequent idles/errors in a row. The multiplier is then the number of polls that will be skipped before the next actual attempt is happening again. When this option is in use then backoffIdleThreshold and/or backoffErrorThreshold must also be configured.

int

delay (scheduler)

Milliseconds before the next poll.

500

long

greedy (scheduler)

If greedy is enabled, then the ScheduledPollConsumer will run immediately again, if the previous run polled 1 or more messages.

false

boolean

healthCheckMaxPollDuration (scheduler)

How long a poll may run before the health check of the consumer reports DOWN. The health check is otherwise based on the polls that are done, so it stays UP while a poll hangs, for example on a read without timeout from a connection that went silent. A poll includes routing the messages it polled, so set this above the longest poll you expect. The poll is not interrupted. The value is in millis (not affected by timeUnit). The default 0 turns this off.

0

long

initialDelay (scheduler)

Milliseconds before the first poll starts.

1000

long

repeatCount (scheduler)

Specifies a maximum limit of number of fires. So if you set it to 1, the scheduler will only fire once. If you set it to 5, it will only fire five times. A value of zero or negative means fire forever.

0

long

runLoggingLevel (scheduler)

The consumer logs a start/complete log line when it polls. This option allows you to configure the logging level for that.

Enum values:

  • TRACE

  • DEBUG

  • INFO

  • WARN

  • ERROR

  • OFF

TRACE

LoggingLevel

scheduledExecutorService (scheduler)

Allows for configuring a custom/shared thread pool to use for the consumer. By default each consumer has its own single threaded thread pool.

ScheduledExecutorService

scheduler (scheduler)

To use a cron scheduler from either camel-spring or camel-quartz component. Use value spring or quartz for built in scheduler.

none

Object

schedulerProperties (scheduler)

To configure additional properties when using a custom scheduler or any of the Quartz, Spring based scheduler. This is a multi-value option with prefix: scheduler.

Map

startScheduler (scheduler)

Whether the scheduler should be auto started.

true

boolean

timeUnit (scheduler)

Time unit for initialDelay and delay options.

Enum values:

  • NANOSECONDS

  • MICROSECONDS

  • MILLISECONDS

  • SECONDS

  • MINUTES

  • HOURS

  • DAYS

MILLISECONDS

TimeUnit

useFixedDelay (scheduler)

Controls if fixed delay or fixed rate is used. See ScheduledExecutorService in JDK for details.

true

boolean

allowFilePathSource (security)

Whether a String message body that starts with / or contains \ is interpreted as a local filesystem path to read. When disabled, such a body is rejected instead of being read. This does not affect the CamelDoclingInputFilePath header, nor File, byte[] or explicit path collection bodies used by the batch operations.

false

boolean

allowUrlSource (security)

Whether a String message body that starts with http:// or https:// is interpreted as a remote URL for Docling to fetch. When disabled, such a body is rejected instead of being fetched. This does not affect the CamelDoclingInputFilePath header, nor bodies of any other type.

false

boolean

apiKeyHeader (security)

Deprecated Header name for API key authentication. Deprecation note: Not used: the docling-serve client always sends the API key in the X-Api-Key header.

X-Api-Key

String

authenticationScheme (security)

How authenticationToken is sent to docling-serve: BEARER in the Authorization header, API_KEY in the X-Api-Key header, or NONE to send no token.

Enum values:

  • NONE

  • BEARER

  • API_KEY

NONE

AuthenticationScheme

authenticationToken (security)

The token sent to docling-serve: in the Authorization header as a Bearer token with authenticationScheme BEARER, or in the X-Api-Key header with API_KEY. It is not sent with NONE.

String

inputBaseDirectory (security)

When set, every local input file path must resolve inside this directory once normalized. Applies to the CamelDoclingInputFilePath header, to file path message bodies, and to the paths used by the batch operations. When empty, no directory restriction is applied.

String

maxFileSize (security)

Maximum file size in bytes for processing.

52428800

long

oauthProfile (security)

OAuth profile name for obtaining an access token via the OAuth 2.0 Client Credentials grant. When set, the token is acquired from the configured identity provider for each request and sent to docling-serve in the Authorization header as a Bearer token, whatever authenticationScheme is. Requires camel-oauth on the classpath.

String

outputBaseDirectory (security)

When set, the output directory passed to the docling CLI must resolve inside this directory once normalized. Applies to the CamelDoclingOutputFilePath header. The check is lexical and does not resolve symbolic links, matching inputBaseDirectory. When empty, the header value must be a relative path that does not leave the working directory once normalized; set this option to use absolute output directories.

String

Message Headers

The Docling component supports the following message header(s), which is/are listed below:

Name Description Default Type

CamelDoclingOperation (common)

Constant: OPERATION

The operation to perform, overriding the operation option.

Enum values:

  • CONVERT_TO_MARKDOWN

  • CONVERT_TO_HTML

  • CONVERT_TO_JSON

  • EXTRACT_TEXT

  • EXTRACT_STRUCTURED_DATA

  • SUBMIT_ASYNC_CONVERSION

  • CHECK_CONVERSION_STATUS

  • BATCH_CONVERT_TO_MARKDOWN

  • BATCH_CONVERT_TO_HTML

  • BATCH_CONVERT_TO_JSON

  • BATCH_EXTRACT_TEXT

  • BATCH_EXTRACT_STRUCTURED_DATA

  • EXTRACT_METADATA

  • CHUNK_HYBRID

  • CHUNK_HIERARCHICAL

DoclingOperations

CamelDoclingOutputFormat (common)

Constant: OUTPUT_FORMAT

The output format of SUBMIT_ASYNC_CONVERSION, overriding the outputFormat option.

String

CamelDoclingInputFilePath (common)

Constant: INPUT_FILE_PATH

The input file path of the document. When it is set, the message body is not read.

String

CamelDoclingOutputFilePath (common)

Constant: OUTPUT_FILE_PATH

The output file path for saving the result.

String

CamelDoclingProcessingOptions (common)

Constant: PROCESSING_OPTIONS

Not used by the component.

Map

CamelDoclingEnableOCR (common)

Constant: ENABLE_OCR

Whether to run OCR on this message, overriding the enableOCR option.

Boolean

CamelDoclingOCRLanguage (common)

Constant: OCR_LANGUAGE

The OCR language of this message, overriding the ocrLanguage option. With docling-serve, it also turns OCR on unless OCR is turned off.

String

CamelDoclingCustomArguments (common)

Constant: CUSTOM_ARGUMENTS

Custom command line arguments to pass to the docling CLI. Not used with docling-serve.

List

CamelDoclingUseAsyncMode (common)

Constant: USE_ASYNC_MODE

Whether to use the async API of docling-serve for this message, overriding the useAsyncMode option.

Boolean

CamelDoclingAsyncPollInterval (common)

Constant: ASYNC_POLL_INTERVAL

Not used by the component: the asyncPollInterval option applies.

Long

CamelDoclingAsyncTimeout (common)

Constant: ASYNC_TIMEOUT

Not used by the component: the asyncTimeout option applies.

Long

CamelDoclingTaskId (common)

Constant: TASK_ID

The id of an async conversion task. SUBMIT_ASYNC_CONVERSION and the consumer set it, and CHECK_CONVERSION_STATUS reads it, or the message body when it is not set.

String

CamelDoclingBatchSize (common)

Constant: BATCH_SIZE

The number of documents per sub-batch of this message, overriding the batchSize option.

Integer

CamelDoclingBatchParallelism (common)

Constant: BATCH_PARALLELISM

The number of threads of the batch of this message, overriding the batchParallelism option.

Integer

CamelDoclingBatchFailOnFirstError (common)

Constant: BATCH_FAIL_ON_FIRST_ERROR

Whether the batch of this message stops at the first failed document, overriding the batchFailOnFirstError option.

Boolean

CamelDoclingBatchTimeout (common)

Constant: BATCH_TIMEOUT

The timeout in milliseconds of the batch of this message, overriding the batchTimeout option.

Long

CamelDoclingBatchTotalDocuments (common)

Constant: BATCH_TOTAL_DOCUMENTS

Total number of documents in the batch.

Integer

CamelDoclingBatchSuccessCount (common)

Constant: BATCH_SUCCESS_COUNT

Number of successfully processed documents in the batch.

Integer

CamelDoclingBatchFailureCount (common)

Constant: BATCH_FAILURE_COUNT

Number of failed documents in the batch.

Integer

CamelDoclingBatchProcessingTime (common)

Constant: BATCH_PROCESSING_TIME

Total processing time for the batch in milliseconds.

Long

CamelDoclingBatchSplitResults (common)

Constant: BATCH_SPLIT_RESULTS

Whether the body of the batch of this message is a List of BatchConversionResult, overriding the splitBatchResults option.

Boolean

CamelDoclingMetadataPageCount (common)

Constant: METADATA_PAGE_COUNT

Number of pages in the document.

Integer

CamelDoclingMetadataTitle (common)

Constant: METADATA_TITLE

The title of the document: its first text labelled as a title.

String

CamelDoclingMetadataLanguage (common)

Constant: METADATA_LANGUAGE

Not set by the component.

String

CamelDoclingMetadataDocumentType (common)

Constant: METADATA_DOCUMENT_TYPE

The type of the document in upper case, such as PDF or DOCX: the extension of its file name, or else the subtype of its MIME type.

String

CamelDoclingMetadataFormat (common)

Constant: METADATA_FORMAT

The MIME type of the document.

String

CamelDoclingMetadataFileSize (common)

Constant: METADATA_FILE_SIZE

The size in bytes of the input file, when it is a local file.

Long

CamelDoclingMetadataFileName (common)

Constant: METADATA_FILE_NAME

The name of the input file, when it is a local file.

String

CamelDoclingMetadataRaw (common)

Constant: METADATA_RAW

The whole Docling document as a Map, with the includeRawMetadata option.

Map

CamelDoclingChunkingTokenizer (common)

Constant: CHUNKING_TOKENIZER

The tokenizer model of CHUNK_HYBRID for this message, overriding the chunkingTokenizer option.

String

CamelDoclingChunkingMaxTokens (common)

Constant: CHUNKING_MAX_TOKENS

The maximum number of tokens per chunk of CHUNK_HYBRID for this message, overriding the chunkingMaxTokens option.

Integer

CamelDoclingChunkingMergePeers (common)

Constant: CHUNKING_MERGE_PEERS

Whether CHUNK_HYBRID merges undersized peer chunks for this message, overriding the chunkingMergePeers option.

Boolean

CamelDoclingTaskStatus (common)

Constant: TASK_STATUS

Status of the async conversion task checked by CHECK_CONVERSION_STATUS: PENDING, IN_PROGRESS, COMPLETED, FAILED or UNKNOWN.

String

CamelDoclingTaskProgress (common)

Constant: TASK_PROGRESS

Progress of the async conversion task, when the server reports one.

Integer

CamelDoclingResult (common)

Constant: TASK_RESULT

The converted document of a completed async conversion task.

String

CamelDoclingErrorMessage (common)

Constant: TASK_ERROR_MESSAGE

The error message of a failed async conversion task.

String

Message Body

The message body at each side of the Docling component: Consumer is the body of the messages the consumer creates, Consumer reply the bodies a consumer that answers its caller can reply with, Producer input the bodies the producer can send or write, and Producer output the body after the producer.

Side Body Description

Consumer

text

The document of an async conversion that completed (SUBMIT_ASYNC_CONVERSION on the same component), as text in the outputFormat it was submitted with: markdown by default, JSON text for json. The task id is in the CamelDoclingTaskId header, and a failed conversion goes to the error handler.

Producer input

any

The document: its content as text, bytes or a stream, or a File (the GenericFile of the file consumers too). A Path fails: convert it to bytes first. Text that looks like a URL or a path (it starts with http://, https:// or /, or has a backslash) is read as one only with allowUrlSource or allowFilePathSource, and fails otherwise. With the CamelDoclingInputFilePath header the body is not read. The batch operations take a List or an array of paths or files (a directory path with allowFilePathSource), and CHECK_CONVERSION_STATUS the task id, unless the CamelDoclingTaskId header gives it.

  • With operation=BATCH_CONVERT_TO_MARKDOWN: list

  • With operation=BATCH_CONVERT_TO_HTML: list

  • With operation=BATCH_CONVERT_TO_JSON: list

  • With operation=BATCH_EXTRACT_TEXT: list

  • With operation=BATCH_EXTRACT_STRUCTURED_DATA: list

Producer output

text

By the operation: text for the conversions to markdown, HTML and text, which with the docling CLI is the path of the output file unless contentInBody (useDoclingServe gives the content); the task id for SUBMIT_ASYNC_CONVERSION; a DoclingDocument for CONVERT_TO_JSON and EXTRACT_STRUCTURED_DATA; a BatchProcessingResults for the batch operations, a List of BatchConversionResult with splitBatchResults; and a ChunkDocumentResponse for the chunking, a List of Chunk with contentInBody.

  • With operation=CONVERT_TO_JSON: pojo (ai.docling.core.DoclingDocument)

  • With operation=EXTRACT_STRUCTURED_DATA: pojo (ai.docling.core.DoclingDocument)

  • With operation=CHECK_CONVERSION_STATUS: pojo (org.apache.camel.component.docling.ConversionStatus)

  • With operation=EXTRACT_METADATA: pojo (org.apache.camel.component.docling.DocumentMetadata)

  • With operation=BATCH_CONVERT_TO_MARKDOWN: pojo or list

  • With operation=BATCH_CONVERT_TO_HTML: pojo or list

  • With operation=BATCH_CONVERT_TO_JSON: pojo or list

  • With operation=BATCH_EXTRACT_TEXT: pojo or list

  • With operation=BATCH_EXTRACT_STRUCTURED_DATA: pojo or list

  • With operation=CHUNK_HYBRID: pojo or list

  • With operation=CHUNK_HIERARCHICAL: pojo or list

The bodies are the ones with the default options. A side that is not listed is not known, and tooling does not guess it. The carriers, the sides and the tools that use them are described in Message Body Types.

Usage

Input Types

The component accepts the following input types in the message body:

  • String - Document content. It is only read as a location when the endpoint opts in - see Input Sources below

  • byte[] - Binary document content, written to a temporary file

  • File - File object

  • InputStream - Input stream containing document data, such as the stream body of an HTTP or FTP consumer, or the stream cache that stream caching makes of a stream. It is written to a temporary file as a byte[] is; a stream cache is reset afterwards, so the route can read it again.

A byte[] or InputStream body larger than maxFileSize, and a File larger than it, is rejected.

For the batch operations the body may also be a List<String> or String[] of file paths, a List<File> or File[], or a single directory path String.

Input Sources

A String body is ambiguous: it could be the document itself, a URL to fetch, or a path to read. By default the component treats it as the document, and the two location readings must be enabled explicitly:

Option Default Effect when enabled

allowUrlSource

false

A body starting with http:// or https:// is handed to Docling as a remote URL to fetch.

allowFilePathSource

false

A body starting with /, or containing \, is read from the local filesystem. This also covers the single directory-or-file String body accepted by the batch operations.

inputBaseDirectory

(none)

When set, every local input path must resolve inside this directory once normalized. Applies to the CamelDoclingInputFilePath header, to file path bodies, and to the paths used by the batch operations.

outputBaseDirectory

(none)

When set, the output directory passed to the docling CLI must resolve inside this directory once normalized. Applies to the CamelDoclingOutputFilePath header. When not set, that header must be a relative path.

With both options left at their defaults, a body that is neither a URL nor a path is written to a temporary file and converted as document content, exactly as before.

The CamelDoclingInputFilePath header is an explicit "the document lives here" signal from the route, so it keeps working without allowFilePathSource. It is still subject to inputBaseDirectory when one is set. Typed bodies - File, byte[], InputStream, and the explicit path collections used by the batch operations - are unambiguous and are likewise unaffected.

The CamelDoclingOutputFilePath header, which selects the CLI --output directory, is normalized lexically and then checked:

  • With outputBaseDirectory set, a relative value is resolved against that directory, and the result must stay inside it. An absolute value is accepted when it is inside the directory.

  • With outputBaseDirectory unset, the value must be a relative path that does not start with ../ once normalized, the same rule as for the custom arguments. It resolves against the CLI working directory. To use absolute output directories, set outputBaseDirectory to a directory that contains them.

The checks are lexical and do not resolve symbolic links (as with inputBaseDirectory).

// the body is the document itself - no opt-in needed
from("direct:content")
    .to("docling:convert?operation=CONVERT_TO_MARKDOWN");

// the body is a path, confined to /var/docs
from("direct:paths")
    .to("docling:convert?operation=CONVERT_TO_MARKDOWN&allowFilePathSource=true&inputBaseDirectory=/var/docs");

Output Behavior

The component behavior depends on the contentInBody configuration option:

  • When contentInBody=true (default: false): The converted content is placed in the exchange body and the output file is automatically deleted

  • When contentInBody=false: The file path to the generated output file is returned in the exchange body

Examples

Basic document conversion to Markdown

  • Java

  • YAML

from("file:///data/documents?include=.*\\.pdf")
    .to("docling:CONVERT_TO_MARKDOWN")
    .to("file:///data/output");
- route:
    from:
      uri: file:///data/documents
      parameters:
        include: ".*\\.pdf"
      steps:
        - to:
            uri: docling:CONVERT_TO_MARKDOWN
        - to:
            uri: file:///data/output

Convert to HTML with content in body

  • Java

  • YAML

from("file:///data/documents?include=.*\\.pdf")
    .to("docling:CONVERT_TO_HTML?contentInBody=true")
    .process(exchange -> {
        String htmlContent = exchange.getIn().getBody(String.class);
        // Process the HTML content
    });
- route:
    from:
      uri: file:///data/documents
      parameters:
        include: ".*\\.pdf"
      steps:
        - to:
            uri: docling:CONVERT_TO_HTML
            parameters:
              contentInBody: true
        - process:
            ref: "htmlProcessor"

Extract structured data from documents

When using docling-serve API mode, EXTRACT_STRUCTURED_DATA returns a DoclingDocument object with table structure recognition enabled by default. In CLI mode, the JSON output is parsed into a DoclingDocument.

  • Java

  • YAML

from("file:///data/documents?include=.*\\.pdf")
    .to("docling:EXTRACT_STRUCTURED_DATA?useDoclingServe=true&contentInBody=true")
    .process(exchange -> {
        DoclingDocument doc = exchange.getIn().getBody(DoclingDocument.class);

        // Access tables extracted from the document
        List<DoclingDocument.TableItem> tables = doc.getTables();
        for (DoclingDocument.TableItem table : tables) {
            DoclingDocument.TableData data = table.getData();
            log.info("Table: {}x{}", data.getNumRows(), data.getNumCols());
        }
    });
- route:
    from:
      uri: file:///data/documents
      parameters:
        include: ".*\\.pdf"
      steps:
        - to:
            uri: docling:EXTRACT_STRUCTURED_DATA
            parameters:
              useDoclingServe: true
              contentInBody: true
        - process:
            ref: "structuredDataProcessor"

Convert with OCR disabled

In CLI mode, use enableOCR=false. In API mode, setting enableOCR=false sends doOcr(false) to the server. You can also use the doOcr property directly for API mode control.

  • Java

  • YAML

// CLI mode
from("file:///data/documents?include=.*\\.pdf")
    .to("docling:CONVERT_TO_MARKDOWN?enableOCR=false")
    .to("file:///data/output");

// API mode
from("file:///data/documents?include=.*\\.pdf")
    .to("docling:CONVERT_TO_MARKDOWN?useDoclingServe=true&doOcr=false&contentInBody=true")
    .to("file:///data/output");
# CLI mode
- route:
    from:
      uri: file:///data/documents
      parameters:
        include: ".*\\.pdf"
      steps:
        - to:
            uri: docling:CONVERT_TO_MARKDOWN
            parameters:
              enableOCR: false
        - to:
            uri: file:///data/output

# API mode
- route:
    from:
      uri: file:///data/documents
      parameters:
        include: ".*\\.pdf"
      steps:
        - to:
            uri: docling:CONVERT_TO_MARKDOWN
            parameters:
              useDoclingServe: true
              doOcr: false
              contentInBody: true
        - to:
            uri: file:///data/output

OCR and page headers/footers

Docling recognizes page headers and footers (page numbers, copyright lines, running titles, footnotes, and similar content) during OCR, classifying them as page furniture in docling’s FURNITURE content layer.

Docling’s Markdown, text and HTML exports include only the BODY layer by default, so header and footer text is omitted from the converted output even though the OCR engine read it correctly. When using useDoclingServe=true, the component cannot currently include the FURNITURE layer because docling-serve does not expose a content-layer selection option. This is tracked in docling-serve#271.

Using headers to control processing

  • Java

  • YAML

from("file:///data/documents?include=.*\\.pdf")
    .setHeader("CamelDoclingOperation", constant(DoclingOperations.CONVERT_TO_HTML))
    .setHeader("CamelDoclingEnableOCR", constant(true))
    .setHeader("CamelDoclingOCRLanguage", constant("es"))
    .to("docling:CONVERT_TO_MARKDOWN")  // Operation will be overridden by header
    .to("file:///data/output");
- route:
    from:
      uri: file:///data/documents
      parameters:
        include: ".*\\.pdf"
      steps:
        - setHeader:
            name: "CamelDoclingOperation"
            expression:
              constant:
                expression: "CONVERT_TO_HTML"
        - setHeader:
            name: "CamelDoclingEnableOCR"
            expression:
              constant:
                expression: "true"
        - setHeader:
            name: "CamelDoclingOCRLanguage"
            expression:
              constant:
                expression: "es"
        - to:
            uri: docling:CONVERT_TO_MARKDOWN  # Operation will be overridden by header
        - to:
            uri: file:///data/output

Processing with custom arguments

  • Java

  • YAML

from("file:///data/documents?include=.*\\.pdf")
    .process(exchange -> {
        List<String> customArgs = Arrays.asList("--verbose", "--preserve-tables");
        exchange.getIn().setHeader("CamelDoclingCustomArguments", customArgs);
    })
    .to("docling:CONVERT_TO_MARKDOWN")
    .to("file:///data/output");
- route:
    from:
      uri: file:///data/documents
      parameters:
        include: ".*\\.pdf"
      steps:
        - setHeader:
            name: "CamelDoclingCustomArguments"
            expression:
              method:
                ref: "customArgsBean"
                method: "createCustomArgs"
        - to:
            uri: docling:CONVERT_TO_MARKDOWN
        - to:
            uri: file:///data/output

Custom argument validation

When passing custom CLI arguments via the CamelDoclingCustomArguments header, the component enforces an allowlist of recognized docling CLI flags. Only the following flags are permitted:

Category Allowed flags

Input/output format

--from, --to

Pipeline

--pipeline, --vlm-model, --asr-model

OCR

--ocr, --no-ocr, --force-ocr, --no-force-ocr, --ocr-engine, --ocr-lang, --psm

Tables

--tables, --no-tables, --table-mode

PDF

--pdf-backend, --pdf-password

Enrichment

--enrich-code, --no-enrich-code, --enrich-formula, --no-enrich-formula, --enrich-picture-classes, --no-enrich-picture-classes, --enrich-picture-description, --no-enrich-picture-description, --enrich-chart-extraction, --no-enrich-chart-extraction

Output formatting

--image-export-mode, --show-layout, --no-show-layout

Advanced

--headers, --artifacts-path, --enable-remote-services, --no-enable-remote-services, --allow-external-plugins, --no-allow-external-plugins, --show-external-plugins, --no-show-external-plugins, --document-timeout, --device, --num-threads, --page-batch-size

Debug

--verbose, -v / -vv / -vvv, --debug-visualize-cells, --no-debug-visualize-cells, --debug-visualize-ocr, --no-debug-visualize-ocr, --debug-visualize-layout, --no-debug-visualize-layout, --debug-visualize-tables, --no-debug-visualize-tables

Performance

--abort-on-error, --no-abort-on-error, --profiling, --no-profiling, --save-profiling, --no-save-profiling

Info

--version, --help, --logo

The --output (-o) flag is not permitted because the output directory is managed by the producer. Use the CamelDoclingOutputFilePath header or endpoint configuration instead. That header must be a relative path, or, when outputBaseDirectory is set, a path inside that directory (see the security options above).

Additionally, the following are rejected:

  • Shell metacharacters: ;, |, ` , $() — blocked as defense-in-depth even though ProcessBuilder does not interpret them.

  • Path traversal: ../, ..\, and paths that resolve to traversal after normalization.

  • Unknown flags: any flag not in the allowlist above.

Extracting document metadata

  • Java

  • YAML

from("file:///data/documents?include=.*\\.pdf")
    .to("docling:EXTRACT_METADATA")
    .process(exchange -> {
        DocumentMetadata metadata = exchange.getIn().getBody(DocumentMetadata.class);

        // Access metadata fields
        String title = metadata.getTitle();
        String documentType = metadata.getDocumentType();
        Integer pageCount = metadata.getPageCount();
        String format = metadata.getFormat();

        log.info("Document: {} ({}), Pages: {}, Format: {}",
            title, documentType, pageCount, format);

        // Metadata is also available in headers
        String titleFromHeader = exchange.getIn().getHeader("CamelDoclingMetadataTitle", String.class);
    });
- route:
    from:
      uri: file:///data/documents
      parameters:
        include: ".*\\.pdf"
      steps:
        - to:
            uri: docling:EXTRACT_METADATA
        - log:
            message: "Document: ${header.CamelDoclingMetadataTitle} (${header.CamelDoclingMetadataDocumentType})"
        - log:
            message: "Pages: ${header.CamelDoclingMetadataPageCount}"
        - process:
            ref: "metadataProcessor"

Extract metadata with all fields

  • Java

  • YAML

from("file:///data/documents?include=.*\\.pdf")
    .to("docling:EXTRACT_METADATA?includeRawMetadata=true")
    .process(exchange -> {
        DocumentMetadata metadata = exchange.getIn().getBody(DocumentMetadata.class);

        log.info("Page Count: {}", metadata.getPageCount());

        // Raw metadata from parser
        Map<String, Object> rawMetadata = metadata.getRawMetadata();
        log.info("Raw metadata: {}", rawMetadata);
    });
- route:
    from:
      uri: file:///data/documents
      parameters:
        include: ".*\\.pdf"
      steps:
        - to:
            uri: docling:EXTRACT_METADATA
            parameters:
              includeRawMetadata: true
        - process:
            ref: "fullMetadataProcessor"

Route documents based on metadata

  • Java

  • YAML

from("file:///data/documents?include=.*\\.pdf")
    .to("docling:EXTRACT_METADATA")
    .choice()
        .when(simple("${header.CamelDoclingMetadataPageCount} > 100"))
            .log("Large document with ${header.CamelDoclingMetadataPageCount} pages")
            .to("file:///data/large-docs")
        .when(simple("${header.CamelDoclingMetadataTitle} contains 'Invoice'"))
            .log("Invoice document")
            .to("file:///data/invoices")
        .otherwise()
            .to("file:///data/other-docs")
    .end();
- route:
    from:
      uri: file:///data/documents
      parameters:
        include: ".*\\.pdf"
      steps:
        - to:
            uri: docling:EXTRACT_METADATA
        - choice:
            when:
              - expression:
                  simple:
                    expression: "${header.CamelDoclingMetadataPageCount} > 100"
                steps:
                  - log:
                      message: "Large document with ${header.CamelDoclingMetadataPageCount} pages"
                  - to:
                      uri: file:///data/large-docs
              - expression:
                  simple:
                    expression: "${header.CamelDoclingMetadataTitle} contains 'Invoice'"
                steps:
                  - log:
                      message: "Invoice document"
                  - to:
                      uri: file:///data/invoices
            otherwise:
              steps:
                - to:
                    uri: file:///data/other-docs

Extract metadata without headers

  • Java

  • YAML

from("file:///data/documents?include=.*\\.pdf")
    .to("docling:EXTRACT_METADATA?includeMetadataInHeaders=false")
    .process(exchange -> {
        DocumentMetadata metadata = exchange.getIn().getBody(DocumentMetadata.class);

        // All metadata is in the body object only
        // Headers are not populated with metadata fields
        log.info("Metadata: {}", metadata);
    });
- route:
    from:
      uri: file:///data/documents
      parameters:
        include: ".*\\.pdf"
      steps:
        - to:
            uri: docling:EXTRACT_METADATA
            parameters:
              includeMetadataInHeaders: false
        - process:
            ref: "metadataBodyProcessor"

Content in body vs file path output

  • Java

  • YAML

// Get content directly in body (file is automatically deleted)
from("file:///data/documents?include=.*\\.pdf")
    .to("docling:CONVERT_TO_MARKDOWN?contentInBody=true")
    .process(exchange -> {
        String markdownContent = exchange.getIn().getBody(String.class);
        log.info("Converted content: {}", markdownContent);
    });

// Get file path (file is preserved)
from("file:///data/documents?include=.*\\.pdf")
    .to("docling:CONVERT_TO_MARKDOWN?contentInBody=false")
    .process(exchange -> {
        String outputFilePath = exchange.getIn().getBody(String.class);
        log.info("Output file saved at: {}", outputFilePath);
    });
# Get content directly in body (file is automatically deleted)
- route:
    from:
      uri: file:///data/documents
      parameters:
        include: ".*\\.pdf"
      steps:
        - to:
            uri: docling:CONVERT_TO_MARKDOWN
            parameters:
              contentInBody: true
        - process:
            ref: "contentProcessor"

# Get file path (file is preserved)
- route:
    from:
      uri: file:///data/documents
      parameters:
        include: ".*\\.pdf"
      steps:
        - to:
            uri: docling:CONVERT_TO_MARKDOWN
            parameters:
              contentInBody: false
        - process:
            ref: "filePathProcessor"

Processor Bean Examples

When using YAML DSL, the processor references used in the examples above would be implemented as Spring beans:

Java-only: Spring bean Processor implementation
@Component("htmlProcessor")
public class HtmlProcessor implements Processor {
    @Override
    public void process(Exchange exchange) throws Exception {
        String htmlContent = exchange.getIn().getBody(String.class);
        // Process the HTML content
        log.info("Processing HTML content of length: {}", htmlContent.length());
    }
}

@Component("structuredDataProcessor")
public class StructuredDataProcessor implements Processor {
    private static final Logger log = LoggerFactory.getLogger(StructuredDataProcessor.class);

    @Override
    public void process(Exchange exchange) throws Exception {
        DoclingDocument doc = exchange.getIn().getBody(DoclingDocument.class);
        log.info("Document schema: {}, tables: {}", doc.getSchemaName(), doc.getTables().size());
    }
}

@Component("contentProcessor")
public class ContentProcessor implements Processor {
    private static final Logger log = LoggerFactory.getLogger(ContentProcessor.class);

    @Override
    public void process(Exchange exchange) throws Exception {
        String markdownContent = exchange.getIn().getBody(String.class);
        log.info("Converted content: {}", markdownContent);
    }
}

@Component("filePathProcessor")
public class FilePathProcessor implements Processor {
    private static final Logger log = LoggerFactory.getLogger(FilePathProcessor.class);

    @Override
    public void process(Exchange exchange) throws Exception {
        String outputFilePath = exchange.getIn().getBody(String.class);
        log.info("Output file saved at: {}", outputFilePath);
    }
}

@Component("customArgsBean")
public class CustomArgsBean {
    public List<String> createCustomArgs() {
        return Arrays.asList("--verbose", "--preserve-tables");
    }
}

Document Chunking

The component supports document chunking via docling-serve, which splits documents into semantically meaningful chunks suitable for RAG (Retrieval-Augmented Generation) pipelines, vector databases, and other NLP workflows. Unlike naive text splitting, docling chunking is structure-aware — it respects document headings, paragraphs, and tables — and the hybrid chunker is also token-aware, ensuring chunks fit within model token limits.

Both chunking operations require useDoclingServe=true. The Docling CLI does not expose chunking as a command — chunking is only available through the docling-serve REST API.

CHUNK_HYBRID uses the HybridChunker, which is both structure-aware and token-aware. It respects document structure while ensuring each chunk stays within a configurable token limit. Best for RAG pipelines with embedding models that have fixed token windows. Configure it with the chunkingTokenizer, chunkingMaxTokens, and chunkingMergePeers options (see the endpoint options table above).

CHUNK_HIERARCHICAL uses the HierarchicalChunker, which is structure-aware only. It splits at document structure boundaries (sections, paragraphs) without enforcing token limits. Best when chunk size is less important than preserving complete structural units.

When contentInBody=true, the exchange body is set to a List<Chunk> (ai.docling.serve.api.chunk.response.Chunk), ready for use with Camel’s .split(body()) EIP. Each Chunk object provides:

  • text — the chunk text content

  • chunkIndex — zero-based position in the document

  • filename — source document filename

  • headings — list of heading strings leading to this chunk

  • pageNumbers — list of page numbers this chunk spans

  • captions — list of captions (e.g., table or figure captions)

  • numTokens — token count (hybrid chunker only)

When contentInBody=false, the full ChunkDocumentResponse is returned.

Basic Chunking

  • Java

  • YAML

from("file:///data/documents?include=.*\\.pdf")
    .setHeader("CamelDoclingInputFilePath", simple("${file:absolute.path}"))
    .to("docling:CHUNK_HYBRID?" +
        "useDoclingServe=true&" +
        "contentInBody=true&" +
        "chunkingTokenizer=sentence-transformers/all-MiniLM-L6-v2&" +
        "chunkingMaxTokens=128&" +
        "chunkingMergePeers=true")
    .split(body())
        .log("Chunk ${body.chunkIndex}: ${body.text}")
    .end();
- route:
    from:
      uri: file:///data/documents
      parameters:
        include: ".*\\.pdf"
      steps:
        - setHeader:
            name: CamelDoclingInputFilePath
            expression:
              simple:
                expression: "${file:absolute.path}"
        - to:
            uri: docling:CHUNK_HYBRID
            parameters:
              useDoclingServe: true
              contentInBody: true
              chunkingTokenizer: "sentence-transformers/all-MiniLM-L6-v2"
              chunkingMaxTokens: 128
              chunkingMergePeers: true
        - split:
            expression:
              simple:
                expression: "${body}"
            steps:
              - log:
                  message: "Chunk ${body.chunkIndex}: ${body.text}"

Chunking for RAG Pipelines

A common use case is to chunk documents, generate embeddings, and store them in a vector database:

  • Java

  • YAML

from("direct:ingest-pdf")
    .setHeader("CamelDoclingInputFilePath", header("pdfFilePath"))
    .to("docling:CHUNK_HYBRID?" +
        "useDoclingServe=true&" +
        "contentInBody=true&" +
        "chunkingTokenizer={{embedding.tokenizer}}&" +
        "chunkingMaxTokens={{embedding.max-tokens}}&" +
        "chunkingMergePeers=true")
    .split(body())
        .setBody(simple("${body.text}"))
        .to("openai:embeddings?embeddingModel={{embedding.model}}")
        // store embedding in vector database
        .to("direct:store-embedding")
    .end();
- route:
    id: ingest-pdf
    from:
      uri: direct:ingest-pdf
      steps:
        - setHeader:
            name: CamelDoclingInputFilePath
            expression:
              simple:
                expression: "${header.pdfFilePath}"
        - to:
            uri: docling:CHUNK_HYBRID
            parameters:
              useDoclingServe: true
              contentInBody: true
              chunkingTokenizer: "{{embedding.tokenizer}}"
              chunkingMaxTokens: "{{embedding.max-tokens}}"
              chunkingMergePeers: true
        - split:
            expression:
              simple:
                expression: "${body}"
            steps:
              - setBody:
                  expression:
                    simple:
                      expression: "${body.text}"
              - to:
                  uri: openai:embeddings
                  parameters:
                    embeddingModel: "{{embedding.model}}"
              - to:
                  uri: direct:store-embedding

Hierarchical Chunking

Use hierarchical chunking when you want to preserve complete structural units without token limits:

  • Java

  • YAML

from("file:///data/documents?include=.*\\.pdf")
    .setHeader("CamelDoclingInputFilePath", simple("${file:absolute.path}"))
    .to("docling:CHUNK_HIERARCHICAL?" +
        "useDoclingServe=true&" +
        "contentInBody=true")
    .split(body())
        .log("Section [${body.headings}] page ${body.pageNumbers}: ${body.text}")
    .end();
- route:
    from:
      uri: file:///data/documents
      parameters:
        include: ".*\\.pdf"
      steps:
        - setHeader:
            name: CamelDoclingInputFilePath
            expression:
              simple:
                expression: "${file:absolute.path}"
        - to:
            uri: docling:CHUNK_HIERARCHICAL
            parameters:
              useDoclingServe: true
              contentInBody: true
        - split:
            expression:
              simple:
                expression: "${body}"
            steps:
              - log:
                  message: "Section [${body.headings}] page ${body.pageNumbers}: ${body.text}"

Advanced Processing Options (API Mode)

When using docling-serve API mode (useDoclingServe=true), the component exposes advanced processing options that control how the server processes documents. These options are passed directly to the docling-serve API and provide fine-grained control over OCR, table recognition, enrichment features, and output formatting.

OCR Options

Parameter Default Description

doOcr

not set

Enable OCR processing in docling-serve API mode. When not set, OCR is turned on if ocrLanguage is set, and otherwise the server uses its own defaults. Set enableOCR to false to explicitly disable OCR.

ocrLanguage

not set

Language for OCR. When set, it is sent as ocr_lang with do_ocr=true, unless enableOCR or doOcr is false. When not set, the server uses its own default languages.

forceOcr

not set

Force OCR processing even for digital documents (documents with selectable text).

ocrEngine

not set

OCR engine to use. Supported values: AUTO, EASYOCR, OCRMAC, RAPIDOCR, TESSEROCR, TESSERACT.

In API mode, use doOcr to explicitly control OCR behavior. When doOcr is not set, a configured ocrLanguage turns OCR on, the same way as the CamelDoclingOCRLanguage header; otherwise the server uses its own defaults. Setting enableOCR=false will send doOcr(false) to the server to disable OCR. In CLI mode, ocrLanguage defaults to en when it is not set.

Table and Structure Options

Parameter Default Description

doTableStructure

not set

Enable table structure recognition. Automatically enabled for EXTRACT_STRUCTURED_DATA operations.

tableMode

not set

Table structure recognition mode. Supported values: ACCURATE, FAST.

tableCellMatching

not set

Enable table cell matching post-processing for better cell boundary detection.

Enrichment Options

Parameter Default Description

doCodeEnrichment

not set

Enable code enrichment in document processing. Identifies and annotates code blocks.

doFormulaEnrichment

not set

Enable formula enrichment in document processing. Detects and processes mathematical formulas.

doPictureClassification

not set

Enable picture classification (e.g., chart, photo, diagram). May require additional ML models on the server.

doPictureDescription

not set

Enable picture description generation. May require a Vision Language Model (VLM) on the server.

Pipeline and Output Options

Parameter Default Description

pipeline

not set

Processing pipeline to use. Supported values: ASR, STANDARD, VLM.

pdfBackend

not set

PDF parsing backend. Supported values: DLPARSE_V1, DLPARSE_V2, DLPARSE_V4, PYPDFIUM2.

includeImages

not set

Include images in the conversion output.

imageExportMode

not set

Image export mode for referenced images. Supported values: EMBEDDED, PLACEHOLDER, REFERENCED.

imagesScale

not set

Scale factor for exported images (e.g., 2.0 for double resolution).

mdPageBreakPlaceholder

not set

Placeholder string for page breaks in markdown output.

abortOnError

not set

Abort processing on error instead of continuing with partial results.

documentTimeout

not set

Document processing timeout in seconds (server-side timeout).

Example: Advanced Processing Configuration

  • Java

  • YAML

from("file:///data/documents?include=.*\\.pdf")
    .to("docling:EXTRACT_STRUCTURED_DATA?" +
        "useDoclingServe=true&" +
        "doOcr=true&" +
        "ocrEngine=TESSERACT&" +
        "doTableStructure=true&" +
        "tableMode=ACCURATE&" +
        "doCodeEnrichment=true&" +
        "pdfBackend=DLPARSE_V4&" +
        "processTimeout=120000&" +     // 2 minutes for complex PDFs
        "contentInBody=true")
    .process(exchange -> {
        DoclingDocument doc = exchange.getIn().getBody(DoclingDocument.class);
        // Process the structured document
    });
- route:
    from:
      uri: file:///data/documents
      parameters:
        include: ".*\\.pdf"
      steps:
        - to:
            uri: docling:EXTRACT_STRUCTURED_DATA
            parameters:
              useDoclingServe: true
              doOcr: true
              ocrEngine: "TESSERACT"
              doTableStructure: true
              tableMode: "ACCURATE"
              doCodeEnrichment: true
              pdfBackend: "DLPARSE_V4"
              processTimeout: 120000
              contentInBody: true
        - process:
            ref: "structuredDataProcessor"

DoclingDocument Return Type

When using docling-serve API mode, the CONVERT_TO_JSON and EXTRACT_STRUCTURED_DATA operations return a DoclingDocument object (from the ai.docling.core package) instead of a raw JSON string. This object provides type-safe access to the document structure.

  • Java

  • YAML

from("file:///data/documents?include=.*\\.pdf")
    .to("docling:CONVERT_TO_JSON?" +
        "useDoclingServe=true&" +
        "contentInBody=true")
    .process(exchange -> {
        DoclingDocument doc = exchange.getIn().getBody(DoclingDocument.class);

        // Access document structure
        String schemaName = doc.getSchemaName();

        // Access tables
        List<DoclingDocument.TableItem> tables = doc.getTables();
        for (DoclingDocument.TableItem table : tables) {
            DoclingDocument.TableData data = table.getData();
            int rows = data.getNumRows();
            int cols = data.getNumCols();
            log.info("Table: {}x{}", rows, cols);
        }

        // Access pictures
        List<DoclingDocument.PictureItem> pictures = doc.getPictures();
        log.info("Found {} pictures", pictures.size());
    });
- route:
    from:
      uri: file:///data/documents
      parameters:
        include: ".*\\.pdf"
      steps:
        - to:
            uri: docling:CONVERT_TO_JSON
            parameters:
              useDoclingServe: true
              contentInBody: true
        - process:
            ref: "doclingDocumentProcessor"

Consuming asynchronous conversions

Instead of submitting a conversion with SUBMIT_ASYNC_CONVERSION and then polling CHECK_CONVERSION_STATUS by hand, a docling: consumer can emit each async conversion event-driven, as soon as it finishes:

// submit conversions asynchronously; each returns a task id and runs in the background
from("direct:submit")
    .to("docling:convert?useDoclingServe=true&operation=SUBMIT_ASYNC_CONVERSION");

// the consumer emits one exchange per completed task; the path ("onComplete") is still the required operationId,
// but the consumer ignores the operation — it always drains the component's completed tasks
from("docling:onComplete?useDoclingServe=true&delay=5000")
    .to("mock:done");

The consumer scans the tasks submitted via SUBMIT_ASYNC_CONVERSION on the same component and emits one exchange as each task completes:

  • a successful conversion carries the converted content as the message body — extracted in the outputFormat the task was submitted with (the CamelDoclingOutputFormat header, or the submitting endpoint’s outputFormat), because docling-serve returns only the requested format — and the task id in the CamelDoclingTaskId header;

  • a failed conversion completes the exchange with the underlying exception, so the route’s onException machinery applies.

It is a scheduled polling consumer, so the poll interval and the other scheduler options (delay, initialDelay, useFixedDelay, …​) are configured on the endpoint as usual.

The consumer drains the tasks of the whole component, whatever endpoint, path or options submitted them. Run at most one consumer per docling component — a second consumer competes for the same tasks, and each completed task is emitted by whichever consumer claims it first.

Because the consumer removes each completed task from the shared registry, do not mix it with manual CHECK_CONVERSION_STATUS polling on the same component: once the consumer has claimed a task, a later status check for that id no longer finds it locally and falls back to the server, which does not know the local task id.

Pending tasks live in an in-memory map on the component, visible only to the same CamelContext. They are not persisted — they are lost on restart, and stopping the context cancels any conversions still in flight.

Error Handling

The component handles various error scenarios:

  • File size limit exceeded: Files larger than maxFileSize are rejected

  • Process timeout: Long-running conversions are terminated after processTimeout milliseconds

  • Invalid file formats: Unsupported file formats result in processing errors

  • Docling not found: Missing Docling installation causes startup failures (CLI mode)

  • Connection errors: When using docling-serve API mode, connection failures to the API endpoint will result in errors

  • Authentication errors: Invalid or missing authentication credentials will result in 401 Unauthorized errors from the docling-serve API

Performance Considerations

  • Process Timeout: The processTimeout setting (default: 30000ms / 30 seconds) controls both the CLI subprocess timeout and the HTTP read timeout for docling-serve API mode. For complex PDF documents that require OCR or enrichment processing, increase this value (e.g., processTimeout=120000 for 2 minutes).

  • OCR processing significantly increases processing time for scanned documents.

  • Consider using contentInBody=true when using docling-serve API mode to get results directly in the body.

  • The maxFileSize setting helps prevent resource exhaustion.

  • API Mode vs CLI Mode: The docling-serve API mode typically offers better performance and resource utilization for high-volume document processing, as it maintains a persistent server instance.

  • Async Mode: For large documents or high-volume processing, enable useAsyncMode=true to prevent blocking the Camel thread pool. The component will poll the docling-serve API for completion status while freeing up processing threads.

  • Async Configuration: Adjust asyncPollInterval (default 2000ms) and asyncTimeout (default 300000ms/5 minutes) based on your document size and processing requirements.

  • Batch Processing: When processing multiple documents, async mode allows better parallelization as the docling-serve instance can process multiple documents concurrently while Camel polls for results.

  • Enrichment Features: Enabling advanced options like doPictureClassification or doPictureDescription may require additional ML models on the server and can increase processing time.

Sub-Pages

For more details on specific features, see:

HTTP Client Configuration

When using docling-serve API mode, the component uses the docling-java library which internally uses Java’s built-in HttpClient. The HTTP client is configured with sensible defaults and connection management is handled automatically by the library.

Timeout Configuration

Parameter Default Description

processTimeout

30000

HTTP read timeout in milliseconds for synchronous API calls. Also used as the CLI subprocess timeout. Increase this for large or complex documents (e.g., 120000 for 2 minutes).

asyncPollInterval

2000

Poll interval in milliseconds when checking async task status.

asyncTimeout

300000

Maximum time to wait for async conversion completion in milliseconds (5 minutes).

asyncTaskTtl

86400000

Time-to-live for pending async conversion tasks in milliseconds (24 hours). Tasks older than this will be automatically evicted from memory to prevent leaks. A background cleanup task runs periodically to remove expired entries.

The default processTimeout of 30 seconds may not be sufficient for complex PDF documents, especially when OCR or enrichment options are enabled. For production use with PDF files, consider increasing processTimeout to at least 120000 (2 minutes).

Configuration Examples

Long-Running Document Processing

For large documents that take a long time to process, increase the async timeout:

  • Java

  • YAML

from("file:///data/large-documents?include=.*\\.pdf")
    .to("docling:CONVERT_TO_MARKDOWN?" +
        "useDoclingServe=true&" +
        "useAsyncMode=true&" +
        "asyncPollInterval=5000&" +      // Check every 5 seconds
        "asyncTimeout=600000&" +          // 10 minutes timeout
        "contentInBody=true")
    .to("file:///data/output");
- route:
    from:
      uri: file:///data/large-documents
      parameters:
        include: ".*\\.pdf"
      steps:
        - to:
            uri: docling:CONVERT_TO_MARKDOWN
            parameters:
              useDoclingServe: true
              useAsyncMode: true
              asyncPollInterval: 5000
              asyncTimeout: 600000
              contentInBody: true
        - to:
            uri: file:///data/output

Best Practices

  1. Use async mode for large documents: Enable useAsyncMode=true for documents that may take longer to process. The docling-java library handles polling automatically.

  2. Adjust poll interval appropriately: For high-volume scenarios, increase asyncPollInterval to reduce polling overhead. For interactive use cases, a shorter interval provides faster feedback.

  3. Set appropriate timeouts: Adjust asyncTimeout based on your largest expected document size. The default 5 minutes is suitable for most documents.

  4. Monitor with logging: Use DEBUG level logging to monitor API calls and async task status.