Worker implementation which sends HTTP request on configured endpoint.
Configuration can define following properties:
async
- Can betrue
orfalse
. Determines whether messages will be sent in asynchronous fashion or not. Optional, if not specified defaults tofalse
.keep-alive
- Can betrue
orfalse
. Determines whether HTTP keep-alive is enabled or disabled. Optional, defaults totrue
.max-connections
- The maximum number of connections a HTTP client can handle, or-1
for no connection limit. Optional, if not specified defaults to-1
.max-connections-per-host
- The maximum number of connections per host a HTTP client can handle, or-1
for no connection limit. Optional, if not specified defaults to-1
.connect-timeout
- The maximum time in millisecond a HTTP client can wait when connecting to a remote host. Optional, if not specified defaults to5000
.read-timeout
- The maximum time in millisecond a HTTP client can stay idle. Optional, if not specified defaults to60000
.pooled-connection-idle-timeout
- The maximum time in millisecond a HTTP client will keep connection in pool. Optional, if not specified defaults to60000
.request-timeout
- The maximum time in millisecond a HTTP client waits until the response is completed. Optional, if not specified defaults to60000
.follow-redirect
- Can betrue
orfalse
. Determines whether HTTP redirect is enabled. Optional, if not specified defaults totrue
.max-redirects
- The maximum number of HTTP redirects. Optional, if not specified defaults to5
.max-request-retry
- The number of time the library will retry when an error occurs by the remote server. Optional, if not specified defaults to5
.connection-ttl
- The maximum time in millisecond a HTTP client will keep connection in the pool, or-1
to keep connection while possible. Optional, if not specified defaults to-1
.base-url
- Can be concatenated with request propertyurl-sufix
to construct URL. Optional, depending on whetherurl
orurl-sufix
is specified.headers
- Contains headers in a form of name-value map which will be added to each request. Optional.error-codes
- List of HTTP codes that should be considered errors. Optional, defaults to all4**
and5**
codes.
Worker accept
method expects following properties:
url
- Whole url to be used, it ignoresbase-url
. Mutually exclusive withurl-sufix
.url-sufix
- Concatenates tobase-url
to construct url. Mutually exclusive withurl
.method-type
- Method type of the request. Mandatory.headers
- Header names with its values. It will override headers with same name defined in configuration. Optional.body
- Payload of the request. Available only whenPOST
orPUT
method types are used. Optional.
Example yaml configuration:
worker-configuration:
async: false
keep-alive: true
max-connections: -1
max-connections-per-host: -1
connect-timeout: 5000
read-timeout: 60000
pooled-connection-idle-timeout: 60000
request-timeout: 60000
follow-redirect: true
max-redirects: 5
max-request-retry: 5
connection-ttl: -1
base-url: http://localhost:8080/api/item
headers:
Content-Type: application/json
X-Custom-Header-1: custom-value
error-codes:
- 400
- 401
- 403
- 404
For whole configuration, take a look at Ranger-HTTP example.