binding (sse-kafka)
Zilla runtime sse-kafka binding
Defines a binding with sse-kafka support, with proxy behavior.
The proxy kind sse-kafka binding adapts sse data streams into kafka data streams, so that kafka messages can be delivered to sse clients.
Filtering can be performed by kafka message key, message headers, or a combination of both message key and headers, extracting the parameter values from the inbound sse path.
Progress across kafka topic partitions is conveyed to the sse client via event id and when the stream is implicitly paused during sse client reconnect, the last-event-id header in the sse reconnect request contains the last received event id value, allowing the sse stream to resume reliable message delivery automatically.
The event id can be configured to include the message key and etag of each message, avoiding the need to duplicate the key in the message body and making it suitable for integration with http-kafka binding's use of etag for conditional if-match operations.
When a kafka tombstone (null value) message is received by the sse-kafka binding, it delivers a delete event to the sse client. This informs the client which specific message has been deleted by observing the message key from the sse delete event id.

Example

1
"sse_kafka_proxy0":
2
{
3
"type" : "sse-kafka",
4
"kind": "proxy",
5
"routes":
6
[
7
{
8
"when":
9
[
10
{
11
"path": "/items"
12
}
13
],
14
"exit": "kafka_cache_client0",
15
"with":
16
{
17
"topic": "items-snapshots",
18
"event":
19
{
20
"id": "[\"${base64(key)}\",\"${etag}\"]"
21
}
22
}
23
}
24
]
25
}
Copied!

Configuration

Binding with support for adapting sse data streams to kafka data streams.

Properties

Name (* = required)
Type
Description
type*
const "sse-kafka"
Adapt sse data streams to kafka data streams
kind*
enum [ "proxy" ]
Behave as a sse-kafka proxy
routes
array of route​
Conditional sse-kafka-specific routes
exit
string
Default exit binding when no conditional routes are viable

route

Routes for adapting sse data streams to kafka data streams.

Properties

Name (* = required)
Type
Description
guarded
object as named map of string array
List of roles required by each named guard to authorize this route
when
array of condition​
List of conditions (any match) to match this route
exit*
string
Next binding when following this route
with
​with​
Kafka parameters used when following this route

condition

Conditions to match routes for adapting sse data streams to kafka data streams.

Properties

Name (* = required)
Type
Description
path*
string
Path with optional embedded parameter names, such as /{topic}

with

Kafka parameters for matched route when adapting sse data streams to kafka data streams.

Properties

Name (* = required)
Type
Description
topic*
string
Topic name, optionally referencing path parameter such as ${params.topic}
filters
array of filter​
List of criteria (any match)
​event​
object
Defines the syntax of the event id

filter

Kafka filters for matched route when adapting sse data streams to kafka data streams.
All specified headers and key must match for the combined criteria to match.

Properties

Name (* = required)
Type
Description
key
string
Message key, optionally referencing path parameter such as ${params.key}
headers
object
Message headers, with value optionally referencing path parameter such as ${params.headerX}

event

SSE event syntax used when delivering Kafka messages to SSE clients.

Properties

Name (* = required)
Type
Description
id*
enum [ "${etag}", "[\"${base64(key)}\",\"${etag}\"]" ]
Format of id field in sse event Defaults to "${etag}"
​