This is an automated email from the ASF dual-hosted git repository. nfilotto pushed a commit to branch CAMEL-17792/doc-message-headers in repository https://gitbox.apache.org/repos/asf/camel.git
commit 10335d5c8d1c0cd638d87e616b46546ea290ac55 Author: Nicolas Filotto <[email protected]> AuthorDate: Fri Apr 1 17:52:00 2022 +0200 CAMEL-17792: Add doc about the message headers of camel-optaplanner --- .../apache/camel/component/optaplanner/optaplanner.json | 8 ++++++++ .../src/main/docs/optaplanner-component.adoc | 15 +++------------ .../camel/component/optaplanner/OptaPlannerConstants.java | 12 ++++++++++++ .../camel/component/optaplanner/OptaPlannerEndpoint.java | 2 +- 4 files changed, 24 insertions(+), 13 deletions(-) diff --git a/components/camel-optaplanner/src/generated/resources/org/apache/camel/component/optaplanner/optaplanner.json b/components/camel-optaplanner/src/generated/resources/org/apache/camel/component/optaplanner/optaplanner.json index 0584958..9f41e08 100644 --- a/components/camel-optaplanner/src/generated/resources/org/apache/camel/component/optaplanner/optaplanner.json +++ b/components/camel-optaplanner/src/generated/resources/org/apache/camel/component/optaplanner/optaplanner.json @@ -26,6 +26,14 @@ "lazyStartProducer": { "kind": "property", "displayName": "Lazy Start Producer", "group": "producer", "label": "producer", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "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 star [...] "autowiredEnabled": { "kind": "property", "displayName": "Autowired Enabled", "group": "advanced", "label": "advanced", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": true, "description": "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 t [...] }, + "headers": { + "CamelOptaPlannerSolverId": { "kind": "header", "displayName": "", "group": "producer", "label": "producer", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "Specifies the solverId to use." }, + "CamelOptaPlannerIsAsync": { "kind": "header", "displayName": "", "group": "producer", "label": "producer", "required": false, "javaType": "Boolean", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "Specify whether to use another thread for submitting Solution instances rather than blocking the current thread." }, + "CamelOptaPlannerBestSolution": { "kind": "header", "displayName": "", "group": "consumer", "label": "consumer", "required": false, "javaType": "Object", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The best planning solution." }, + "CamelOptaPlannerIsSolving": { "kind": "header", "displayName": "", "group": "producer", "label": "producer", "required": false, "javaType": "Boolean", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "Is solving." }, + "CamelOptaPlannerIsTerminateEarly": { "kind": "header", "displayName": "", "group": "producer", "label": "producer", "required": false, "javaType": "Boolean", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "true if terminateEarly has been called since the Solver started." }, + "CamelOptaPlannerSolverManager": { "kind": "header", "displayName": "", "group": "producer", "label": "producer", "required": false, "javaType": "org.optaplanner.core.api.solver.SolverManager", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The Solver Manager." } + }, "properties": { "configFile": { "kind": "path", "displayName": "Config File", "group": "common", "label": "", "required": true, "type": "string", "javaType": "java.lang.String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.optaplanner.OptaPlannerConfiguration", "configurationField": "configuration", "description": "Specifies the location to the solver file. If useSolverManager=FALSE, Camel uses this file and create [...] "problemId": { "kind": "parameter", "displayName": "Problem Id", "group": "common", "label": "common", "required": false, "type": "integer", "javaType": "java.lang.Long", "deprecated": false, "autowired": false, "secret": false, "defaultValue": "1L", "configurationClass": "org.apache.camel.component.optaplanner.OptaPlannerConfiguration", "configurationField": "configuration", "description": "In case of using SolverManager : the problem id" }, diff --git a/components/camel-optaplanner/src/main/docs/optaplanner-component.adoc b/components/camel-optaplanner/src/main/docs/optaplanner-component.adoc index b277963..9a2d09e 100644 --- a/components/camel-optaplanner/src/main/docs/optaplanner-component.adoc +++ b/components/camel-optaplanner/src/main/docs/optaplanner-component.adoc @@ -58,18 +58,9 @@ include::partial$component-endpoint-options.adoc[] // endpoint options: END - -== Message Headers - -[width="100%",cols="10%,10%,10%,10%,60%",options="header",] -|======================================================================= -|Name |Default Value |Type |Context |Description - -|CamelOptaPlannerSolverId |null |String |Shared |Specifies the solverId to use - -|CamelOptaPlannerIsAsync |PUT |String |Producer |Specify whether to use another thread for submitting Solution instances -rather than blocking the current thread. -|======================================================================= +// component headers: START +include::partial$component-endpoint-headers.adoc[] +// component headers: END == Message Body diff --git a/components/camel-optaplanner/src/main/java/org/apache/camel/component/optaplanner/OptaPlannerConstants.java b/components/camel-optaplanner/src/main/java/org/apache/camel/component/optaplanner/OptaPlannerConstants.java index fe1c6a3..bfb300b 100644 --- a/components/camel-optaplanner/src/main/java/org/apache/camel/component/optaplanner/OptaPlannerConstants.java +++ b/components/camel-optaplanner/src/main/java/org/apache/camel/component/optaplanner/OptaPlannerConstants.java @@ -16,14 +16,26 @@ */ package org.apache.camel.component.optaplanner; +import org.apache.camel.spi.Metadata; + public interface OptaPlannerConstants { String DEFAULT_SOLVER_ID = "DEFAULT_SOLVER"; + @Metadata(label = "producer", description = "Specifies the solverId to use.", javaType = "String") String SOLVER_ID = "CamelOptaPlannerSolverId"; + @Metadata(label = "producer", description = "Specify whether to use another thread for submitting Solution instances\n" + + "rather than blocking the current thread.", + javaType = "Boolean") String IS_ASYNC = "CamelOptaPlannerIsAsync"; + @Metadata(label = "consumer", description = "The best planning solution.", javaType = "Object") String BEST_SOLUTION = "CamelOptaPlannerBestSolution"; + @Metadata(label = "producer", description = "Is solving.", javaType = "Boolean") String IS_SOLVING = "CamelOptaPlannerIsSolving"; + @Metadata(label = "producer", description = "true if terminateEarly has been called since the Solver started.", + javaType = "Boolean") String IS_TERMINATE_EARLY = "CamelOptaPlannerIsTerminateEarly"; String IS_EVERY_PROBLEM_FACT_CHANGE_PROCESSED = "CamelOptaPlannerIsEveryProblemFactChangeProcessed"; + @Metadata(label = "producer", description = "The Solver Manager.", + javaType = "org.optaplanner.core.api.solver.SolverManager") String SOLVER_MANAGER = "CamelOptaPlannerSolverManager"; long IS_EVERY_PROBLEM_FACT_CHANGE_DELAY = 100; } diff --git a/components/camel-optaplanner/src/main/java/org/apache/camel/component/optaplanner/OptaPlannerEndpoint.java b/components/camel-optaplanner/src/main/java/org/apache/camel/component/optaplanner/OptaPlannerEndpoint.java index 984c457..c48e30a 100644 --- a/components/camel-optaplanner/src/main/java/org/apache/camel/component/optaplanner/OptaPlannerEndpoint.java +++ b/components/camel-optaplanner/src/main/java/org/apache/camel/component/optaplanner/OptaPlannerEndpoint.java @@ -36,7 +36,7 @@ import org.optaplanner.core.api.solver.SolverFactory; * Solve planning problems with OptaPlanner. */ @UriEndpoint(firstVersion = "2.13.0", scheme = "optaplanner", title = "OptaPlanner", syntax = "optaplanner:configFile", - category = { Category.ENGINE, Category.PLANNING }) + category = { Category.ENGINE, Category.PLANNING }, headersClass = OptaPlannerConstants.class) public class OptaPlannerEndpoint extends DefaultEndpoint { private static final Map<String, Solver<Object>> SOLVERS = new HashMap<>(); private static final Map<Long, Set<OptaplannerSolutionEventListener>> SOLUTION_LISTENER = new HashMap();
