kafka/service

Definition · Catalog README · Source

Use this extension when your workload talks to Kafka.

Kafka keeps messages in topics. A topic is like a named channel. Some workloads write messages to a topic, and some workloads read messages from it. Workloads that read together can join a consumer group. Kafka uses the group to share the messages between them and to remember how far each one has read.

In a Condition, you list every topic and every consumer group that your workload uses, and say if it reads or writes. The platform then creates them or gives your workload access to them.

Write the exact names. Patterns like orders-* are not allowed. Reading a topic does not give access to a consumer group, so if your workload uses a group, add the group as its own line.

Documentation

This extension declares the Kafka topic and consumer-group access a workload requires. It is separate from common integrations so future Kafka SDK mappings can target the same service contract across languages.

Each Condition uses kind: kafka.service and interface.type: service. Its name identifies the logical Kafka service requirement; resource identities appear in interface.operations.

Capabilities

Resource Action Required identity Requirement
topic write topic Produce records to the named topic.
topic read topic Read records from the named topic.
group read groupId Coordinate consumption or commit and fetch offsets for the named consumer group.

Every operation has exactly one of these forms. The operations array must be nonempty and contain no duplicate entries. Declare separate entries when a workload reads and writes the same topic, or uses several topics or groups.

A group consumer declares both topic read and group read requirements. A consumer using explicit partition assignment without group coordination or Kafka-managed offsets needs only topic read access. Group access alone grants no topic access; topic access alone grants no group access.

See the producer, group consumer, and direct consumer examples. The producer example describes the topic-write capability only; it does not claim that a client's default idempotent producer configuration is fully covered.

Fulfillment

An adapter can use these requirements to select a Kafka service and configure access for the workload identity. Kafka's authorization model distinguishes Write on a topic, Read on a topic, and Read on a group. Kafka's standard ACL semantics also imply the corresponding Describe access from Read or Write; the extension does not add a redundant describe capability.

Topic and group identities are literal and case-sensitive. The extension does not authorize wildcard, prefix, or regular-expression matching. Topic names follow Kafka's 249-character limit and allowed characters; . and .. are invalid. Group IDs are nonempty strings without *; they do not inherit topic-name character or length restrictions.

These entries describe workload access requirements. They do not request topic creation, configure a broker, or identify an authentication principal. The platform supplies connectivity, authentication, and authorization policy.

SDK support

Future SDK mappings can map proven application topic/group identities to these capabilities. They must preserve additional demands such as transactional or idempotent privileges through an extended contract, rather than claim that a topic-write entry fully describes those workloads. A dynamic or unresolved resource must not be replaced by wildcard access. This release includes no SDK mapping or profiler integration.

The design notes explain the source references and scope.

Packages

Install the package for your language to declare this extension's Conditions from your code.

Go

Package
runtimeconditions.io/x/kafka/service
Version
0.2.0 Not published yet

This package version is generated but not published to its registry yet.

go get runtimeconditions.io/x/kafka/service@v0.2.0

Conditions

Every Condition part this package defines, with the fields you can set. Select a line to open it.

kafka.service · service: Your workload connects to Kafka with a normal Kafka client library.

service.Service is the interface of a kafka.service Condition.

Field Type Required Description
Operations Operations yes The topics and consumer groups that your workload uses. Each line names one of them and says what the workload does with it. The topics and consumer groups that your workload uses. List at least one, and do not repeat a line.
Operations[].Action Action yes What the workload does with it.
Values:
read: Read messages from the topic, or use the consumer group.
write: Send messages to the topic. This does not include transactions or idempotent writes.
Operations[].GroupId *string no The exact consumer group name. It cannot be empty and cannot use * as a pattern.
Operations[].Resource Resource yes What the line is about, a topic or a consumer group.
Values:
group: A Kafka consumer group, by its exact name.
topic: A Kafka topic, by its exact name.
Operations[].Topic *string no The exact topic name. It can use letters, digits, dots, underscores and hyphens, and it cannot be '.' or '..'.

KafkaService

service.KafkaService declares a kafka.service Condition.

