About the HTTP client transport
The HTTP client is a transport for use in connectivity plug-ins which can connect to external services over HTTP/REST, perform requests on them and return the response as an event. It can be used by either customizing what codec to use (for example, the JSON codec) and what events to map to, or it can be used using generic events and a predefined chain using a JSON codec, where instances are managed via an EPL API and JSON payloads are sent and received. Mapping to events requires more preparation, but gives a powerful type-safe interface for accessing the results and can support more complex mappings and codecs other than JSON, while the generic events allow quick access to simple services over JSON.
The HTTP client transport can encode HTTP requests and decode HTTP responses with gzip or deflate compression format. It also supports HTML form encoding and can encode a dictionary payload to either multipart/form-data or application/x-www-form-urlencoded media types.
When using the event mappings, for each service (host and port combination) that you want to connect to, you must create a new instance of a connectivity chain in your configuration file. To use the service, you send events to that chain, where the events are correctly mapped as described in
Mapping events between EPL and HTTP client requests. The response is sent back by the same chain instance, with the configured mapping rules.
This transport does not provide a dynamic chain manager. So chains are created either dynamically from EPL using
ConnectivityPlugins.createDynamicChain and a named chain definition specified in the
dynamicChains section of the YAML configuration file, or statically using the
startChains section of the YAML configuration file. For more information on YAML configuration files, see
Using Connectivity Plug-ins and especially
Configuration file for connectivity plug-ins.
Note:
When you are using the
generic event definitions, dynamic chains are always used. See
Using predefined generic event definitions to invoke HTTP services
with JSON and string payloads for further information.
Persistent connections to the server are used for multiple requests if this is supported by the service. Connection details to the service are part of the configuration of the transport in the configuration file. Details of the individual requests are configured through the events sent to the chain. The HTTP client supports HTTP version 1.1 and TLS version 1.2 and above.
The HTTP client is designed to talk to REST services and supports GET, POST, PUT and DELETE operations.
Note:
The HTTP client connectivity plug-in does not support reliable messaging.