Skip to content

Http-client

The http-client configures a client that can connect and exchanges http(s) messages with configured downstream HTTP(s) server over single connection. For protocols HTTP/1.0 and HTTP/1.1 the client represent synchronous communication where requests are processed one-by-one by a server. The client can be shared by multiple workers but each worker must create its own connection. If server doesn't close the connection, it will be reused for subsequent requests.

If server is not available or connection has been closed, client will re-connect each time new request arrives. In other words, if there are no request in the pipeline, this client will not try to connect.

.configureResource(HttpClientResourceConfigBuilder.builder()
    .withAddress(builder -> builder
        .withHost(value)
        .withPort(value)
        .withHasBracketlessColons(value)
    )
    .withMinimalProtocol(value)
    .withConnectTimeout(value)
    .withRequestTimeout(value)
    .withShutdownGracePeriod(value)
    .withSsl(builder -> builder
        .withTrustStoreFile(value)
        .withTrustStorePassword(value)
        .withKeyStoreFile(value)
        .withKeyStorePassword(value)
        .withKeyPassword(value)
        .withInsecure(value)
        .withHostnameVerifier(value)
    )
    .withSocketOptions(value)
    .withMaxContentSize(builder -> builder
        .withBytes(value)
    )
)
resource:
  http-client:
    address:
      host: value
      port: value
      hasBracketlessColons: value
    minimalProtocol: value
    connectTimeout: value
    requestTimeout: value
    shutdownGracePeriod: value
    ssl:
      trustStoreFile: value
      trustStorePassword: value
      keyStoreFile: value
      keyStorePassword: value
      keyPassword: value
      insecure: value
      hostnameVerifier: value
    socketOptions: value
    maxContentSize:
      bytes: value

Java dependency management

Add this declaration to your dependency management system to access the configuration DSL for this plugin in Java.

<dependency>
    <groupId>org.voltdb</groupId>
    <artifactId>volt-stream-plugin-http-api</artifactId>
    <version>1.6.0</version>
</dependency>
implementation group: 'org.voltdb', name: 'volt-stream-plugin-http-api', version: '1.6.0'

Properties

address

Downstream server's address to connect to. Required.

Type: object

Fields of address:

address.host

Type: string

address.port

Type: number

address.hasBracketlessColons

Type: boolean

minimalProtocol

Specifies minimal protocol supported by a remote server. Type: object

Supported values: http_10, http_11.

Default value: HTTP_11

connectTimeout

Connection timeout. Type: object

Default value: PT20S

requestTimeout

Max timeout to wait before marking the request as unsuccessful. Type: object

Default value: PT1S

shutdownGracePeriod

Client should block and await for all connections to be drained. Type: object

Default value: PT5S

ssl

Secure transport configuration. Type: object

Fields of ssl:

ssl.trustStoreFile

Truststore file or trusted CA certificate; supported formats include JKS, PKCS#12, or PEM. Type: string

ssl.trustStorePassword

Truststore password. Type: string

ssl.keyStoreFile

Keystore file; supported formats include JKS, PKCS#12, or PEM Type: string

ssl.keyStorePassword

Keystore password. Type: string

ssl.keyPassword

Private key password. Optional — if not set, the key store password will be used. Type: string

ssl.insecure

If set to true, disables SSL certificate and hostname validation. Intended for debugging purposes only. Doesn't work with mTLS.

Type: boolean

ssl.hostnameVerifier

Custom hostname verifier for SSL connections. If not specified and 'insecure' is true, hostname verification will be disabled.

Type: object

socketOptions

Configures operating system options to be applied to the server socket. Supported values are: - SO_SNDBUF, - SO_RCVBUF, - SO_TIMEOUT, - SO_KEEPALIVE, - SO_LINGER, - SO_BACKLOG, - TCP_NODELAY.

Type: object

maxContentSize

Maximal content size in bytes Type: object

Default value: 500kb

Fields of maxContentSize:

maxContentSize.bytes

Type: number

JSON Schema

You can validate or explore the configuration using its JSON Schema.

Usage Examples

 stream
        .withName("Exchange data with HTTP server")
        .configureResource("a-http-client", HttpClientResourceConfigBuilder.builder()
               .withAddress(HostAndPort.fromParts("localhost", 9090))
               .withMinimalProtocol(HttpProtocol.HTTPS_11)
               ...
               )
        .consumeFromSource(...)
        .terminateWithSink(...);
resources:
- name: a-http-client
  http-client:
    address: localhost:32112
    ...
source:
  ...
sink:
  ...