Overview of cosmonic:kafka interfaces
The cosmonic:kafka capability provides several interfaces for interacting with Kafka. The choice of interface depends on the desired operational model:
producer: Used for publishing messages. Binding-scoped functions with no stateful resource.transaction: Used for atomic publishing and offset commits.begin()returns a stateful resource.consumer: Used for long-lived services requiring direct control of a Kafka session. The component owns the stateful resource and must drive the record stream to maintain group membership (heartbeats).handler: The serverless/event-driven path. The component exports the handler, and the host manages polling, heartbeats, and commits, invoking the component only when work is available. This allows scaling to zero without adding Kafka group members.types: Provides shared vocabulary, including records, variants, and theerror-codevariant.