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 ae00db6032ce57bd345ba164f759f8b832822d08 Author: Nicolas Filotto <[email protected]> AuthorDate: Wed Apr 6 14:30:33 2022 +0200 CAMEL-17792: Add doc about the message headers of camel-weather --- .../org/apache/camel/component/weather/weather.json | 4 ++++ .../camel-weather/src/main/docs/weather-component.adoc | 17 ++++------------- .../camel/component/weather/WeatherConstants.java | 6 ++++++ .../apache/camel/component/weather/WeatherEndpoint.java | 2 +- 4 files changed, 15 insertions(+), 14 deletions(-) diff --git a/components/camel-weather/src/generated/resources/org/apache/camel/component/weather/weather.json b/components/camel-weather/src/generated/resources/org/apache/camel/component/weather/weather.json index f5c79e95b07..71c32ec4650 100644 --- a/components/camel-weather/src/generated/resources/org/apache/camel/component/weather/weather.json +++ b/components/camel-weather/src/generated/resources/org/apache/camel/component/weather/weather.json @@ -26,6 +26,10 @@ "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": { + "CamelWeatherLocation": { "kind": "header", "displayName": "", "group": "producer", "label": "producer", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "Used by the producer to override the endpoint location and use the location from this header instead." }, + "CamelWeatherQuery": { "kind": "header", "displayName": "", "group": "common", "label": "", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The original query URL sent to the Open Weather Map site" } + }, "properties": { "name": { "kind": "path", "displayName": "Name", "group": "common", "label": "", "required": true, "type": "string", "javaType": "java.lang.String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.weather.WeatherConfiguration", "configurationField": "configuration", "description": "The name value is not used." }, "appid": { "kind": "parameter", "displayName": "Appid", "group": "common", "label": "", "required": true, "type": "string", "javaType": "java.lang.String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.weather.WeatherConfiguration", "configurationField": "configuration", "description": "APPID ID used to authenticate the user connected to the API Server" }, diff --git a/components/camel-weather/src/main/docs/weather-component.adoc b/components/camel-weather/src/main/docs/weather-component.adoc index 3edd3e1226d..8f3bf14f3d9 100644 --- a/components/camel-weather/src/main/docs/weather-component.adoc +++ b/components/camel-weather/src/main/docs/weather-component.adoc @@ -56,27 +56,18 @@ include::partial$component-endpoint-options.adoc[] // endpoint options: END +// component headers: START +include::partial$component-endpoint-headers.adoc[] +// component headers: END == Exchange data format Camel will deliver the body as a json formatted java.lang.String (see the `mode` option above). -== Message Headers - -[width="100%",cols="10%,90%",options="header",] -|======================================================================= -|Header |Description - -|`CamelWeatherQuery` |The original query URL sent to the Open Weather Map site - -|`CamelWeatherLocation` |Used by the producer to override the endpoint location and use the -location from this header instead. -|======================================================================= - == Samples -In this sample we find the 7 day weather forecast for Madrid, Spain: +In this sample we find the 7-day weather forecast for Madrid, Spain: [source,java] --------------------------------------------------------------------------------------------- diff --git a/components/camel-weather/src/main/java/org/apache/camel/component/weather/WeatherConstants.java b/components/camel-weather/src/main/java/org/apache/camel/component/weather/WeatherConstants.java index 70f391ca569..bd3b7b9f00c 100644 --- a/components/camel-weather/src/main/java/org/apache/camel/component/weather/WeatherConstants.java +++ b/components/camel-weather/src/main/java/org/apache/camel/component/weather/WeatherConstants.java @@ -16,12 +16,18 @@ */ package org.apache.camel.component.weather; +import org.apache.camel.spi.Metadata; + /** * The Weather constants */ public final class WeatherConstants { + @Metadata(label = "producer", description = "Used by the producer to override the endpoint location and use the\n" + + "location from this header instead.", + javaType = "String") public static final String WEATHER_LOCATION = "CamelWeatherLocation"; + @Metadata(description = "The original query URL sent to the Open Weather Map site", javaType = "String") public static final String WEATHER_QUERY = "CamelWeatherQuery"; private WeatherConstants() { diff --git a/components/camel-weather/src/main/java/org/apache/camel/component/weather/WeatherEndpoint.java b/components/camel-weather/src/main/java/org/apache/camel/component/weather/WeatherEndpoint.java index 70cf52dbc81..bf8ed254633 100644 --- a/components/camel-weather/src/main/java/org/apache/camel/component/weather/WeatherEndpoint.java +++ b/components/camel-weather/src/main/java/org/apache/camel/component/weather/WeatherEndpoint.java @@ -29,7 +29,7 @@ import org.apache.http.client.utils.HttpClientUtils; * Poll the weather information from Open Weather Map. */ @UriEndpoint(firstVersion = "2.12.0", scheme = "weather", title = "Weather", syntax = "weather:name", - category = { Category.API }) + category = { Category.API }, headersClass = WeatherConstants.class) public class WeatherEndpoint extends DefaultPollingEndpoint { @UriParam