Example: a billing workload. It reads new orders from the orders topic, as part of the billing consumer group. It writes a message to the invoices topic for each order.

service.KafkaService(
	service.Service{
		Operations: service.Operations{
			service.OperationsItem{
				Action:   service.ActionRead,
				Resource: service.ResourceTopic,
				Topic:    &[]string{"orders"}[0],
			},
			service.OperationsItem{
				Action:   service.ActionRead,
				GroupId:  &[]string{"billing"}[0],
				Resource: service.ResourceGroup,
			},
			service.OperationsItem{
				Action:   service.ActionWrite,
				Resource: service.ResourceTopic,
				Topic:    &[]string{"invoices"}[0],
			},
		},
	},
)

The full API, with every type, field and constant documented, is in the Go package documentation.

Python

Package
runtimeconditions-kafka-service
Version
0.2.0 Not published yet

This package version is generated but not published to its registry yet.

pip install runtimeconditions-kafka-service

Conditions

Every Condition part this package defines, with the fields you can set. Select a line to open it.

kafka.service · service: Your workload connects to Kafka with a normal Kafka client library.

Service is the interface of a kafka.service Condition.

Field Type Required Description
operations Operations yes The topics and consumer groups that your workload uses. Each line names one of them and says what the workload does with it. The topics and consumer groups that your workload uses. List at least one, and do not repeat a line.
operations[].action Action yes What the workload does with it.
Values:
read: Read messages from the topic, or use the consumer group.
write: Send messages to the topic. This does not include transactions or idempotent writes.
operations[].resource Resource yes What the line is about, a topic or a consumer group.
Values:
group: A Kafka consumer group, by its exact name.
topic: A Kafka topic, by its exact name.
operations[].group_id str | None no The exact consumer group name. It cannot be empty and cannot use * as a pattern.
operations[].topic str | None no The exact topic name. It can use letters, digits, dots, underscores and hyphens, and it cannot be '.' or '..'.

kafka_service

kafka_service declares a kafka.service Condition.

Example: a billing workload. It reads new orders from the orders topic, as part of the billing consumer group. It writes a message to the invoices topic for each order.

from runtimeconditions_kafka_service import (
    Action,
    OperationsItem,
    Resource,
    Service,
    kafka_service,
)

kafka_service(
    Service(
        operations=[
            OperationsItem(action=Action.READ, resource=Resource.TOPIC, topic="orders"),
            OperationsItem(
                action=Action.READ,
                resource=Resource.GROUP,
                group_id="billing",
            ),
            OperationsItem(
                action=Action.WRITE,
                resource=Resource.TOPIC,
                topic="invoices",
            ),
        ],
    ),
)

Every class, field and enum member is documented in the package's docstrings.

TypeScript

Package
@runtimeconditions/kafka-service
Version
0.2.0 Not published yet

This package version is generated but not published to its registry yet.

npm install @runtimeconditions/kafka-service

Conditions

Every Condition part this package defines, with the fields you can set. Select a line to open it.

kafka.service · service: Your workload connects to Kafka with a normal Kafka client library.

Service is the interface of a kafka.service Condition.

Field Type Required Description
operations Operations yes The topics and consumer groups that your workload uses. Each line names one of them and says what the workload does with it. The topics and consumer groups that your workload uses. List at least one, and do not repeat a line.
operations[].action Action yes What the workload does with it.
Values:
read: Read messages from the topic, or use the consumer group.
write: Send messages to the topic. This does not include transactions or idempotent writes.
operations[].resource Resource yes What the line is about, a topic or a consumer group.
Values:
group: A Kafka consumer group, by its exact name.
topic: A Kafka topic, by its exact name.
operations[].groupId string no The exact consumer group name. It cannot be empty and cannot use * as a pattern.
operations[].topic string no The exact topic name. It can use letters, digits, dots, underscores and hyphens, and it cannot be '.' or '..'.

kafkaService

kafkaService declares a kafka.service Condition.

Example: a billing workload. It reads new orders from the orders topic, as part of the billing consumer group. It writes a message to the invoices topic for each order.

