input/httpINPUTBUFFERPROCESSOROUTPUT
HTTP
HTTP 输入(Input)以 Axum HTTP 服务器的形式运行,接受发送到 address+path 的 POST 请求。请求体(JSON)会被解码并转发到流处理流水线(Pipeline)。支持可选的 CORS 以及 Basic/Bearer 认证。bind 失败同步可见:监听地址无法绑定(例如端口已被占用)时,connect 以显式错误失败而非静默启动;监听器运行期停止时,read 返回断连错误,引擎可重新绑定。作为通道型输入,它遵循引擎的取消安全契约:取消一次未完成的 read 不会丢失已解码的消息(参见输入投递语义)。
配置
| Field | Type | Required | Default | 描述 |
|---|---|---|---|---|
| type | string | yes | — | 常量值 "http" |
| address | string | yes | — | 监听地址,如 0.0.0.0:8080 |
| path | string | yes | — | 接收消息(Message)的 URL 路径,如 /data |
| cors_enabled | boolean | no | false | 是否启用 CORS |
| auth | object | no | — | 认证配置,见下表 |
auth
auth 是一个带标签的枚举(tagged enum,通过 type 字段区分),有两种互斥的形式:
| Field | Type | Required | 描述 |
|---|---|---|---|
| type | string | yes | "basic" 或 "bearer" |
| username | string | yes (basic) | Basic 认证用户名 |
| password | string | yes (basic) | Basic 认证密码 |
| token | string | yes (bearer) | Bearer 令牌 |
示例
input:
type: "http"
address: "0.0.0.0:8080"
path: "/data"
cors_enabled: true
input:
type: "http"
address: "0.0.0.0:8080"
path: "/data"
auth:
type: "basic"
username: "user"
password: "pass"
input:
type: "http"
address: "0.0.0.0:8080"
path: "/data"
auth:
type: "bearer"
token: "your-token"