Spark Rest

Spark Rest

Scheme: spark-rest
Syntax: spark-rest:verb:path
Description: The spark-rest component is used for hosting REST services which has been defined using Camel rest-dsl.
Deprecated:false
ConsumerOnly:true
Async:false
Maven: org.apache.camel/camel-spark-rest/2.18.1.redhat-000012

The spark-rest component is used for hosting REST services which has been defined using Camel rest-dsl.

Name Kind Group Required Default Type Enum Description
verb path consumer true java.lang.String get
post
put
patch
delete
head
trace
connect
options
get, post, put, patch, delete, head, trace, connect, or options.
path path consumer true java.lang.String The content path which support Spark syntax.
accept parameter consumer java.lang.String Accept type such as: 'text/xml', or 'application/json'. By default we accept all kinds of types.
bridgeErrorHandler parameter consumer boolean 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 message and handled by the routing Error Handler. By default the consumer will use the org.apache.camel.spi.ExceptionHandler to deal with exceptions, that will be logged at WARN/ERROR level and ignored.
disableStreamCache parameter consumer boolean Determines whether or not the raw input stream from Spark HttpRequest#getContent() is cached or not (Camel will read the stream into a in light-weight memory based Stream caching) cache. By default Camel will cache the Netty input stream to support reading it multiple times to ensure Camel can retrieve all data from the stream. However you can set this option to true when you for example need to access the raw stream, such as streaming it directly to a file or other persistent store. Mind that if you enable this option, then you cannot read the Netty stream multiple times out of the box, and you would need manually to reset the reader index on the Spark raw stream.
mapHeaders parameter consumer true boolean If this option is enabled, then during binding from Spark to Camel Message then the headers will be mapped as well (eg added as header to the Camel Message as well). You can turn off this option to disable this. The headers can still be accessed from the org.apache.camel.component.sparkrest.SparkMessage message with the method getRequest() that returns the Spark HTTP request instance.
transferException parameter consumer boolean If enabled and an Exchange failed processing on the consumer side, and if the caused Exception was send back serialized in the response as a application/x-java-serialized-object content type.

This is by default turned off. If you enable this then be aware that Java will deserialize the incoming data from the request to Java and that can be a potential security risk.

urlDecodeHeaders parameter consumer boolean If this option is enabled, then during binding from Spark to Camel Message then the header values will be URL decoded (eg %20 will be a space character.)
exceptionHandler parameter consumer (advanced) org.apache.camel.spi.ExceptionHandler To let the consumer use a custom ExceptionHandler. Notice if the option bridgeErrorHandler is enabled then this options is not in use. By default the consumer will deal with exceptions, that will be logged at WARN/ERROR level and ignored.
exchangePattern parameter consumer (advanced) org.apache.camel.ExchangePattern InOnly
RobustInOnly
InOut
InOptionalOut
OutOnly
RobustOutOnly
OutIn
OutOptionalIn
Sets the exchange pattern when the consumer creates an exchange.
matchOnUriPrefix parameter advanced boolean Whether or not the consumer should try to find a target consumer by matching the URI prefix if no exact match is found.
sparkBinding parameter advanced org.apache.camel.component.sparkrest.SparkBinding To use a custom SparkBinding to map to/from Camel message.
synchronous parameter advanced false boolean Sets whether synchronous processing should be strictly used, or Camel is allowed to use asynchronous processing (if supported).

spark-rest consumer