HTTP outbound channel adapter
Used to send (unidirectional) HTTP messages.
An adapter that sends HTTP requests in a unidirectional way. This means that a successful HTTP response will simply execute without sending any messages to a reply channel. In the case of any non-successful HTTP response status code, it will throw an exception.
If you are interested in the contents of the response message, use a HTTP outbound gateway instead.
URL
URL to which the requests should be sent. It may include {placeholders}
for evaluation against URI variables.
HTTP method
The HTTP method to use when executing requests with this gateway.
Default is POST
.
Expected response type
The expected type to which the response body should be converted. Default is org.springframework.http.ResponseEntity
.
To take advantage of the HTTP message converters registered on this gateway provide a different type, for example java.lang.String
.
Expression to be evaluated against the message to replace a URI {placeholder}
with the evaluation result.
URL expression
SpEL expression resolving to a URL to which the requests should be sent. The resolved value may include {placeholders}
for further evaluation against URI variables.
Optional ; mutually exclusive with URL.
Encode URI
When set to false
, the real URI won't be encoded before the request is sent. This may be useful in some scenarios as it allows user control over the encoding, if needed, for example by using the URL expression.
Default is true
.
HTTP method expression
SpEL expression to dynamically determine the HTTP method (POST
, GET
, etc) to use when executing requests with this adapter.
Optional ; mutually exclusive with HTTP method.
Note that the standard JDK HTTP library does not support the HTTP PATCH
method. Use a custom REST template support object configured with the Apache HttpComponents request factory to enable PATCH
.
Expected response type expression
SpEL expression to determine the type for the expected response to which the response body should be converted. The returned value of the expression could be an instance of java.lang.Class
or java.lang.String
representing a fully qualified class name.
Optional ; mutually exclusive with expected response type.
Extract payload
Specify whether the outbound message's payload should be extracted when preparing the request body; otherwise the message itself will be serialized.
Default value is true
.
Mapped request headers
Comma-separated list of names of message headers to be mapped into the HTTP headers of the HTTP request. The values in this list can also be simple patterns to be matched against the header names (e.g. foo
or foo
). The string HTTP_REQUEST_HEADERS
will match against any of the standard HTTP request headers.
All standard HTTP request headers are mapped by default.
Note that all non-standard headers will automatically be prefixed with X-
. This behaviour can be changed by using a custom header mapper.
Header mapper
A custom HeaderMapper
implementation can be used to fully control the mapping between message headers and HTTP headers. For example, to configure whether to use the X-
prefix for user-defined HTTP headers or not.
This setting is mutually exclusive with mapped request headers.
Charset
Specify the charset name to use for converting string-typed payloads to bytes.
Default is UTF-8
.
REST template
Allows for specifying a custom RestTemplate
.
A REST template provides a configurable extension point for communicating with HTTP servers using RESTful principles. This can be used to add authentication to HTTP connections, for example.
Advice can be added to change the behaviour of this endpoint, for example to add retry logic in case of failures. The following types of advice are available:
Retry advice: allows configuration of sophisticated retry scenarios; this includes specifying policies for retry attemps, backoff periods between attempts and the recovery strategy when retries are exhausted Circuit breaker: if a certain number of consecutive attempts fails, new requests will fail fast and no attempt will be made to invoke the request handler again until some time has expired Expression evaluating advice: general advice that evaluates a configurable SpEL expression on successful and/or failed attempts, and optionally can send a message to a success channel and/or failure channel
By adding multiple advices to this endpoint you can create even more complex combined behaviour. For example, if you add a circuit breaker and a retry advice, you can create a scenario where the circuit breaker only opens when all retries are exhaused. Note that the order of the advice types is important, as switching the order will change the combined behaviour: the first item in the list will be the top of the advice chain, meaning it will be the last advice that is evaluated. Also note that if any advice "traps" exceptions, all advices higher up in the chain won't know about any failures.
Channel
Channel to consume messages from.
Required
Id
Name that uniquely identifies this flow component.
Required