# http-source **Repository Path**: mirrors_vmware-archive/http-source ## Basic Information - **Project Name**: http-source - **Description**: No description available - **Primary Language**: Unknown - **License**: BSD-2-Clause - **Default Branch**: main - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2022-03-25 - **Last Updated**: 2025-12-21 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README = HTTP Source A simple implementation of an _http source_, accepting POST requests and sending messages to output stream(s) configured _via_ environment variables. == Building Having a working go 1.13+ installation and ko[https://github.com/google/ko] installed, simply run [source, bash] ---- ko publish github.com/projectriff/http-source/cmd ---- This will publish an image whose coordinates should be noted down for further use, `` below. == Configuration The source expects the following environment variables when running: * `OUTPUTS` is a comma separated list of mappings, in the form `=/` where `` is a url prefix that will be matched against incoming http requests. See golang's https://golang.org/pkg/net/http/#ServeMux[ServerMux] documentation for details. * `OUTPUT_CONTENT_TYPES` is a comma separated list (same size as `OUTPUTS`) indicating the expected content-type of each stream. == Using with riff One way to use this source is to create a container out of the image coordinates and create a core[https://projectriff.io/docs/v0.5/runtimes/core] or knative[https://projectriff.io/docs/v0.5/runtimes/knative] deployer. Here's an example: Assuming both "orders" and "quotes" streams exist and have already been created: [source, bash] ---- riff streaming stream list NAME TOPIC GATEWAY PROVIDER CONTENT-TYPE STATUS AGE orders default_orders franz-kafka-gateway-bqgp2.default:6565 franz-kafka-provisioner application/json Ready 8d quotes default_quotes franz-kafka-gateway-bqgp2.default:6565 franz-kafka-provisioner text/xml Ready 8d ---- Note the _gateway_, _topic_ and _content-type_ of each stream, this will be used later. Create a container out of the image created above: [source, bash] ---- riff container create http-source-container --image ---- Create a deployer out of that container, setting the expected environment variables: [source, bash] ---- riff core deployer create http-source --container-ref http-source-container \ --env OUTPUTS=/orders=franz-kafka-gateway-bqgp2.default:6565/default_orders,/q=franz-kafka-gateway-bqgp2.default:6565/default_quotes \ --env OUTPUT_CONTENT_TYPES=application/json,text/xml ---- Then the source can be exposed (_e.g._ with a port-forward) and invoked with [source, bash] ---- curl http://:/orders -HContent-Type:application/json -v -d ---- to send data to the `orders` stream, and with [source, bash] ---- curl http://:/q -HContent-Type:text/xml -v -d ---- to send to the `quotes` stream.