HTTP Source connector
The HTTP Source connector is a Stateless NiFi dataflow developed by Cloudera that is running in the Kafka Connect framework. Learn about the connector, its properties, and configuration.
The HTTP Source connector listens on a port for HTTP POST requests and transfers the request
body to a Kafka topic. The Kafka topic this connector transfers messages to is determined by
the value of the topics
property. The connector does not perform record
processing, the messages are transferred to Kafka as they are received in the HTTP request.
The connector uses HTTPS for secure communication. Optionally, client certificate
authentication (mutual TLS) can also be configured.
Properties and configuration
Configuration is passed to the connector in a JSON file during creation. The properties of the connector can be categorized into three groups. These are as follows:
- Common connector properties
- These are the properties of the Kafka Connect framework that are accepted by all connectors. For a comprehensive list of these properties, see the Apache Kafka documentation.
- Stateless NiFi Source properties
- These are the properties that are specific to the Stateless NiFi Source connector. All Stateless NiFi Source connectors share and accept these properties. For a comprehensive list of these properties, see the Stateless NiFi Source property reference.
- Connector/dataflow-specific properties
- These properties are unique to this specific connector. Or to be more precise, unique
to the dataflow running within the connector. These properties use the following
prefix:
For a comprehensive list of these properties, see the HTTP Source properties reference.parameter.[***CONNECTOR NAME***] Parameters:
Notes and limitations
- Required properties must be assigned a valid value even if they are not used in the particular configuration. If a required property is not used, either leave its default value, or completely remove the property from the configuration JSON.
- If a property that has a default value is completely removed from the configuration JSON, the system uses the default value.
- Properties not marked as required must be completely removed from the configuration JSON if not set.
- The HTTP Source connector must use at least one-way SSL, it cannot be used without SSL.
- The ListenHTTP processor in the NiFi flow keeps running when the connector is paused. Due to this, the connector accepts requests, but ultimately times out and sends an error response to the client.
- The
tasks.max
property must be 1 to avoid port conflict due to executing multiple tasks on the same Kafka Connect node. Cloudera recommends that you use a load balancer to keep track of the actual node which runs the connector.
Configuration example
- The connector is running on
kc-host-1
. Listening Port
is set to port8080
.Base Path
is set todata-ingest
.
https://kc-host-1:8080/data-ingest
{
"connector.class": "org.apache.nifi.kafka.connect.StatelessNiFiSourceConnector",
"meta.smm.predefined.flow.name": "HTTP Source",
"meta.smm.predefined.flow.version": "1.0.0",
"key.converter": "org.apache.kafka.connect.storage.StringConverter",
"value.converter": "org.apache.kafka.connect.converters.ByteArrayConverter",
"tasks.max": "1",
"nexus.url": "https://repository.cloudera.com/artifactory/repo",
"extensions.directory": "/tmp/nifi-stateless-extensions",
"working.directory": "/tmp/nifi-stateless-working",
"topics": "[***KAFKA TOPIC NAME***]",
"parameter.HTTP Source Parameters:Listening Port": "[***PORT***]",
"parameter.HTTP Source Parameters:Base Path": "[***BASE PATH***]",
"parameter.HTTP Source Parameters:Keystore Filename": "[***PATH TO KEYSTORE***]",
"parameter.HTTP Source Parameters:Keystore Key Password": "[***KEYSTORE KEY PASSWORD***]",
"parameter.HTTP Source Parameters:Keystore Password": "[***KEYSTORE PASSWORD***]",
"parameter.HTTP Source Parameters:Keystore Type": "[***KEYSTORE TYPE***]"
}
topics
- The name of the Kafka topic that the connector sends messages to.
Listening Port
- The port that the client needs to use in the URL.
Base Path
- The path that the client needs to use in the URL.
Keystore *
- The properties for accessing the keystore used for HTTPS.