Skip to content

SSE Extractor

Connects to HTTP endpoints that stream events via Server-Sent Events (SSE) protocol — ideal for consuming live event streams from services that support push-based streaming.

Configuration

toml
[sources.events.extractor]
type = "sse"
url = "https://events.example.com/stream"
max_retries = 10

Parameters

ParameterTypeDefaultDescription
urlstringSSE endpoint URL
max_retriesinteger10Maximum reconnection attempts
headersarray[]Outgoing request headers (auth, etc.)
metadataobjectStatic metadata for all events; context.source is auto-populated if unset

Event Processing

  • Body: Parsed as JSON if valid; stored as raw string otherwise
  • Metadata: sse_id, sse_event, sse_url automatically merged with extractor metadata
  • Retry: Exponential backoff (2^retry seconds, max 64s) on connection loss

Authentication

Bearer token

toml
[sources.api_events.extractor.headers]
"authorization" = { type = "secret", value = "Bearer your-api-token" }

API key (secret value)

Keep the secret out of the config file — use the _file suffix to read it from a mounted file:

toml
[sources.api_events.extractor.headers]
"x-api-key" = { type = "secret", value_file = "/run/secrets/api_key" }

Or set via environment variable (see Configuration — Environment Variables).

→ Complete Header Authentication Guide

Common CI/CD Use Cases

Jenkins build events via SSE

Jenkins supports Server-Sent Events for build queue and executor events:

toml
[sources.jenkins_builds]
enabled = true
transformer_refs = ["jenkins_to_cdevents"]

[sources.jenkins_builds.extractor]
type = "sse"
url = "https://jenkins.company.com/sse/builds"

[sources.jenkins_builds.extractor.headers]
"authorization" = { type = "secret", value_file = "/run/secrets/jenkins_api_token" }

Consume from another CDviz Collector via SSE sink

CDviz Collector has an SSE sink that exposes an endpoint. One collector can consume from another:

toml
[sources.upstream_collector]
enabled = true
transformer_refs = ["filter_events"]

[sources.upstream_collector.extractor]
type = "sse"
url = "https://collector-upstream.internal:8080/sse/events"
max_retries = 20

Subscribe to a CI platform event stream

toml
[sources.platform_events]
enabled = true
transformer_refs = ["platform_to_cdevents"]

[sources.platform_events.extractor]
type = "sse"
url = "https://platform.company.com/api/events/stream"

[sources.platform_events.extractor.headers]
"authorization" = { type = "secret", value = "Bearer eyJhbGciOiJSUzI1..." }

Reconnection Behavior

The SSE extractor implements automatic reconnection with exponential backoff:

  • Retry 1: wait 2s
  • Retry 2: wait 4s
  • Retry 3: wait 8s
  • ... up to max 64s between retries

Set max_retries = 0 for unlimited reconnection attempts (recommended for production).