[
https://issues.apache.org/jira/browse/CAMEL-27729?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Claus Ibsen updated CAMEL-27729:
--------------------------------
Fix Version/s: 4.25.0
(was: 4.24.0)
> camel-spring-batch: misleading missing-header error, deprecated JobLauncher,
> stale docs
> ---------------------------------------------------------------------------------------
>
> Key: CAMEL-27729
> URL: https://issues.apache.org/jira/browse/CAMEL-27729
> Project: Camel
> Issue Type: Bug
> Components: camel-spring-batch
> Reporter: Claus Ibsen
> Priority: Minor
> Fix For: 4.25.0
>
>
> Found while improving the option descriptions of camel-spring-batch for
> CAMEL-23832 (commit
> https://github.com/apache/camel/commit/eadf86940085bd3bf3f9b604f8e6660520833168).
> These are separate problems of the component; the descriptions commit only
> documents the current behavior.
> h4. 1. Misleading error when jobFromHeader=true and the header is missing
> With {{jobFromHeader=true}}, {{SpringBatchEndpoint.doStart()}} does not look
> up the job of the {{jobName}} path, so {{SpringBatchProducer.process()}} has
> no job when the {{CamelSpringBatchJobName}} header is missing. The exchange
> then fails with "jobName was not specified in the endpoint construction and
> header CamelSpringBatchJobName could not be found", although the path was
> given (and the text has a double space).
> Proposed change: say that the {{CamelSpringBatchJobName}} header is required
> because the endpoint has {{jobFromHeader=true}}.
> h4. 2. JobLauncher is deprecated for removal in Spring Batch 6
> {{org.springframework.batch.core.launch.JobLauncher}} is {{@Deprecated(since
> = "6.0", forRemoval = true)}} in Spring Batch 6.1.0, which Camel uses;
> {{JobOperator}} replaces it. The {{jobLauncher}} options of
> {{SpringBatchComponent}} and {{SpringBatchEndpoint}}, and
> {{SpringBatchProducer.process()}}, depend on it, so the component breaks when
> Spring Batch removes it.
> Proposed change: support a {{JobOperator}} (option or autowired) and
> deprecate the {{jobLauncher}} options.
> h4. 3. The Usage section of the doc page is out of date
> {{spring-batch-component.adoc}} still describes a {{jobLauncherRef}}
> component option ("Deprecated and will be removed in Camel 3.0!") that no
> longer exists, misspells {{JobLaucher}}, names the old package
> {{org.springframework.batch.core.JobParametersBuilder}} (now
> {{org.springframework.batch.core.job.parameters.JobParametersBuilder}}), and
> links to springsource.org. The URI format section says the JobRegistry is
> used "instead" of the Camel registry, while the code looks in the JobRegistry
> first and falls back to the Camel registry.
> Proposed change: rewrite the Usage section from the current code.
> h4. 4. jobName is required even when it is not used
> The {{jobName}} path has {{required = true}}, but with {{jobFromHeader=true}}
> its value is never read: the job comes only from the header.
> Proposed change: keep the path required for the URI syntax, but say so in the
> docs, or make it optional when {{jobFromHeader=true}}.
> h4. 5. The producer uses the deprecated Exchange.getOut()
> {{SpringBatchProducer.process()}} copies the headers to {{exchange.getOut()}}
> and sets the {{JobExecution}} there. Setting the body on
> {{exchange.getMessage()}} keeps the headers without the copy.
> Proposed change: use {{exchange.getMessage().setBody(jobExecution)}}.
> _Claude Code on behalf of davsclaus_
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)