Topic
- Implements: ITopic
This class encapsulates and extends the ROS resource type ALIYUN::KAFKA::Topic, which is used to create a topic.
Initializers
import ros_cdk_kafka
ros_cdk_kafka.Topic(
scope: Construct,
id: str,
instance_id: typing.Union[str, IResolvable],
remark: typing.Union[str, IResolvable],
topic: typing.Union[str, IResolvable],
compact_topic: typing.Union[bool, IResolvable] = None,
config: typing.Union[IResolvable, typing.Mapping[typing.Any]] = None,
local_topic: typing.Union[bool, IResolvable] = None,
min_insync_replicas: typing.Union[typing.Union[int, float], IResolvable] = None,
partition_num: typing.Union[typing.Union[int, float], IResolvable] = None,
replication_factor: typing.Union[typing.Union[int, float], IResolvable] = None,
tags: typing.List[TagsProperty] = None,
enable_resource_property_constraint: bool = None
)
| Name | Type | Description |
|---|---|---|
scope | ros_cdk_core.Construct | No description. |
id | str | No description. |
instance_id | typing.Union[str, ros_cdk_core.IResolvable] | Property instanceId: The ID of the Message Queue for Apache Kafka instance where the topic is located. |
remark | typing.Union[str, ros_cdk_core.IResolvable] | Property remark: The description of the topic. |
topic | typing.Union[str, ros_cdk_core.IResolvable] | Property topic: The name of the topic. |
compact_topic | typing.Union[bool, ros_cdk_core.IResolvable] | Property compactTopic: The log cleanup policy for the topic. |
config | typing.Union[ros_cdk_core.IResolvable, typing.Mapping[typing.Any]] | Property config: The advanced configurations of the topic. |
local_topic | typing.Union[bool, ros_cdk_core.IResolvable] | Property localTopic: The storage engine of the topic. |
min_insync_replicas | typing.Union[typing.Union[int, float], ros_cdk_core.IResolvable] | Property minInsyncReplicas: The minimum number of ISR sync replicas. |
partition_num | typing.Union[typing.Union[int, float], ros_cdk_core.IResolvable] | Property partitionNum: The number of partitions in the topic. |
replication_factor | typing.Union[typing.Union[int, float], ros_cdk_core.IResolvable] | Property replicationFactor: The number of copies of the topic. |
tags | typing.List[TagsProperty] | Property tags: Tags to attach to instance. |
enable_resource_property_constraint | bool | No description. |
scopeRequired
- Type: ros_cdk_core.Construct
idRequired
- Type: str
instance_idRequired
- Type: typing.Union[str, ros_cdk_core.IResolvable]
Property instanceId: The ID of the Message Queue for Apache Kafka instance where the topic is located.
You can call the GetInstanceList operation to query instances.
remarkRequired
- Type: typing.Union[str, ros_cdk_core.IResolvable]
Property remark: The description of the topic.
The value of this parameter must meet the following requirements: The value can only contain letters, digits, hyphens (-), and underscores (_). The value must be 3 to 64 characters in length.
topicRequired
- Type: typing.Union[str, ros_cdk_core.IResolvable]
Property topic: The name of the topic.
- Reserved instance: The name can contain uppercase letters, lowercase letters, digits, underscores (_), hyphens (-), and periods (.). The name must be 3 to 64 characters in length.
- Serverless instance: The name can contain uppercase letters, lowercase letters, digits, underscores (_), hyphens (-), and periods (.). The name must be 1 to 249 characters in length.
compact_topicOptional
- Type: typing.Union[bool, ros_cdk_core.IResolvable]
Property compactTopic: The log cleanup policy for the topic.
This parameter is available when the Local Storage mode is specified for the topic. Valid values: false: uses the default log cleanup policy. true: uses the Apache Kafka log compaction policy.
configOptional
- Type: typing.Union[ros_cdk_core.IResolvable, typing.Mapping[typing.Any]]
Property config: The advanced configurations of the topic.
- Configure this parameter in the JSON format.
- This parameter is available only if LocalTopic is set to true.
- The following configurations are supported for reserved instances:
- retention.ms: The message retention period. The value must be an integer from 3,600,000 to 31,536,000,000. Unit: milliseconds.
- max.message.bytes: The maximum size of a message that can be sent. The value must be an integer from 1,048,576 to 10,485,760. Unit: bytes.
- message.timestamp.type: The timestamp type of a message. Valid values: CreateTime or LogAppendTime. CreateTime indicates that the message timestamp is the time when the producer creates the message. If you do not specify a timestamp, the client time is used. LogAppendTime indicates that the message timestamp is the time when the server stores the message. The default value is CreateTime. We recommend that you set this parameter to LogAppendTime.
- The following configurations are supported for Serverless instances:
- retention.hours: The message retention period. The value is of the string type. The value must be an integer from 24 to 8,760.
- max.message.bytes: The maximum size of a message that can be sent. The value is of the string type. The value must be an integer from 1,048,576 to 10,485,760.
- message.timestamp.type: The timestamp type of a message. Valid values: CreateTime or LogAppendTime. CreateTime indicates that the message timestamp is the time when the producer creates the message. If you do not specify a timestamp, the client time is used. LogAppendTime indicates that the message timestamp is the time when the server stores the message. The default value is CreateTime. We recommend that you set this parameter to LogAppendTime.
local_topicOptional
- Type: typing.Union[bool, ros_cdk_core.IResolvable]
Property localTopic: The storage engine of the topic.
Valid values: false: the Cloud Storage mode. true: the Local Storage mode.
min_insync_replicasOptional
- Type: typing.Union[typing.Union[int, float], ros_cdk_core.IResolvable]
Property minInsyncReplicas: The minimum number of ISR sync replicas.
This parameter can only be specified if the LocalTopic value is true. The value must be less than the number of Topic copies. The number of synchronous replicas is limited to 1~3.
partition_numOptional
- Type: typing.Union[typing.Union[int, float], ros_cdk_core.IResolvable]
Property partitionNum: The number of partitions in the topic.
- The value must be an integer from 1 to 360.
- The console suggests a number of partitions based on the instance type. Follow the suggestion to reduce the risk of data skew. Default value:
- Reserved instance: 12
- Serverless instance: 3
replication_factorOptional
- Type: typing.Union[typing.Union[int, float], ros_cdk_core.IResolvable]
Property replicationFactor: The number of copies of the topic.
This parameter can only be specified if the LocalTopic value is true. The number of copies is limited to 1~3. Note When the number of replicas is 1, there is a risk of data loss. Please set it carefully.
tagsOptional
- Type: typing.List[TagsProperty]
Property tags: Tags to attach to instance.
Max support 20 tags to add during create instance. Each tag with two properties Key and Value, and Key is required.
enable_resource_property_constraintOptional
- Type: bool
Methods
| Name | Description |
|---|---|
to_string | Returns a string representation of this construct. |
synthesize | Allows this construct to emit artifacts into the cloud assembly during synthesis. |
add_condition | No description. |
add_count | No description. |
add_dependency | No description. |
add_resource_desc | No description. |
apply_removal_policy | No description. |
fetch_condition | No description. |
fetch_dependency | No description. |
fetch_resource_desc | No description. |
get_att | No description. |
set_metadata | No description. |
to_string
def to_string() -> str
Returns a string representation of this construct.
synthesize
def synthesize(
session: ISynthesisSession
) -> None
Allows this construct to emit artifacts into the cloud assembly during synthesis.
This method is usually implemented by framework-level constructs such as Stack and Asset as they participate in synthesizing the cloud assembly.
- Type: ros_cdk_core.ISynthesisSession
The synthesis session.
add_condition
def add_condition(
condition: RosCondition
) -> None
- Type: ros_cdk_core.RosCondition
add_count
def add_count(
count: typing.Union[typing.Union[int, float], IResolvable]
) -> None
- Type: typing.Union[typing.Union[int, float], ros_cdk_core.IResolvable]
add_dependency
def add_dependency(
resource: Resource
) -> None
- Type: ros_cdk_core.Resource
add_resource_desc
def add_resource_desc(
desc: str
) -> None
- Type: str
apply_removal_policy
def apply_removal_policy(
policy: RemovalPolicy
) -> None
- Type: ros_cdk_core.RemovalPolicy
fetch_condition
def fetch_condition() -> RosCondition
fetch_dependency
def fetch_dependency() -> typing.List[str]
fetch_resource_desc
def fetch_resource_desc() -> str
get_att
def get_att(
name: str
) -> IResolvable
- Type: str
set_metadata
def set_metadata(
key: str,
value: typing.Any
) -> None
- Type: str
- Type: typing.Any
Static Functions
| Name | Description |
|---|---|
is_construct | Return whether the given object is a Construct. |
is_construct
import ros_cdk_kafka
ros_cdk_kafka.Topic.is_construct(
x: typing.Any
)
Return whether the given object is a Construct.
- Type: typing.Any
Properties
| Name | Type | Description |
|---|---|---|
node | ros_cdk_core.ConstructNode | The construct tree node associated with this construct. |
env | ros_cdk_core.IResourceEnvironment | The environment this resource belongs to. |
ref | str | No description. |
stack | ros_cdk_core.Stack | The stack in which this resource is defined. |
resource | ros_cdk_core.RosResource | No description. |
attr_arn | typing.Union[str, ros_cdk_core.IResolvable] | Attribute Arn: The Alibaba Cloud Resource Name (ARN). |
attr_instance_id | typing.Union[str, ros_cdk_core.IResolvable] | Attribute InstanceId: The ID of the Message Queue for Apache Kafka instance where the topic is located. |
attr_topic | typing.Union[str, ros_cdk_core.IResolvable] | Attribute Topic: Topic name. |
props | TopicProps | No description. |
nodeRequired
node: ConstructNode
- Type: ros_cdk_core.ConstructNode
The construct tree node associated with this construct.
envRequired
env: IResourceEnvironment
- Type: ros_cdk_core.IResourceEnvironment
The environment this resource belongs to.
For resources that are created and managed by the CDK (generally, those created by creating new class instances like Role, Bucket, etc.), this is always the same as the environment of the stack they belong to; however, for imported resources (those obtained from static methods like fromRoleArn, fromBucketName, etc.), that might be different than the stack they were imported into.
refRequired
ref: str
- Type: str
stackRequired
stack: Stack
- Type: ros_cdk_core.Stack
The stack in which this resource is defined.
resourceOptional
resource: RosResource
- Type: ros_cdk_core.RosResource
attr_arnRequired
attr_arn: typing.Union[str, IResolvable]
- Type: typing.Union[str, ros_cdk_core.IResolvable]
Attribute Arn: The Alibaba Cloud Resource Name (ARN).
attr_instance_idRequired
attr_instance_id: typing.Union[str, IResolvable]
- Type: typing.Union[str, ros_cdk_core.IResolvable]
Attribute InstanceId: The ID of the Message Queue for Apache Kafka instance where the topic is located.
You can call the GetInstanceList operation to query instances.
attr_topicRequired
attr_topic: typing.Union[str, IResolvable]
- Type: typing.Union[str, ros_cdk_core.IResolvable]
Attribute Topic: Topic name.
propsRequired
props: TopicProps
- Type: TopicProps