Skip to content

GCP.ManagedKafka reference

Source: src/GCP/ManagedKafka/Cluster.ts

A Managed Service for Apache Kafka cluster.

Changing clusterId, location, subnets, or kmsKey replaces the cluster. Capacity, rebalance mode, TLS config, and labels update in place. Provisioning typically takes more than a minute.

Generated name, 3 vCPU / 3 GiB

const cluster = yield* GCP.ManagedKafka.Cluster("Brokers", {});

Explicit id, subnet, and labels

const cluster = yield* GCP.ManagedKafka.Cluster("Brokers", {
clusterId: "app-kafka",
location: "us-central1",
subnets: [
"projects/my-project/regions/us-central1/subnetworks/default",
],
capacityConfig: { vcpuCount: 3, memoryBytes: 3221225472 },
labels: { env: "prod" },
});

Source: src/GCP/ManagedKafka/ClustersAcl.ts

An ACL for a Kafka resource pattern on a Managed Kafka cluster.

The ACL id encodes the resource pattern and is immutable. Entries update in place.

Allow all users to describe a topic

const acl = yield* GCP.ManagedKafka.ClustersAcl("OrdersAcl", {
cluster: cluster.name,
aclId: "topic/orders",
aclEntries: [
{
principal: "User:*",
operation: "DESCRIBE",
permissionType: "ALLOW",
host: "*",
},
],
});

Cluster-wide ACL

const acl = yield* GCP.ManagedKafka.ClustersAcl("ClusterAcl", {
cluster: cluster.name,
aclId: "cluster",
aclEntries: [
{
principal: "User:client@my-project.iam.gserviceaccount.com",
operation: "CLUSTER_ACTION",
permissionType: "ALLOW",
host: "*",
},
],
});

Source: src/GCP/ManagedKafka/ClustersTopic.ts

A Kafka topic on a Managed Service for Apache Kafka cluster.

Changing topicId, cluster, location, or replicationFactor replaces the topic. partitionCount can only increase. Configs update in place.

Generated name

const topic = yield* GCP.ManagedKafka.ClustersTopic("Events", {
cluster: cluster.name,
});

Explicit id, partitions, and configs

const topic = yield* GCP.ManagedKafka.ClustersTopic("Events", {
cluster: cluster.name,
topicId: "order-events",
partitionCount: 3,
replicationFactor: 3,
configs: { "cleanup.policy": "compact" },
});

Source: src/GCP/ManagedKafka/ConnectCluster.ts

A Managed Service for Apache Kafka Connect cluster.

Changing connectClusterId, location, kafkaCluster, or the primary subnet replaces the cluster. Capacity, labels, and worker config update in place. Provisioning typically takes more than a minute.

ConnectCluster: Creating a Connect Cluster

Section titled “ConnectCluster: Creating a Connect Cluster”

Attach to a Kafka cluster

const connect = yield* GCP.ManagedKafka.ConnectCluster("Connect", {
kafkaCluster: cluster.name,
});

Explicit id and labels

const connect = yield* GCP.ManagedKafka.ConnectCluster("Connect", {
connectClusterId: "app-connect",
kafkaCluster: cluster.name,
labels: { env: "prod" },
});

Source: src/GCP/ManagedKafka/ConnectClustersConnector.ts

A Kafka Connect connector on a Managed Kafka Connect cluster.

Changing connectorId, connectCluster, or location replaces the connector. Configs and the task restart policy update in place.

ConnectClustersConnector: Creating a Connector

Section titled “ConnectClustersConnector: Creating a Connector”
const connector = yield* GCP.ManagedKafka.ConnectClustersConnector(
"Sink",
{
connectCluster: connect.name,
configs: {
"connector.class":
"com.google.pubsub.kafka.sink.CloudPubSubSinkConnector",
"tasks.max": "1",
topics: "orders",
"cps.project": "my-project",
"cps.topic": "orders-sink",
},
},
);

Source: src/GCP/ManagedKafka/GetCluster.ts

Runtime binding for Managed Kafka clusters.get.

Bind this operation to a Cluster in a Function/Action init phase. Provide GetClusterHttp.

const getCluster = yield* GCP.ManagedKafka.GetCluster(cluster);
const live = yield* getCluster();

Source: src/GCP/ManagedKafka/GetClusterHttp.ts Kind: Layer · Provides: GCP.ManagedKafka.GetCluster

HTTP implementation of GetCluster.

Source: src/GCP/ManagedKafka/GetConnectCluster.ts

Runtime binding for Managed Kafka connectClusters.get.

Bind this operation to a ConnectCluster in a Function/Action init phase. Provide GetConnectClusterHttp.

GetConnectCluster: Observing Connect Clusters

Section titled “GetConnectCluster: Observing Connect Clusters”
const getConnect = yield* GCP.ManagedKafka.GetConnectCluster(connect);
const live = yield* getConnect();

Source: src/GCP/ManagedKafka/GetConnectClusterHttp.ts Kind: Layer · Provides: GCP.ManagedKafka.GetConnectCluster

HTTP implementation of GetConnectCluster.

Source: src/GCP/ManagedKafka/GetSchemaRegistry.ts

Runtime binding for Managed Kafka schemaRegistries.get.

Bind this operation to a SchemaRegistry in a Function/Action init phase. Provide GetSchemaRegistryHttp.

Grants roles/managedkafka.schemaRegistryViewer (read-only) on the project: schema-registry permission checks do not honor an IAM Condition scoped to the registry’s resource name.

GetSchemaRegistry: Observing Schema Registries

Section titled “GetSchemaRegistry: Observing Schema Registries”
const getRegistry = yield* GCP.ManagedKafka.GetSchemaRegistry(registry);
const live = yield* getRegistry();

Source: src/GCP/ManagedKafka/GetSchemaRegistryHttp.ts Kind: Layer · Provides: GCP.ManagedKafka.GetSchemaRegistry

HTTP implementation of GetSchemaRegistry.

Source: src/GCP/ManagedKafka/GetTopic.ts

Runtime binding for Managed Kafka topics.get.

Bind this operation to a ClustersTopic in a Function/Action init phase. Provide GetTopicHttp.

const getTopic = yield* GCP.ManagedKafka.GetTopic(topic);
const live = yield* getTopic();

Source: src/GCP/ManagedKafka/GetTopicHttp.ts Kind: Layer · Provides: GCP.ManagedKafka.GetTopic

HTTP implementation of GetTopic.

Source: src/GCP/ManagedKafka/SchemaRegistriesContextsSubjectsVersion.ts

A schema version under a subject in a named context of a Managed Kafka schema registry.

Versions are immutable. Changing context, subject, registry, schema, type, or version replaces the resource.

SchemaRegistriesContextsSubjectsVersion: Creating a Version

Section titled “SchemaRegistriesContextsSubjectsVersion: Creating a Version”
const version =
yield* GCP.ManagedKafka.SchemaRegistriesContextsSubjectsVersion(
"OrderSchema",
{
schemaRegistry: registry.name,
context: "prod",
subject: "orders",
schemaType: "AVRO",
schema: JSON.stringify({
type: "record",
name: "Order",
fields: [{ name: "id", type: "string" }],
}),
},
);

Source: src/GCP/ManagedKafka/SchemaRegistriesSubjectsVersion.ts

A schema version under a subject in a Managed Kafka schema registry (default context).

Versions are immutable. Changing subject, registry, schema, type, or version replaces the resource.

SchemaRegistriesSubjectsVersion: Creating a Version

Section titled “SchemaRegistriesSubjectsVersion: Creating a Version”
const version = yield* GCP.ManagedKafka.SchemaRegistriesSubjectsVersion(
"OrderSchema",
{
schemaRegistry: registry.name,
subject: "orders",
schemaType: "AVRO",
schema: JSON.stringify({
type: "record",
name: "Order",
fields: [{ name: "id", type: "string" }],
}),
},
);

Source: src/GCP/ManagedKafka/SchemaRegistry.ts

A Managed Kafka schema registry instance.

Schema registries have no labels field, so Alchemy stamps ownership on a reserved alchemy_ownership subject. Name and location are identity — changing either replaces the registry.

SchemaRegistry: Creating a Schema Registry

Section titled “SchemaRegistry: Creating a Schema Registry”

Generated name

const registry = yield* GCP.ManagedKafka.SchemaRegistry("Schemas", {});

Explicit id

const registry = yield* GCP.ManagedKafka.SchemaRegistry("Schemas", {
schemaRegistryId: "app_schemas",
location: "us-central1",
});