import { Action, OperationsItem, Resource, Service, kafkaService } from "@runtimeconditions/kafka-service";

kafkaService(
  new Service({
    operations: [
      new OperationsItem({ action: Action.Read, resource: Resource.Topic, topic: "orders" }),
      new OperationsItem({ action: Action.Read, resource: Resource.Group, groupId: "billing" }),
      new OperationsItem({ action: Action.Write, resource: Resource.Topic, topic: "invoices" }),
    ],
  }),
);

Every class, field and enum member is documented in the package's type declarations.

Java

Package
io.runtimeconditions.bindings:runtimeconditions-kafka-service
Version
0.2.0 Not published yet

This package version is generated but not published to its registry yet.

<dependency>
  <groupId>io.runtimeconditions.bindings</groupId>
  <artifactId>runtimeconditions-kafka-service</artifactId>
  <version>0.2.0</version>
</dependency>

Conditions

Every Condition part this package defines, with the fields you can set. Select a line to open it.

kafka.service · service: Your workload connects to Kafka with a normal Kafka client library.

Service is the interface of a kafka.service Condition.

Field Type Required Description
operations Operations yes The topics and consumer groups that your workload uses. Each line names one of them and says what the workload does with it. The topics and consumer groups that your workload uses. List at least one, and do not repeat a line.
operations[].action Action yes What the workload does with it.
Values:
read: Read messages from the topic, or use the consumer group.
write: Send messages to the topic. This does not include transactions or idempotent writes.
operations[].resource Resource yes What the line is about, a topic or a consumer group.
Values:
group: A Kafka consumer group, by its exact name.
topic: A Kafka topic, by its exact name.
operations[].groupId String no The exact consumer group name. It cannot be empty and cannot use * as a pattern.
operations[].topic String no The exact topic name. It can use letters, digits, dots, underscores and hyphens, and it cannot be '.' or '..'.

Bindings.kafkaService

Bindings.kafkaService declares a kafka.service Condition.

Example: a billing workload. It reads new orders from the orders topic, as part of the billing consumer group. It writes a message to the invoices topic for each order.

import io.runtimeconditions.bindings.kafkaservice.Action;
import io.runtimeconditions.bindings.kafkaservice.Bindings;
import io.runtimeconditions.bindings.kafkaservice.Operations;
import io.runtimeconditions.bindings.kafkaservice.OperationsItem;
import io.runtimeconditions.bindings.kafkaservice.Resource;
import io.runtimeconditions.bindings.kafkaservice.Service;
import java.util.List;

Bindings.kafkaService(
    new Service(
        new Operations(
            List.of(
                new OperationsItem(Action.READ, Resource.TOPIC, null, "orders"),
                new OperationsItem(Action.READ, Resource.GROUP, "billing", null),
                new OperationsItem(Action.WRITE, Resource.TOPIC, null, "invoices")))));

Every record, component and enum constant is documented in the Javadoc.

Kinds

kafka.service

Your workload needs a Kafka cluster with the topics and consumer groups listed in the Condition.

Example: a billing workload. It reads new orders from the orders topic, as part of the billing consumer group. It writes a message to the invoices topic for each order.

kind: kafka.service
interface:
  type: service
  operations:
    - resource: topic
      action: read
      topic: orders
    - resource: group
      action: read
      groupId: billing
    - resource: topic
      action: write
      topic: invoices

Interface types

Interface types

service kafka.service

Your workload connects to Kafka with a normal Kafka client library.

Example: a workload that only sends page-view events to Kafka and never reads them.

kind: kafka.service
interface:
  type: service
  operations:
    - resource: topic
      action: write
      topic: page-views

Fields

interface.operations

The topics and consumer groups that your workload uses. Each line names one of them and says what the workload does with it.

Allowed values for interface.operations[].resource
ValueDescription
topicA Kafka topic, by its exact name.
groupA Kafka consumer group, by its exact name.
Allowed values for interface.operations[].action
ValueDescription
readRead messages from the topic, or use the consumer group.
writeSend messages to the topic. This does not include transactions or idempotent writes.