This is an automated email from the ASF dual-hosted git repository. nfilotto pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/camel.git
The following commit(s) were added to refs/heads/main by this push: new ab9e39358b4 CAMEL-17792: Add documentation about the message headers (R) (#7354) ab9e39358b4 is described below commit ab9e39358b49c9b0bc405e66c914fce627e837bc Author: Nicolas Filotto <essob...@users.noreply.github.com> AuthorDate: Mon Apr 4 22:36:13 2022 +0200 CAMEL-17792: Add documentation about the message headers (R) (#7354) ## Motivation It is now possible to document a message header using annotations, let's leverage it to document the headers of the components. ## Modifications For all the components whose name starts with a R * Document the messages headers using the annotations * Migrate the existing documentation of message headers to use the annotations instead * Move constants corresponding to headers to the headers class. * CAMEL-17792: Add doc about the message headers of camel-rabbitmq * CAMEL-17792: Add doc about the message headers of camel-reactive-streams * CAMEL-17792: Add doc about the message headers of camel-rest * CAMEL-17792: Add doc about the message headers of camel-resteasy * CAMEL-17792: Add doc about the message headers of camel-robotframework * CAMEL-17792: Add doc about the message headers of camel-rss --- .../apache/camel/component/rabbitmq/rabbitmq.json | 25 ++++++++ .../src/main/docs/rabbitmq-component.adoc | 72 +--------------------- .../component/rabbitmq/RabbitMQConstants.java | 43 +++++++++++++ .../camel/component/rabbitmq/RabbitMQEndpoint.java | 2 +- .../rabbitmq/RabbitMQMessageConverter.java | 2 +- .../reactive/streams/reactive-streams.json | 4 ++ .../src/main/docs/reactive-streams-component.adoc | 4 +- .../reactive/streams/ReactiveStreamsConstants.java | 5 +- .../reactive/streams/ReactiveStreamsEndpoint.java | 2 +- .../org/apache/camel/component/rest/rest.json | 8 +++ .../camel-rest/src/main/docs/rest-component.adoc | 4 +- .../apache/camel/component/rest/RestConstants.java | 44 +++++++++++++ .../apache/camel/component/rest/RestEndpoint.java | 2 +- .../apache/camel/component/rest/RestProducer.java | 15 +++-- .../rest/RestProducerBindingProcessor.java | 8 +-- .../apache/camel/component/resteasy/resteasy.json | 13 ++++ .../src/main/docs/resteasy-component.adoc | 3 + .../component/resteasy/ResteasyConstants.java | 17 +++++ .../camel/component/resteasy/ResteasyEndpoint.java | 3 +- .../camel/component/resteasy/ResteasyProducer.java | 6 +- .../resteasy/servlet/ResteasyCamelServlet.java | 4 +- .../component/robotframework/robotframework.json | 5 ++ .../src/main/docs/robotframework-component.adoc | 6 +- .../RobotFrameworkCamelConstants.java | 5 ++ .../robotframework/RobotFrameworkEndpoint.java | 3 +- .../org/apache/camel/component/rss/rss.json | 3 + .../camel-rss/src/main/docs/rss-component.adoc | 14 +---- .../apache/camel/component/rss/RssConstants.java | 5 +- .../apache/camel/component/rss/RssEndpoint.java | 3 +- 29 files changed, 221 insertions(+), 109 deletions(-) diff --git a/components/camel-rabbitmq/src/generated/resources/org/apache/camel/component/rabbitmq/rabbitmq.json b/components/camel-rabbitmq/src/generated/resources/org/apache/camel/component/rabbitmq/rabbitmq.json index 2d0bb30caf1..b3d17e0f98b 100644 --- a/components/camel-rabbitmq/src/generated/resources/org/apache/camel/component/rabbitmq/rabbitmq.json +++ b/components/camel-rabbitmq/src/generated/resources/org/apache/camel/component/rabbitmq/rabbitmq.json @@ -79,6 +79,31 @@ "trustManager": { "kind": "property", "displayName": "Trust Manager", "group": "security", "label": "security", "required": false, "type": "object", "javaType": "javax.net.ssl.TrustManager", "deprecated": false, "autowired": false, "secret": false, "description": "Configure SSL trust manager, SSL should be enabled for this option to be effective" }, "username": { "kind": "property", "displayName": "Username", "group": "security", "label": "security", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": true, "defaultValue": "guest", "description": "Username in case of authenticated access" } }, + "headers": { + "CamelRabbitmqRoutingKey": { "kind": "header", "displayName": "", "group": "common", "label": "", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "Consumer: The routing key that was used to receive the message, or the routing key that will be used when producing a message Producer: The routing key that will be used when sending the message" }, + "CamelRabbitmqExchangeOverrideName": { "kind": "header", "displayName": "", "group": "common", "label": "", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "Used for force sending the message to this exchange instead of the endpoint configured name on the producer" }, + "CamelRabbitmqExchangeName": { "kind": "header", "displayName": "", "group": "common", "label": "", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "Consumer: The exchange the message was received from Producer: The exchange the message was received from" }, + "CamelRabbitmqContentType": { "kind": "header", "displayName": "", "group": "common", "label": "", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The contentType to set on the RabbitMQ message" }, + "CamelRabbitmqPriority": { "kind": "header", "displayName": "", "group": "common", "label": "", "required": false, "javaType": "int", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The priority header to set on the RabbitMQ message" }, + "CamelRabbitmqDeliveryTag": { "kind": "header", "displayName": "", "group": "common", "label": "", "required": false, "javaType": "long", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The rabbitmq delivery tag of the received message" }, + "CamelRabbitmqRedeliveryTag": { "kind": "header", "displayName": "", "group": "common", "label": "", "required": false, "javaType": "boolean", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "Whether the message is a redelivered" }, + "CamelRabbitmqCorrelationId": { "kind": "header", "displayName": "", "group": "common", "label": "", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The correlationId to set on the RabbitMQ message." }, + "CamelRabbitmqMessageId": { "kind": "header", "displayName": "", "group": "common", "label": "", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The message id to set on the RabbitMQ message." }, + "CamelRabbitmqDeliveryMode": { "kind": "header", "displayName": "", "group": "common", "label": "", "required": false, "javaType": "Integer", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "If the message should be persistent or not" }, + "CamelRabbitmqUserId": { "kind": "header", "displayName": "", "group": "common", "label": "", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The userId to set on the RabbitMQ message" }, + "CamelRabbitmqClusterId": { "kind": "header", "displayName": "", "group": "common", "label": "", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The clusterId to set on the RabbitMQ message" }, + "CamelRabbitmqRequestTimeout": { "kind": "header", "displayName": "", "group": "common", "label": "", "required": false, "javaType": "long", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The timeout for waiting for a reply when using the InOut Exchange Pattern (in milliseconds)" }, + "CamelRabbitmqReplyTo": { "kind": "header", "displayName": "", "group": "common", "label": "", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The replyTo to set on the RabbitMQ message" }, + "CamelRabbitmqContentEncoding": { "kind": "header", "displayName": "", "group": "common", "label": "", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The contentEncoding to set on the RabbitMQ message" }, + "CamelRabbitmqType": { "kind": "header", "displayName": "", "group": "common", "label": "", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The type to set on the RabbitMQ message" }, + "CamelRabbitmqExpiration": { "kind": "header", "displayName": "", "group": "common", "label": "", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The expiration to set on the RabbitMQ message" }, + "CamelRabbitmqTimestamp": { "kind": "header", "displayName": "", "group": "common", "label": "", "required": false, "javaType": "java.util.Date", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The timestamp to set on the RabbitMQ message" }, + "CamelRabbitmqAppId": { "kind": "header", "displayName": "", "group": "common", "label": "", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The appId to set on the RabbitMQ message" }, + "CamelRabbitmqRequeue": { "kind": "header", "displayName": "", "group": "common", "label": "", "required": false, "javaType": "boolean", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "This is used by the consumer to control rejection of the message. When the consumer is complete processing the exchange, and if the exchange failed, then the consumer is going to reject the message from the RabbitMQ broker. The value of this header contr [...] + "CamelRabbitmqMandatory": { "kind": "header", "displayName": "", "group": "common", "label": "", "required": false, "javaType": "Boolean", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The flag telling the server how to react if the message cannot be routed to a queue." }, + "CamelRabbitmqImmediate": { "kind": "header", "displayName": "", "group": "common", "label": "", "required": false, "javaType": "Boolean", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The flag telling the server how to react if the message cannot be routed to a queue consumer immediately." }, + "CamelMessageTimestamp": { "kind": "header", "displayName": "", "group": "common", "label": "", "required": false, "javaType": "long", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The timestamp of the RabbitMQ message" } + }, "properties": { "exchangeName": { "kind": "path", "displayName": "Exchange Name", "group": "common", "label": "", "required": true, "type": "string", "javaType": "java.lang.String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The exchange name determines the exchange to which the produced messages will be sent to. In the case of consumers, the exchange name determines the exchange the queue will be bound to." }, "addresses": { "kind": "parameter", "displayName": "Addresses", "group": "common", "label": "common", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "If this option is set, camel-rabbitmq will try to create connection based on the setting of option addresses. The addresses value is a string which looks like server1:12345, server2:12345" }, diff --git a/components/camel-rabbitmq/src/main/docs/rabbitmq-component.adoc b/components/camel-rabbitmq/src/main/docs/rabbitmq-component.adoc index 5000e1219f2..3f001c97725 100644 --- a/components/camel-rabbitmq/src/main/docs/rabbitmq-component.adoc +++ b/components/camel-rabbitmq/src/main/docs/rabbitmq-component.adoc @@ -96,75 +96,9 @@ The `ConnectionFactory` is auto-detected by default, so you can just do In case you have multiple connection factories in your application or multiple connection factories in your registry, don't forget to set the `autoDetectConnectionFactory` to false. -== Message Headers - -The following headers are set on exchanges when consuming messages. - -[width="100%",cols="10%,90%",options="header",] -|=== -|Property |Value - -|`CamelRabbitmqRoutingKey` |The routing key that was used to receive the message, or the routing key -that will be used when producing a message - -|`CamelRabbitmqExchangeName` |The exchange the message was received from - -|`CamelRabbitmqDeliveryTag` |The rabbitmq delivery tag of the received message - -|`CamelRabbitmqRedeliveryTag` |Whether the message is a redelivered - -|`CamelRabbitmqRequeue` |This is used by the consumer to control rejection of the -message. When the consumer is complete processing the exchange, and if -the exchange failed, then the consumer is going to reject the message -from the RabbitMQ broker. The value of this header controls this -behavior. If the value is false (by default) then the message is -discarded/dead-lettered. If the value is true, then the message is -re-queued. -|=== - -The following headers are used by the producer. If these are set on the -camel exchange then they will be set on the RabbitMQ message. - -[width="100%",cols="10%,90%",options="header",] -|=== -|Property |Value - -|`CamelRabbitmqRoutingKey` |The routing key that will be used when sending the message - -|`CamelRabbitmqExchangeName` |The exchange the message was received from - -|`CamelRabbitmqExchangeOverrideName` |Used for force sending the message to this exchange instead of the endpoint configured name on the producer - -|`CamelRabbitmqContentType` |The contentType to set on the RabbitMQ message - -|`CamelRabbitmqPriority` |The priority header to set on the RabbitMQ message - -|`CamelRabbitmqCorrelationId` |The correlationId to set on the RabbitMQ message - -|`CamelRabbitmqMessageId` |The message id to set on the RabbitMQ message - -|`CamelRabbitmqDeliveryMode` |If the message should be persistent or not - -|`CamelRabbitmqUserId` |The userId to set on the RabbitMQ message - -|`CamelRabbitmqClusterId` |The clusterId to set on the RabbitMQ message - -|`CamelRabbitmqReplyTo` |The replyTo to set on the RabbitMQ message - -|`CamelRabbitmqContentEncoding` |The contentEncoding to set on the RabbitMQ message - -|`CamelRabbitmqType` |The type to set on the RabbitMQ message - -|`CamelRabbitmqExpiration` |The expiration to set on the RabbitMQ message - -|`CamelRabbitmqTimestamp` |The timestamp to set on the RabbitMQ message - -|`CamelRabbitmqAppId` |The appId to set on the RabbitMQ message -|=== - -Headers are set by the consumer once the message is received. The -producer will also set the headers for downstream processors once the -exchange has taken place. +// component headers: START +include::partial$component-endpoint-headers.adoc[] +// component headers: END == Troubleshooting headers diff --git a/components/camel-rabbitmq/src/main/java/org/apache/camel/component/rabbitmq/RabbitMQConstants.java b/components/camel-rabbitmq/src/main/java/org/apache/camel/component/rabbitmq/RabbitMQConstants.java index 06597f16db3..a99ef556283 100644 --- a/components/camel-rabbitmq/src/main/java/org/apache/camel/component/rabbitmq/RabbitMQConstants.java +++ b/components/camel-rabbitmq/src/main/java/org/apache/camel/component/rabbitmq/RabbitMQConstants.java @@ -20,30 +20,73 @@ import java.util.Set; import java.util.stream.Collectors; import java.util.stream.Stream; +import org.apache.camel.Exchange; +import org.apache.camel.spi.Metadata; + public final class RabbitMQConstants { + @Metadata(description = "*Consumer:* The routing key that was used to receive the message, or the routing key\n" + + "that will be used when producing a message\n " + + "*Producer:* The routing key that will be used when sending the message", + javaType = "String") public static final String ROUTING_KEY = "CamelRabbitmqRoutingKey"; + @Metadata(description = "Used for force sending the message to this exchange instead of the endpoint configured name on the producer", + javaType = "String") public static final String EXCHANGE_OVERRIDE_NAME = "CamelRabbitmqExchangeOverrideName"; + @Metadata(description = "*Consumer:* The exchange the message was received from\n " + + "*Producer:* The exchange the message was received from", + javaType = "String") public static final String EXCHANGE_NAME = "CamelRabbitmqExchangeName"; + @Metadata(description = "The contentType to set on the RabbitMQ message", javaType = "String") public static final String CONTENT_TYPE = "CamelRabbitmqContentType"; + @Metadata(description = "The priority header to set on the RabbitMQ message", javaType = "int") public static final String PRIORITY = "CamelRabbitmqPriority"; + @Metadata(description = "The rabbitmq delivery tag of the received message", javaType = "long") public static final String DELIVERY_TAG = "CamelRabbitmqDeliveryTag"; + @Metadata(description = "Whether the message is a redelivered", javaType = "boolean") public static final String REDELIVERY_TAG = "CamelRabbitmqRedeliveryTag"; + @Metadata(description = "The correlationId to set on the RabbitMQ message.", javaType = "String") public static final String CORRELATIONID = "CamelRabbitmqCorrelationId"; + @Metadata(description = "The message id to set on the RabbitMQ message.", javaType = "String") public static final String MESSAGE_ID = "CamelRabbitmqMessageId"; + @Metadata(description = "If the message should be persistent or not", javaType = "Integer") public static final String DELIVERY_MODE = "CamelRabbitmqDeliveryMode"; + @Metadata(description = "The userId to set on the RabbitMQ message", javaType = "String") public static final String USERID = "CamelRabbitmqUserId"; + @Metadata(description = "The clusterId to set on the RabbitMQ message", javaType = "String") public static final String CLUSTERID = "CamelRabbitmqClusterId"; + @Metadata(description = "The timeout for waiting for a reply when using the InOut Exchange Pattern (in milliseconds)", + javaType = "long") public static final String REQUEST_TIMEOUT = "CamelRabbitmqRequestTimeout"; + @Metadata(description = "The replyTo to set on the RabbitMQ message", javaType = "String") public static final String REPLY_TO = "CamelRabbitmqReplyTo"; + @Metadata(description = "The contentEncoding to set on the RabbitMQ message", javaType = "String") public static final String CONTENT_ENCODING = "CamelRabbitmqContentEncoding"; + @Metadata(description = "The type to set on the RabbitMQ message", javaType = "String") public static final String TYPE = "CamelRabbitmqType"; + @Metadata(description = "The expiration to set on the RabbitMQ message", javaType = "String") public static final String EXPIRATION = "CamelRabbitmqExpiration"; + @Metadata(description = "The timestamp to set on the RabbitMQ message", javaType = "java.util.Date") public static final String TIMESTAMP = "CamelRabbitmqTimestamp"; + @Metadata(description = "The appId to set on the RabbitMQ message", javaType = "String") public static final String APP_ID = "CamelRabbitmqAppId"; + @Metadata(description = "This is used by the consumer to control rejection of the\n" + + "message. When the consumer is complete processing the exchange, and if\n" + + "the exchange failed, then the consumer is going to reject the message\n" + + "from the RabbitMQ broker. The value of this header controls this\n" + + "behavior. If the value is false (by default) then the message is\n" + + "discarded/dead-lettered. If the value is true, then the message is\n" + + "re-queued.", + javaType = "boolean") public static final String REQUEUE = "CamelRabbitmqRequeue"; + @Metadata(description = "The flag telling the server how to react if the message cannot be routed to a queue.", + javaType = "Boolean") public static final String MANDATORY = "CamelRabbitmqMandatory"; + @Metadata(description = "The flag telling the server how to react if the message cannot be routed to a queue consumer immediately.", + javaType = "Boolean") public static final String IMMEDIATE = "CamelRabbitmqImmediate"; + @Metadata(description = "The timestamp of the RabbitMQ message", javaType = "long") + public static final String MESSAGE_TIMESTAMP = Exchange.MESSAGE_TIMESTAMP; public static final String RABBITMQ_DEAD_LETTER_EXCHANGE = "x-dead-letter-exchange"; public static final String RABBITMQ_DEAD_LETTER_ROUTING_KEY = "x-dead-letter-routing-key"; public static final String RABBITMQ_DIRECT_REPLY_EXCHANGE = ""; diff --git a/components/camel-rabbitmq/src/main/java/org/apache/camel/component/rabbitmq/RabbitMQEndpoint.java b/components/camel-rabbitmq/src/main/java/org/apache/camel/component/rabbitmq/RabbitMQEndpoint.java index 540898886c3..09e878b6671 100644 --- a/components/camel-rabbitmq/src/main/java/org/apache/camel/component/rabbitmq/RabbitMQEndpoint.java +++ b/components/camel-rabbitmq/src/main/java/org/apache/camel/component/rabbitmq/RabbitMQEndpoint.java @@ -57,7 +57,7 @@ import static org.apache.camel.component.rabbitmq.RabbitMQComponent.QUEUE_ARG_PR * Send and receive messages from <a href="http://www.rabbitmq.com/">RabbitMQ</a> instances. */ @UriEndpoint(firstVersion = "2.12.0", scheme = "rabbitmq", title = "RabbitMQ", syntax = "rabbitmq:exchangeName", - category = { Category.MESSAGING }) + category = { Category.MESSAGING }, headersClass = RabbitMQConstants.class) public class RabbitMQEndpoint extends DefaultEndpoint implements AsyncEndpoint { // header to indicate that the message body needs to be de-serialized public static final String SERIALIZE_HEADER = "CamelSerialize"; diff --git a/components/camel-rabbitmq/src/main/java/org/apache/camel/component/rabbitmq/RabbitMQMessageConverter.java b/components/camel-rabbitmq/src/main/java/org/apache/camel/component/rabbitmq/RabbitMQMessageConverter.java index 81443912f7a..7fe26390325 100644 --- a/components/camel-rabbitmq/src/main/java/org/apache/camel/component/rabbitmq/RabbitMQMessageConverter.java +++ b/components/camel-rabbitmq/src/main/java/org/apache/camel/component/rabbitmq/RabbitMQMessageConverter.java @@ -333,7 +333,7 @@ public class RabbitMQMessageConverter { } } if (properties.getTimestamp() != null) { - message.setHeader(Exchange.MESSAGE_TIMESTAMP, properties.getTimestamp().getTime()); + message.setHeader(RabbitMQConstants.MESSAGE_TIMESTAMP, properties.getTimestamp().getTime()); } } diff --git a/components/camel-reactive-streams/src/generated/resources/org/apache/camel/component/reactive/streams/reactive-streams.json b/components/camel-reactive-streams/src/generated/resources/org/apache/camel/component/reactive/streams/reactive-streams.json index 456515615ea..e52ff283681 100644 --- a/components/camel-reactive-streams/src/generated/resources/org/apache/camel/component/reactive/streams/reactive-streams.json +++ b/components/camel-reactive-streams/src/generated/resources/org/apache/camel/component/reactive/streams/reactive-streams.json @@ -32,6 +32,10 @@ "reactiveStreamsEngineConfiguration": { "kind": "property", "displayName": "Reactive Streams Engine Configuration", "group": "advanced", "label": "advanced", "required": false, "type": "object", "javaType": "org.apache.camel.component.reactive.streams.engine.ReactiveStreamsEngineConfiguration", "deprecated": false, "autowired": false, "secret": false, "description": "To use an existing reactive stream engine configuration." }, "serviceType": { "kind": "property", "displayName": "Service Type", "group": "advanced", "label": "advanced", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Set the type of the underlying reactive streams implementation to use. The implementation is looked up from the registry or using a ServiceLoader, the default implementation is DefaultCamelReactiveStreamsService" } }, + "headers": { + "CamelReactiveStreamsEventType": { "kind": "header", "displayName": "", "group": "consumer", "label": "consumer", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "Every exchange consumed by Camel has this header set to indicate if the exchange contains an item (value=onNext), an error (value=onError) or a completion event (value=onComplete). Errors and completion notification are not forwarded by [...] + "CamelReactiveStreamsCallback": { "kind": "header", "displayName": "", "group": "common", "label": "", "required": false, "javaType": "org.apache.camel.component.reactive.streams.api.DispatchCallback", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The callback." } + }, "properties": { "stream": { "kind": "path", "displayName": "Stream", "group": "common", "label": "", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Name of the stream channel used by the endpoint to exchange messages." }, "bridgeErrorHandler": { "kind": "parameter", "displayName": "Bridge Error Handler", "group": "consumer", "label": "consumer", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Allows for bridging the consumer to the Camel routing Error Handler, which mean any exceptions occurred while the consumer is trying to pickup incoming messages, or the likes, will now be processed as a m [...] diff --git a/components/camel-reactive-streams/src/main/docs/reactive-streams-component.adoc b/components/camel-reactive-streams/src/main/docs/reactive-streams-component.adoc index f18ade2c7e2..19a40200102 100644 --- a/components/camel-reactive-streams/src/main/docs/reactive-streams-component.adoc +++ b/components/camel-reactive-streams/src/main/docs/reactive-streams-component.adoc @@ -62,7 +62,9 @@ include::partial$component-endpoint-options.adoc[] // endpoint options: START // endpoint options: END - +// component headers: START +include::partial$component-endpoint-headers.adoc[] +// component headers: END == Usage diff --git a/components/camel-reactive-streams/src/main/java/org/apache/camel/component/reactive/streams/ReactiveStreamsConstants.java b/components/camel-reactive-streams/src/main/java/org/apache/camel/component/reactive/streams/ReactiveStreamsConstants.java index c7ce14fa145..353ac5a0ed3 100644 --- a/components/camel-reactive-streams/src/main/java/org/apache/camel/component/reactive/streams/ReactiveStreamsConstants.java +++ b/components/camel-reactive-streams/src/main/java/org/apache/camel/component/reactive/streams/ReactiveStreamsConstants.java @@ -16,6 +16,8 @@ */ package org.apache.camel.component.reactive.streams; +import org.apache.camel.spi.Metadata; + /** * Useful constants used in the Camel Reactive Streams component. */ @@ -30,8 +32,9 @@ public final class ReactiveStreamsConstants { * (value="onNext"), an error (value="onError") or a completion event (value="onComplete"). Errors and completion * notification are not forwarded by default. */ + @Metadata(label = "consumer", javaType = "String") public static final String REACTIVE_STREAMS_EVENT_TYPE = "CamelReactiveStreamsEventType"; - + @Metadata(description = "The callback.", javaType = "org.apache.camel.component.reactive.streams.api.DispatchCallback") public static final String REACTIVE_STREAMS_CALLBACK = "CamelReactiveStreamsCallback"; private ReactiveStreamsConstants() { diff --git a/components/camel-reactive-streams/src/main/java/org/apache/camel/component/reactive/streams/ReactiveStreamsEndpoint.java b/components/camel-reactive-streams/src/main/java/org/apache/camel/component/reactive/streams/ReactiveStreamsEndpoint.java index e865093b4a2..84c939c2a00 100644 --- a/components/camel-reactive-streams/src/main/java/org/apache/camel/component/reactive/streams/ReactiveStreamsEndpoint.java +++ b/components/camel-reactive-streams/src/main/java/org/apache/camel/component/reactive/streams/ReactiveStreamsEndpoint.java @@ -33,7 +33,7 @@ import org.apache.camel.support.DefaultEndpoint; */ @UriEndpoint(firstVersion = "2.19.0", scheme = "reactive-streams", title = "Reactive Streams", syntax = "reactive-streams:stream", - category = { Category.REACTIVE, Category.STREAMS }) + category = { Category.REACTIVE, Category.STREAMS }, headersClass = ReactiveStreamsConstants.class) @ManagedResource(description = "Managed ReactiveStreamsEndpoint") public class ReactiveStreamsEndpoint extends DefaultEndpoint { diff --git a/components/camel-rest/src/generated/resources/org/apache/camel/component/rest/rest.json b/components/camel-rest/src/generated/resources/org/apache/camel/component/rest/rest.json index 2ae80f02515..251211a32db 100644 --- a/components/camel-rest/src/generated/resources/org/apache/camel/component/rest/rest.json +++ b/components/camel-rest/src/generated/resources/org/apache/camel/component/rest/rest.json @@ -32,6 +32,14 @@ "producerComponentName": { "kind": "property", "displayName": "Producer Component Name", "group": "producer", "label": "producer", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "The Camel Rest component to use for (producer) the REST transport, such as http, undertow. If no component has been explicit configured, then Camel will lookup if there is a Camel component that integrates with the [...] "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": { + "CamelRestHttpQuery": { "kind": "header", "displayName": "", "group": "producer", "label": "producer", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The query parameters for the rest call to be used" }, + "CamelRestHttpUri": { "kind": "header", "displayName": "", "group": "producer", "label": "producer", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The http uri for the rest call to be used" }, + "CamelHttpMethod": { "kind": "header", "displayName": "", "group": "producer", "label": "producer", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The method should be in upper case" }, + "Content-Type": { "kind": "header", "displayName": "", "group": "producer", "label": "producer", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The media type such as: 'text\/xml', or 'application\/json' this REST service returns." }, + "Accept": { "kind": "header", "displayName": "", "group": "producer", "label": "producer", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The media type such as: 'text\/xml', or 'application\/json' this REST service accepts." }, + "CamelHttpResponseCode": { "kind": "header", "displayName": "", "group": "producer", "label": "producer", "required": false, "javaType": "Integer", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The http response code" } + }, "properties": { "method": { "kind": "path", "displayName": "Method", "group": "common", "label": "common", "required": true, "type": "string", "javaType": "java.lang.String", "enum": [ "get", "post", "put", "delete", "patch", "head", "trace", "connect", "options" ], "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "HTTP method to use." }, "path": { "kind": "path", "displayName": "Path", "group": "common", "label": "common", "required": true, "type": "string", "javaType": "java.lang.String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The base path" }, diff --git a/components/camel-rest/src/main/docs/rest-component.adoc b/components/camel-rest/src/main/docs/rest-component.adoc index 46496df0afd..d6b9568e3e9 100644 --- a/components/camel-rest/src/main/docs/rest-component.adoc +++ b/components/camel-rest/src/main/docs/rest-component.adoc @@ -38,7 +38,9 @@ include::partial$component-endpoint-options.adoc[] // endpoint options: START // endpoint options: END - +// component headers: START +include::partial$component-endpoint-headers.adoc[] +// component headers: END == Supported rest components diff --git a/components/camel-rest/src/main/java/org/apache/camel/component/rest/RestConstants.java b/components/camel-rest/src/main/java/org/apache/camel/component/rest/RestConstants.java new file mode 100644 index 00000000000..1e3973a19ca --- /dev/null +++ b/components/camel-rest/src/main/java/org/apache/camel/component/rest/RestConstants.java @@ -0,0 +1,44 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.camel.component.rest; + +import org.apache.camel.Exchange; +import org.apache.camel.spi.Metadata; + +public final class RestConstants { + + @Metadata(label = "producer", description = "The query parameters for the rest call to be used", javaType = "String") + public static final String REST_HTTP_QUERY = Exchange.REST_HTTP_QUERY; + @Metadata(label = "producer", description = "The http uri for the rest call to be used", javaType = "String") + public static final String REST_HTTP_URI = Exchange.REST_HTTP_URI; + @Metadata(label = "producer", description = "The method should be in upper case", javaType = "String") + public static final String HTTP_METHOD = Exchange.HTTP_METHOD; + @Metadata(label = "producer", + description = "The media type such as: 'text/xml', or 'application/json' this REST service returns.", + javaType = "String") + public static final String CONTENT_TYPE = Exchange.CONTENT_TYPE; + @Metadata(label = "producer", + description = "The media type such as: 'text/xml', or 'application/json' this REST service accepts.", + javaType = "String") + public static final String ACCEPT = "Accept"; + @Metadata(label = "producer", description = "The http response code", javaType = "Integer") + public static final String HTTP_RESPONSE_CODE = Exchange.HTTP_RESPONSE_CODE; + + private RestConstants() { + + } +} diff --git a/components/camel-rest/src/main/java/org/apache/camel/component/rest/RestEndpoint.java b/components/camel-rest/src/main/java/org/apache/camel/component/rest/RestEndpoint.java index e81cec871c7..5672a9a9730 100644 --- a/components/camel-rest/src/main/java/org/apache/camel/component/rest/RestEndpoint.java +++ b/components/camel-rest/src/main/java/org/apache/camel/component/rest/RestEndpoint.java @@ -50,7 +50,7 @@ import static org.apache.camel.support.RestProducerFactoryHelper.setupComponent; * Expose REST services or call external REST services. */ @UriEndpoint(firstVersion = "2.14.0", scheme = "rest", title = "REST", syntax = "rest:method:path:uriTemplate", - category = { Category.CORE, Category.REST }, lenientProperties = true) + category = { Category.CORE, Category.REST }, lenientProperties = true, headersClass = RestConstants.class) public class RestEndpoint extends DefaultEndpoint { public static final String[] DEFAULT_REST_CONSUMER_COMPONENTS diff --git a/components/camel-rest/src/main/java/org/apache/camel/component/rest/RestProducer.java b/components/camel-rest/src/main/java/org/apache/camel/component/rest/RestProducer.java index 7d701bf7ead..2835ff49a64 100644 --- a/components/camel-rest/src/main/java/org/apache/camel/component/rest/RestProducer.java +++ b/components/camel-rest/src/main/java/org/apache/camel/component/rest/RestProducer.java @@ -52,7 +52,6 @@ import static org.apache.camel.util.ObjectHelper.isNotEmpty; */ public class RestProducer extends DefaultAsyncProducer { - private static final String ACCEPT = "Accept"; private final CamelContext camelContext; private final RestConfiguration configuration; private boolean prepareUriTemplate = true; @@ -177,7 +176,7 @@ public class RestProducer extends DefaultAsyncProducer { if (query != null) { // the query parameters for the rest call to be used - inMessage.setHeader(Exchange.REST_HTTP_QUERY, query); + inMessage.setHeader(RestConstants.REST_HTTP_QUERY, query); } if (hasPath) { @@ -194,7 +193,7 @@ public class RestProducer extends DefaultAsyncProducer { overrideUri += "/" + resolvedUriTemplate; } // the http uri for the rest call to be used - inMessage.setHeader(Exchange.REST_HTTP_URI, overrideUri); + inMessage.setHeader(RestConstants.REST_HTTP_URI, overrideUri); // when chaining RestConsumer with RestProducer, the // HTTP_PATH header will be present, we remove it here @@ -209,17 +208,17 @@ public class RestProducer extends DefaultAsyncProducer { if (method != null) { // the method should be in upper case String upper = method.toUpperCase(Locale.US); - inMessage.setHeader(Exchange.HTTP_METHOD, upper); + inMessage.setHeader(RestConstants.HTTP_METHOD, upper); } final String produces = getEndpoint().getProduces(); - if (isEmpty(inMessage.getHeader(Exchange.CONTENT_TYPE)) && isNotEmpty(produces)) { - inMessage.setHeader(Exchange.CONTENT_TYPE, produces); + if (isEmpty(inMessage.getHeader(RestConstants.CONTENT_TYPE)) && isNotEmpty(produces)) { + inMessage.setHeader(RestConstants.CONTENT_TYPE, produces); } final String consumes = getEndpoint().getConsumes(); - if (isEmpty(inMessage.getHeader(ACCEPT)) && isNotEmpty(consumes)) { - inMessage.setHeader(ACCEPT, consumes); + if (isEmpty(inMessage.getHeader(RestConstants.ACCEPT)) && isNotEmpty(consumes)) { + inMessage.setHeader(RestConstants.ACCEPT, consumes); } } diff --git a/components/camel-rest/src/main/java/org/apache/camel/component/rest/RestProducerBindingProcessor.java b/components/camel-rest/src/main/java/org/apache/camel/component/rest/RestProducerBindingProcessor.java index 2fc4bdb4d6d..32db587dea3 100644 --- a/components/camel-rest/src/main/java/org/apache/camel/component/rest/RestProducerBindingProcessor.java +++ b/components/camel-rest/src/main/java/org/apache/camel/component/rest/RestProducerBindingProcessor.java @@ -270,7 +270,7 @@ public class RestProducerBindingProcessor extends DelegateAsyncProcessor { } if (skipBindingOnErrorCode) { - Integer code = exchange.getMessage().getHeader(Exchange.HTTP_RESPONSE_CODE, Integer.class); + Integer code = exchange.getMessage().getHeader(RestConstants.HTTP_RESPONSE_CODE, Integer.class); // if there is a custom http error code then skip binding if (code != null && code >= 300) { return; @@ -327,7 +327,7 @@ public class RestProducerBindingProcessor extends DelegateAsyncProcessor { return; } - contentType = exchange.getIn().getHeader(Exchange.CONTENT_TYPE, String.class); + contentType = exchange.getIn().getHeader(RestConstants.CONTENT_TYPE, String.class); // need to lower-case so the contains check below can match if using upper case contentType = contentType.toLowerCase(Locale.US); try { @@ -367,13 +367,13 @@ public class RestProducerBindingProcessor extends DelegateAsyncProcessor { // make sure there is a content-type with json String type = ExchangeHelper.getContentType(exchange); if (type == null) { - exchange.getIn().setHeader(Exchange.CONTENT_TYPE, "application/json"); + exchange.getIn().setHeader(RestConstants.CONTENT_TYPE, "application/json"); } } else if (isXml) { // make sure there is a content-type with xml String type = ExchangeHelper.getContentType(exchange); if (type == null) { - exchange.getIn().setHeader(Exchange.CONTENT_TYPE, "application/xml"); + exchange.getIn().setHeader(RestConstants.CONTENT_TYPE, "application/xml"); } } } diff --git a/components/camel-resteasy/src/generated/resources/org/apache/camel/component/resteasy/resteasy.json b/components/camel-resteasy/src/generated/resources/org/apache/camel/component/resteasy/resteasy.json index 7c5202837dc..f4c848eb078 100644 --- a/components/camel-resteasy/src/generated/resources/org/apache/camel/component/resteasy/resteasy.json +++ b/components/camel-resteasy/src/generated/resources/org/apache/camel/component/resteasy/resteasy.json @@ -43,6 +43,19 @@ "redirectHandlingDisabled": { "kind": "property", "displayName": "Redirect Handling Disabled", "group": "advanced", "label": "advanced", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Disables automatic redirect handling" }, "headerFilterStrategy": { "kind": "property", "displayName": "Header Filter Strategy", "group": "filter", "label": "filter", "required": false, "type": "object", "javaType": "org.apache.camel.spi.HeaderFilterStrategy", "deprecated": false, "autowired": false, "secret": false, "description": "To use a custom org.apache.camel.spi.HeaderFilterStrategy to filter header to and from Camel message." } }, + "headers": { + "CamelResteasyProxyMethod": { "kind": "header", "displayName": "", "group": "producer", "label": "producer", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The resteasy method to process the request" }, + "CamelResteasyProxyMethodArgs": { "kind": "header", "displayName": "", "group": "producer", "label": "producer", "required": false, "javaType": "java.util.ArrayList", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The proxy method params" }, + "CamelResteasyLogin": { "kind": "header", "displayName": "", "group": "producer", "label": "producer", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The username" }, + "CamelResteasyPassword": { "kind": "header", "displayName": "", "group": "producer", "label": "producer", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The password" }, + "CamelResteasyContextPath": { "kind": "header", "displayName": "", "group": "common", "label": "", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The context path" }, + "CamelResteasyHttpMethod": { "kind": "header", "displayName": "", "group": "producer", "label": "producer", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The resteasy method to process the request" }, + "CamelResteasyHttpRequest": { "kind": "header", "displayName": "", "group": "common", "label": "", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The http request" }, + "CamelResteasyProxyProducerException": { "kind": "header", "displayName": "", "group": "producer", "label": "producer", "required": false, "javaType": "Exception", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The proxy client exception" }, + "CamelHttpQuery": { "kind": "header", "displayName": "", "group": "producer", "label": "producer", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The http query" }, + "Content-Type": { "kind": "header", "displayName": "", "group": "producer", "label": "producer", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The content type" }, + "CamelHttpPath": { "kind": "header", "displayName": "", "group": "common", "label": "", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The http path" } + }, "properties": { "httpUri": { "kind": "path", "displayName": "Http Uri", "group": "common", "label": "common", "required": true, "type": "string", "javaType": "java.net.URI", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The url of the HTTP endpoint to call." }, "disableStreamCache": { "kind": "parameter", "displayName": "Disable Stream Cache", "group": "common", "label": "common", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Determines whether or not the raw input stream from Servlet is cached or not (Camel will read the stream into a in memory\/overflow to file, Stream caching) cache. By default Camel will cache the Servlet inpu [...] diff --git a/components/camel-resteasy/src/main/docs/resteasy-component.adoc b/components/camel-resteasy/src/main/docs/resteasy-component.adoc index 7700e4a2fe8..17121651884 100644 --- a/components/camel-resteasy/src/main/docs/resteasy-component.adoc +++ b/components/camel-resteasy/src/main/docs/resteasy-component.adoc @@ -49,6 +49,9 @@ include::partial$component-endpoint-options.adoc[] // endpoint options: END +// component headers: START +include::partial$component-endpoint-headers.adoc[] +// component headers: END === Usage diff --git a/components/camel-resteasy/src/main/java/org/apache/camel/component/resteasy/ResteasyConstants.java b/components/camel-resteasy/src/main/java/org/apache/camel/component/resteasy/ResteasyConstants.java index a572b851c3c..7f8ab940368 100644 --- a/components/camel-resteasy/src/main/java/org/apache/camel/component/resteasy/ResteasyConstants.java +++ b/components/camel-resteasy/src/main/java/org/apache/camel/component/resteasy/ResteasyConstants.java @@ -16,20 +16,37 @@ */ package org.apache.camel.component.resteasy; +import org.apache.camel.Exchange; +import org.apache.camel.spi.Metadata; + /** * Constants used in the Resteasy component * */ public final class ResteasyConstants { + @Metadata(label = "producer", description = "The resteasy method to process the request", javaType = "String") public static final String RESTEASY_PROXY_METHOD = "CamelResteasyProxyMethod"; + @Metadata(label = "producer", description = "The proxy method params", javaType = "java.util.ArrayList") public static final String RESTEASY_PROXY_METHOD_PARAMS = "CamelResteasyProxyMethodArgs"; + @Metadata(label = "producer", description = "The username", javaType = "String") public static final String RESTEASY_USERNAME = "CamelResteasyLogin"; + @Metadata(label = "producer", description = "The password", javaType = "String") public static final String RESTEASY_PASSWORD = "CamelResteasyPassword"; + @Metadata(description = "The context path", javaType = "String") public static final String RESTEASY_CONTEXT_PATH = "CamelResteasyContextPath"; public static final String RESTEASY_RESPONSE = "CamelResteasyResponse"; + @Metadata(label = "producer", description = "The resteasy method to process the request", javaType = "String") public static final String RESTEASY_HTTP_METHOD = "CamelResteasyHttpMethod"; + @Metadata(description = "The http request", javaType = "String") public static final String RESTEASY_HTTP_REQUEST = "CamelResteasyHttpRequest"; + @Metadata(label = "producer", description = "The proxy client exception", javaType = "Exception") public static final String RESTEASY_PROXY_PRODUCER_EXCEPTION = "CamelResteasyProxyProducerException"; + @Metadata(label = "producer", description = "The http query", javaType = "String") + public static final String HTTP_QUERY = Exchange.HTTP_QUERY; + @Metadata(label = "producer", description = "The content type", javaType = "String") + public static final String CONTENT_TYPE = Exchange.CONTENT_TYPE; + @Metadata(description = "The http path", javaType = "String") + public static final String HTTP_PATH = Exchange.HTTP_PATH; /** * Utility classes should not have a public constructor. diff --git a/components/camel-resteasy/src/main/java/org/apache/camel/component/resteasy/ResteasyEndpoint.java b/components/camel-resteasy/src/main/java/org/apache/camel/component/resteasy/ResteasyEndpoint.java index 4798ff4e5c8..1676c70b1de 100644 --- a/components/camel-resteasy/src/main/java/org/apache/camel/component/resteasy/ResteasyEndpoint.java +++ b/components/camel-resteasy/src/main/java/org/apache/camel/component/resteasy/ResteasyEndpoint.java @@ -34,7 +34,8 @@ import org.slf4j.LoggerFactory; * Expose REST endpoints and access external REST servers. */ @UriEndpoint(firstVersion = "3.4.0", scheme = "resteasy", extendsScheme = "http", - title = "Resteasy", syntax = "resteasy:httpUri", category = { Category.REST }) + title = "Resteasy", syntax = "resteasy:httpUri", category = { Category.REST }, + headersClass = ResteasyConstants.class) @Metadata(excludeProperties = "clientConnectionManager,connectionsPerRoute,connectionTimeToLive," + "httpBinding,httpClientConfigurer,httpConfiguration,httpContext,httpRegistry,maxTotalConnections,connectionRequestTimeout," + "connectTimeout,socketTimeout,cookieStore,x509HostnameVerifier,sslContextParameters," diff --git a/components/camel-resteasy/src/main/java/org/apache/camel/component/resteasy/ResteasyProducer.java b/components/camel-resteasy/src/main/java/org/apache/camel/component/resteasy/ResteasyProducer.java index 8d289c0de46..4fddd18039c 100644 --- a/components/camel-resteasy/src/main/java/org/apache/camel/component/resteasy/ResteasyProducer.java +++ b/components/camel-resteasy/src/main/java/org/apache/camel/component/resteasy/ResteasyProducer.java @@ -61,12 +61,12 @@ public class ResteasyProducer extends DefaultProducer { ResteasyEndpoint resteasyEndpoint = ObjectHelper.cast(ResteasyEndpoint.class, getEndpoint()); Map<String, String> parameters = getParameters(exchange, resteasyEndpoint); - String query = exchange.getIn().getHeader(Exchange.HTTP_QUERY, String.class); + String query = exchange.getIn().getHeader(ResteasyConstants.HTTP_QUERY, String.class); String uri = resteasyEndpoint.buildUri(); if (query != null) { LOG.debug("Adding query: {} to uri: {}", query, uri); uri = addQueryToUri(uri, query); - LOG.debug("URI: {} populated via Exchange.HTTP_QUERY header", uri); + LOG.debug("URI: {} populated via ResteasyConstants.HTTP_QUERY header", uri); } WebTarget resteasyWebTarget = createWebClientTarget(uri); @@ -247,7 +247,7 @@ public class ResteasyProducer extends DefaultProducer { String body = exchange.getIn().getBody(String.class); LOG.debug("Body in producer: {}", body); - String mediaType = exchange.getIn().getHeader(Exchange.CONTENT_TYPE, String.class); + String mediaType = exchange.getIn().getHeader(ResteasyConstants.CONTENT_TYPE, String.class); LOG.debug("Populate Resteasy request from exchange body: {} using media type {}", body, mediaType); diff --git a/components/camel-resteasy/src/main/java/org/apache/camel/component/resteasy/servlet/ResteasyCamelServlet.java b/components/camel-resteasy/src/main/java/org/apache/camel/component/resteasy/servlet/ResteasyCamelServlet.java index 419251cd4a8..fccd37f9776 100644 --- a/components/camel-resteasy/src/main/java/org/apache/camel/component/resteasy/servlet/ResteasyCamelServlet.java +++ b/components/camel-resteasy/src/main/java/org/apache/camel/component/resteasy/servlet/ResteasyCamelServlet.java @@ -241,11 +241,11 @@ public class ResteasyCamelServlet extends HttpServletDispatcher implements HttpR // Maybe send request to camel also for some logging or something exchange.getIn().setHeader(ResteasyConstants.RESTEASY_HTTP_REQUEST, httpServletRequest); - String httpPath = (String) exchange.getIn().getHeader(Exchange.HTTP_PATH); + String httpPath = (String) exchange.getIn().getHeader(ResteasyConstants.HTTP_PATH); // here we just remove the CamelServletContextPath part from the HTTP_PATH if (contextPath != null && httpPath.startsWith(contextPath)) { - exchange.getIn().setHeader(Exchange.HTTP_PATH, + exchange.getIn().setHeader(ResteasyConstants.HTTP_PATH, httpPath.substring(contextPath.length())); } diff --git a/components/camel-robotframework/src/generated/resources/org/apache/camel/component/robotframework/robotframework.json b/components/camel-robotframework/src/generated/resources/org/apache/camel/component/robotframework/robotframework.json index 3f0c8642f3e..22b9b62cab8 100644 --- a/components/camel-robotframework/src/generated/resources/org/apache/camel/component/robotframework/robotframework.json +++ b/components/camel-robotframework/src/generated/resources/org/apache/camel/component/robotframework/robotframework.json @@ -74,6 +74,11 @@ "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 [...] "configuration": { "kind": "property", "displayName": "Configuration", "group": "advanced", "label": "advanced", "required": false, "type": "object", "javaType": "org.apache.camel.component.robotframework.RobotFrameworkCamelConfiguration", "deprecated": false, "autowired": false, "secret": false, "description": "The configuration" } }, + "headers": { + "CamelRobotVariables": { "kind": "header", "displayName": "", "group": "common", "label": "", "required": false, "javaType": "List<String>", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The robot variables." }, + "CamelRobotReturnCode": { "kind": "header", "displayName": "", "group": "common", "label": "", "required": false, "javaType": "Integer", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The return code." }, + "CamelRobotResourceUri": { "kind": "header", "displayName": "", "group": "common", "label": "", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The new resource URI." } + }, "properties": { "resourceUri": { "kind": "path", "displayName": "Resource Uri", "group": "common", "label": "", "required": true, "type": "string", "javaType": "java.lang.String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "Path to the resource. You can prefix with: classpath, file, http, ref, or bean. classpath, file and http loads the resource using these protocols (classpath is default). ref will lookup the resource in the registry. bean will c [...] "allowContextMapAll": { "kind": "parameter", "displayName": "Allow Context Map All", "group": "common", "label": "", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "configurationClass": "org.apache.camel.component.robotframework.RobotFrameworkCamelConfiguration", "configurationField": "configuration", "description": "Sets whether the context map should allow access to all details. By defaul [...] diff --git a/components/camel-robotframework/src/main/docs/robotframework-component.adoc b/components/camel-robotframework/src/main/docs/robotframework-component.adoc index 423ec3bb3d7..a5d5e1cecd4 100644 --- a/components/camel-robotframework/src/main/docs/robotframework-component.adoc +++ b/components/camel-robotframework/src/main/docs/robotframework-component.adoc @@ -58,9 +58,13 @@ include::partial$component-endpoint-options.adoc[] // endpoint options: END +// component headers: START +include::partial$component-endpoint-headers.adoc[] +// component headers: END + == Samples -For example you could use something like: +For example, you could use something like: [source,java] ---- diff --git a/components/camel-robotframework/src/main/java/org/apache/camel/component/robotframework/RobotFrameworkCamelConstants.java b/components/camel-robotframework/src/main/java/org/apache/camel/component/robotframework/RobotFrameworkCamelConstants.java index 8fa39857be3..feb98b43f6d 100644 --- a/components/camel-robotframework/src/main/java/org/apache/camel/component/robotframework/RobotFrameworkCamelConstants.java +++ b/components/camel-robotframework/src/main/java/org/apache/camel/component/robotframework/RobotFrameworkCamelConstants.java @@ -16,10 +16,15 @@ */ package org.apache.camel.component.robotframework; +import org.apache.camel.spi.Metadata; + public interface RobotFrameworkCamelConstants { + @Metadata(description = "The robot variables.", javaType = "List<String>") String CAMEL_ROBOT_VARIABLES = "CamelRobotVariables"; + @Metadata(description = "The return code.", javaType = "Integer") String CAMEL_ROBOT_RETURN_CODE = "CamelRobotReturnCode"; + @Metadata(description = "The new resource URI.", javaType = "String") String CAMEL_ROBOT_RESOURCE_URI = "CamelRobotResourceUri"; } diff --git a/components/camel-robotframework/src/main/java/org/apache/camel/component/robotframework/RobotFrameworkEndpoint.java b/components/camel-robotframework/src/main/java/org/apache/camel/component/robotframework/RobotFrameworkEndpoint.java index 7cf6fbc000f..a3f3d8040b0 100644 --- a/components/camel-robotframework/src/main/java/org/apache/camel/component/robotframework/RobotFrameworkEndpoint.java +++ b/components/camel-robotframework/src/main/java/org/apache/camel/component/robotframework/RobotFrameworkEndpoint.java @@ -33,7 +33,8 @@ import org.robotframework.RobotFramework; * Pass camel exchanges to acceptence test written in Robot DSL. */ @UriEndpoint(firstVersion = "3.0.0", scheme = "robotframework", title = "Robot Framework", - syntax = "robotframework:resourceUri", category = { Category.TESTING }) + syntax = "robotframework:resourceUri", category = { Category.TESTING }, + headersClass = RobotFrameworkCamelConstants.class) public class RobotFrameworkEndpoint extends ResourceEndpoint { @UriParam diff --git a/components/camel-rss/src/generated/resources/org/apache/camel/component/rss/rss.json b/components/camel-rss/src/generated/resources/org/apache/camel/component/rss/rss.json index b8b9c25125f..7c0f8893e2f 100644 --- a/components/camel-rss/src/generated/resources/org/apache/camel/component/rss/rss.json +++ b/components/camel-rss/src/generated/resources/org/apache/camel/component/rss/rss.json @@ -25,6 +25,9 @@ "bridgeErrorHandler": { "kind": "property", "displayName": "Bridge Error Handler", "group": "consumer", "label": "consumer", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Allows for bridging the consumer to the Camel routing Error Handler, which mean any exceptions occurred while the consumer is trying to pickup incoming messages, or the likes, will now be processed as a me [...] "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": { + "CamelRssFeed": { "kind": "header", "displayName": "", "group": "consumer", "label": "", "required": false, "javaType": "Object", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The entire SyncFeed object." } + }, "properties": { "feedUri": { "kind": "path", "displayName": "Feed Uri", "group": "consumer", "label": "", "required": true, "type": "string", "javaType": "java.lang.String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The URI to the feed to poll." }, "bridgeErrorHandler": { "kind": "parameter", "displayName": "Bridge Error Handler", "group": "consumer", "label": "consumer", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Allows for bridging the consumer to the Camel routing Error Handler, which mean any exceptions occurred while the consumer is trying to pickup incoming messages, or the likes, will now be processed as a m [...] diff --git a/components/camel-rss/src/main/docs/rss-component.adoc b/components/camel-rss/src/main/docs/rss-component.adoc index be35e1ce010..d13d4adbea5 100644 --- a/components/camel-rss/src/main/docs/rss-component.adoc +++ b/components/camel-rss/src/main/docs/rss-component.adoc @@ -51,7 +51,9 @@ include::partial$component-endpoint-options.adoc[] // endpoint options: START // endpoint options: END - +// component headers: START +include::partial$component-endpoint-headers.adoc[] +// component headers: END == Exchange data types @@ -68,16 +70,6 @@ a `SyndFeed` with one `SyndEntry` or a `java.util.List` of `SyndEntrys`. |`splitEntries` |`false` |The entire list of entries from the current feed is set in the exchange. |======================================================================= -== Message Headers - -[width="100%",cols="10%,90%",options="header",] -|======================================================================= -|Header |Description - -|`CamelRssFeed` |The entire `SyncFeed` object. -|======================================================================= - - == Example If the URL for the RSS feed uses query parameters, this component will diff --git a/components/camel-rss/src/main/java/org/apache/camel/component/rss/RssConstants.java b/components/camel-rss/src/main/java/org/apache/camel/component/rss/RssConstants.java index 33cebd43c87..c636b3d1b0b 100644 --- a/components/camel-rss/src/main/java/org/apache/camel/component/rss/RssConstants.java +++ b/components/camel-rss/src/main/java/org/apache/camel/component/rss/RssConstants.java @@ -16,15 +16,18 @@ */ package org.apache.camel.component.rss; +import org.apache.camel.spi.Metadata; + /** * RSS Constants. */ public final class RssConstants { /** - * Header key for the {@link com.sun.syndication.feed.synd.SyndFeed} object is stored on the in message on the + * Header key for the {@link com.rometools.rome.feed.synd.SyndFeed} object is stored on the in message on the * exchange. */ + @Metadata(description = "The entire `SyncFeed` object.", javaType = "Object") public static final String RSS_FEED = "CamelRssFeed"; private RssConstants() { diff --git a/components/camel-rss/src/main/java/org/apache/camel/component/rss/RssEndpoint.java b/components/camel-rss/src/main/java/org/apache/camel/component/rss/RssEndpoint.java index c17b251702f..c70f395e64f 100644 --- a/components/camel-rss/src/main/java/org/apache/camel/component/rss/RssEndpoint.java +++ b/components/camel-rss/src/main/java/org/apache/camel/component/rss/RssEndpoint.java @@ -36,7 +36,8 @@ import org.slf4j.LoggerFactory; * Poll RSS feeds. */ @UriEndpoint(firstVersion = "2.0.0", scheme = "rss", extendsScheme = "atom", title = "RSS", - syntax = "rss:feedUri", consumerOnly = true, category = { Category.RSS }, lenientProperties = true) + syntax = "rss:feedUri", consumerOnly = true, category = { Category.RSS }, lenientProperties = true, + headersClass = RssConstants.class) public class RssEndpoint extends FeedEndpoint { protected static final Logger LOG = LoggerFactory.getLogger(RssEndpoint.class);