# Google Cloud Managed Kafka V1 Client - Class Topic (0.8.0)

0.8.0 (latest) 0.7.2 0.6.1 0.5.0 0.4.1 0.3.1 0.2.3 0.1.3 Reference documentation and code samples for the Google Cloud Managed Kafka V1 Client class Topic.

A Kafka topic in a given cluster.

Generated from protobuf message `google.cloud.managedkafka.v1.Topic`

## Namespace

Google \\ Cloud \\ ManagedKafka \\ V1

## Methods

### __construct

Constructor.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `data` | `array` Optional. Data for populating the Message object. |
| `↳ name` | `string` Identifier. The name of the topic. The `topic` segment is used when connecting directly to the cluster. Structured like: projects/{project}/locations/{location}/clusters/{cluster}/topics/{topic} |
| `↳ partition_count` | `int` Required. The number of partitions this topic has. The partition count can only be increased, not decreased. Please note that if partitions are increased for a topic that has a key, the partitioning logic or the ordering of the messages will be affected. |
| `↳ replication_factor` | `int` Required. Immutable. The number of replicas of each partition. A replication factor of 3 is recommended for high availability. |
| `↳ configs` | `array|https://protobuf.dev/reference/php/api-docs/Google/Protobuf/Internal/MapField` Optional. Configurations for the topic that are overridden from the cluster defaults. The key of the map is a Kafka topic property name, for example: `cleanup.policy`, `compression.type`. |

### getName

Identifier. The name of the topic. The `topic` segment is used when
connecting directly to the cluster. Structured like:
projects/{project}/locations/{location}/clusters/{cluster}/topics/{topic}

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `string` |   |

### setName

Identifier. The name of the topic. The `topic` segment is used when
connecting directly to the cluster. Structured like:
projects/{project}/locations/{location}/clusters/{cluster}/topics/{topic}

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `string` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getPartitionCount

Required. The number of partitions this topic has. The partition count can
only be increased, not decreased. Please note that if partitions are
increased for a topic that has a key, the partitioning logic or the
ordering of the messages will be affected.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `int` |   |

### setPartitionCount

Required. The number of partitions this topic has. The partition count can
only be increased, not decreased. Please note that if partitions are
increased for a topic that has a key, the partitioning logic or the
ordering of the messages will be affected.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `int` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getReplicationFactor

Required. Immutable. The number of replicas of each partition. A
replication factor of 3 is recommended for high availability.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `int` |   |

### setReplicationFactor

Required. Immutable. The number of replicas of each partition. A
replication factor of 3 is recommended for high availability.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `int` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getConfigs

Optional. Configurations for the topic that are overridden from the cluster
defaults. The key of the map is a Kafka topic property name, for example:
`cleanup.policy`, `compression.type`.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://protobuf.dev/reference/php/api-docs/Google/Protobuf/Internal/MapField` |   |

### setConfigs

Optional. Configurations for the topic that are overridden from the cluster
defaults. The key of the map is a Kafka topic property name, for example:
`cleanup.policy`, `compression.type`.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `array|https://protobuf.dev/reference/php/api-docs/Google/Protobuf/Internal/MapField` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |