Eventing uses Event Publisher Proxy and Eventing Controller to connect to the default NATS JetStream backend. They work together to process and deliver events in Kyma.
Event processing and delivery
The event processing and delivery flow uses the NATS server to process events and send them to subscribers. This diagram explains the event flow in Kyma, from the moment an event source sends an event, to the point when the event triggers the Function.
The Eventing Controller watches the Subscription custom resource. It detects if there are any new incoming events.
The Eventing Controller creates an infrastructure for the NATS server.
An event source publishes events to the Event Publisher Proxy.
The Event Publisher Proxy sends events to the NATS server.
The NATS server dispatches events to the Eventing Controller.
The Eventing Controller dispatches events to subscribers (microservices or Functions).
Event Publisher Proxy
Event Publisher Proxy receives legacy and CloudEvents, and publishes them to the configured Eventing backend. All the legacy events are automatically converted to CloudEvents.
Eventing Controller manages the internal infrastructure in order to receive an event. It watches Subscription custom resources. When an event is received, Eventing Controller dispatches the message to the configured sink.
Kyma now supports JetStream by default, which is a persistence offering from NATS, that guarantees
at least once delivery. It is built-in within our default NATS backend.
The key advantages of JetStream over Core NATS are:
- At least once delivery of JetStream compared to at most once delivery of NATS.
- Streaming: Streams receive and store messages that are published and subscribers can consume these messages at any time.
- Persistent stream storage: Messages are retained in the stream storage even when the NATS server is restarted.