Topic
- Implements: ITopic
This class encapsulates and extends the ROS resource type ALIYUN::KAFKA::Topic, which is used to create a topic.
Initializers
import com.aliyun.ros.cdk.kafka.Topic;
Topic.Builder.create(Construct scope, java.lang.String id, java.lang.Boolean enableResourcePropertyConstraint)
.instanceId(java.lang.String)
.instanceId(IResolvable)
.remark(java.lang.String)
.remark(IResolvable)
.topic(java.lang.String)
.topic(IResolvable)
// .compactTopic(java.lang.Boolean)
// .compactTopic(IResolvable)
// .config(IResolvable)
// .config(java.util.Map<java.lang.String, java.lang.Object>)
// .localTopic(java.lang.Boolean)
// .localTopic(IResolvable)
// .minInsyncReplicas(java.lang.Number)
// .minInsyncReplicas(IResolvable)
// .partitionNum(java.lang.Number)
// .partitionNum(IResolvable)
// .replicationFactor(java.lang.Number)
// .replicationFactor(IResolvable)
// .tags(java.util.List<TagsProperty>)
.build();
| Name | Type | Description |
|---|---|---|
scope | com.aliyun.ros.cdk.core.Construct | No description. |
id | java.lang.String | No description. |
enableResourcePropertyConstraint | java.lang.Boolean | No description. |
instanceId | java.lang.String OR com.aliyun.ros.cdk.core.IResolvable | Property instanceId: The ID of the Message Queue for Apache Kafka instance where the topic is located. |
remark | java.lang.String OR com.aliyun.ros.cdk.core.IResolvable | Property remark: The description of the topic. |
topic | java.lang.String OR com.aliyun.ros.cdk.core.IResolvable | Property topic: The name of the topic. |
compactTopic | java.lang.Boolean OR com.aliyun.ros.cdk.core.IResolvable | Property compactTopic: The log cleanup policy for the topic. |
config | com.aliyun.ros.cdk.core.IResolvable OR java.util.Map | Property config: The advanced configurations of the topic. |
localTopic | java.lang.Boolean OR com.aliyun.ros.cdk.core.IResolvable | Property localTopic: The storage engine of the topic. |
minInsyncReplicas | java.lang.Number OR com.aliyun.ros.cdk.core.IResolvable | Property minInsyncReplicas: The minimum number of ISR sync replicas. |
partitionNum | java.lang.Number OR com.aliyun.ros.cdk.core.IResolvable | Property partitionNum: The number of partitions in the topic. |
replicationFactor | java.lang.Number OR com.aliyun.ros.cdk.core.IResolvable | Property replicationFactor: The number of copies of the topic. |
tags | java.util.List<TagsProperty> | Property tags: Tags to attach to instance. |
scopeRequired
- Type: com.aliyun.ros.cdk.core.Construct
idRequired
- Type: java.lang.String
enableResourcePropertyConstraintOptional
- Type: java.lang.Boolean
instanceIdRequired
- Type: java.lang.String OR com.aliyun.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: java.lang.String OR com.aliyun.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: java.lang.String OR com.aliyun.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.
compactTopicOptional
- Type: java.lang.Boolean OR com.aliyun.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: com.aliyun.ros.cdk.core.IResolvable OR java.util.Map
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.
localTopicOptional
- Type: java.lang.Boolean OR com.aliyun.ros.cdk.core.IResolvable
Property localTopic: The storage engine of the topic.
Valid values: false: the Cloud Storage mode. true: the Local Storage mode.
minInsyncReplicasOptional
- Type: java.lang.Number OR com.aliyun.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.
partitionNumOptional
- Type: java.lang.Number OR com.aliyun.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
replicationFactorOptional
- Type: java.lang.Number OR com.aliyun.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: java.util.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.
Methods
| Name | Description |
|---|---|
toString | Returns a string representation of this construct. |
synthesize | Allows this construct to emit artifacts into the cloud assembly during synthesis. |
addCondition | No description. |
addCount | No description. |
addDependency | No description. |
addResourceDesc | No description. |
applyRemovalPolicy | No description. |
fetchCondition | No description. |
fetchDependency | No description. |
fetchResourceDesc | No description. |
getAtt | No description. |
setMetadata | No description. |
toString
public java.lang.String toString()
Returns a string representation of this construct.
synthesize
public void synthesize(ISynthesisSession session)
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: com.aliyun.ros.cdk.core.ISynthesisSession
The synthesis session.
addCondition
public void addCondition(RosCondition condition)
- Type: com.aliyun.ros.cdk.core.RosCondition
addCount
public void addCount(java.lang.Number OR IResolvable count)
- Type: java.lang.Number OR com.aliyun.ros.cdk.core.IResolvable
addDependency
public void addDependency(Resource resource)
- Type: com.aliyun.ros.cdk.core.Resource
addResourceDesc
public void addResourceDesc(java.lang.String desc)
- Type: java.lang.String
applyRemovalPolicy
public void applyRemovalPolicy(RemovalPolicy policy)
- Type: com.aliyun.ros.cdk.core.RemovalPolicy
fetchCondition
public RosCondition fetchCondition()
fetchDependency
public java.util.List<java.lang.String> fetchDependency()
fetchResourceDesc
public java.lang.String fetchResourceDesc()
getAtt
public IResolvable getAtt(java.lang.String name)
- Type: java.lang.String
setMetadata
public void setMetadata(java.lang.String key, java.lang.Object value)
- Type: java.lang.String
- Type: java.lang.Object
Static Functions
| Name | Description |
|---|---|
isConstruct | Return whether the given object is a Construct. |
isConstruct
import com.aliyun.ros.cdk.kafka.Topic;
Topic.isConstruct(java.lang.Object x)
Return whether the given object is a Construct.
- Type: java.lang.Object
Properties
| Name | Type | Description |
|---|---|---|
node | com.aliyun.ros.cdk.core.ConstructNode | The construct tree node associated with this construct. |
env | com.aliyun.ros.cdk.core.IResourceEnvironment | The environment this resource belongs to. |
ref | java.lang.String | No description. |
stack | com.aliyun.ros.cdk.core.Stack | The stack in which this resource is defined. |
resource | com.aliyun.ros.cdk.core.RosResource | No description. |
attrArn | java.lang.String OR com.aliyun.ros.cdk.core.IResolvable | Attribute Arn: The Alibaba Cloud Resource Name (ARN). |
attrInstanceId | java.lang.String OR com.aliyun.ros.cdk.core.IResolvable | Attribute InstanceId: The ID of the Message Queue for Apache Kafka instance where the topic is located. |
attrTopic | java.lang.String OR com.aliyun.ros.cdk.core.IResolvable | Attribute Topic: Topic name. |
props | TopicProps | No description. |
nodeRequired
public ConstructNode getNode();
- Type: com.aliyun.ros.cdk.core.ConstructNode
The construct tree node associated with this construct.
envRequired
public IResourceEnvironment getEnv();
- Type: com.aliyun.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
public java.lang.String getRef();
- Type: java.lang.String
stackRequired
public Stack getStack();
- Type: com.aliyun.ros.cdk.core.Stack
The stack in which this resource is defined.
resourceOptional
public RosResource getResource();
- Type: com.aliyun.ros.cdk.core.RosResource
attrArnRequired
public java.lang.Object getAttrArn();
- Type: java.lang.String OR com.aliyun.ros.cdk.core.IResolvable
Attribute Arn: The Alibaba Cloud Resource Name (ARN).
attrInstanceIdRequired
public java.lang.Object getAttrInstanceId();
- Type: java.lang.String OR com.aliyun.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.
attrTopicRequired
public java.lang.Object getAttrTopic();
- Type: java.lang.String OR com.aliyun.ros.cdk.core.IResolvable
Attribute Topic: Topic name.
propsRequired
public TopicProps getProps();
- Type: TopicProps