Skip to content

Http

The http listens for incoming connections, accepting HTTP/1.1 POST requests and processing them accordingly.

HttpSourceConfig<CharSequence> config = HttpSourceConfigBuilder
         .<CharSequence>builder()
         .withAddress("0.0.0.0", 8080)
         .withExceptionHandler(...)
         .withDecoder(Decoders.toCharSequenceDecoder())
         .build();
source:
   http:
     address: '0.0.0.0:8080'
     path: "/basket"
     expectedContentTypes:
       - application/json
       - text/plain
     headers:
       - Content-Type
       - CustomHeader
     readIdleTimeout: PT1M

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

If no address is provided, the server defaults to 0.0.0.0, which binds it to all available network interfaces.

Required.

Type: object

Default value: 0.0.0.0

Fields of address:

address.host

Type: string

address.port

Type: number

address.hasBracketlessColons

Type: boolean

decoder

Decoder applied to incoming data. Converts input into a usable format. For built-in decoder implementations, see org.voltdb.stream.api.network.Decoders.

Required.

Type: object

path

The URI path on which the HTTP server listens for incoming requests. For example, '/' for the root context, or '/basket' for a specific subpath.

Type: string

Default value: /

headers

A set of headers extracted from the HTTP request, if present, to be propagated further down the pipeline.

Type: array

maxContentSize

Specifies the maximum size (in bytes) of incoming content that the server will accept. The default limit is 1 MB to prevent excessive memory usage.

Type: number

Default value: 1048576

expectedContentTypes

List of accepted content types. Defaults to accepting any type if not specified.

Type: array

readIdleTimeout

Read idle timeout. Closes the connection if no inbound data is received.

Type: object

Default value: PT1M

exceptionHandler

Custom exception handler enabling interception of all errors related to this source.

Type: object

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

JSON Schema

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

Usage Examples

 stream
        .withName("Read data from HTTP server and print to stdout")
        .consumeFromSource(
            HttpSourceConfigBuilder.builder()
                .withDecoder(Decoders.toCharSequenceDecoder())
                .withAddress(HostAndPort.fromParts("0.0.0.0", 8080))
                .withPath("/basket")
                .withExpectedContentTypes("application/json", "text/plain")
                .withHeaders("Content-Type", "CustomHeader")
                .withReadIdleTimeout(Duration.ofMillis(1))
        )
        .terminateWithSink(Sinks.stdout());