Help Center/
Data Ingestion Service/
SDK Reference/
Getting Started with SDK/
Using the Java SDK/
Changing Partition Quantity
Updated on 2024-10-25 GMT+08:00
Changing Partition Quantity
Initialize a DIS SDK client instance named dic. For details, see Initializing a DIS SDK Client Instance.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
//Specify the number of target partitions. int targetPartitionCount = 2; UpdatePartitionCountRequest update = new UpdatePartitionCountRequest(); update.setStreamName(streamName); update.setTargetPartitionCount(targetPartitionCount); try { UpdatePartitionCountResult updatePartitionCountResult = dic.updatePartitionCount(update); LOGGER.info("Success to update partition count, {}", updatePartitionCountResult); } catch (Exception e) { LOGGER.error("Failed to update partition count", e); } |
If the number of partitions is changed successfully, information similar to the following is returned:
1
|
Success to update partition count, UpdatePartitionCountResult [currentPartitionCount=2, streamName=mystream, targetPartitionCount=2] |
Parent topic: Using the Java SDK
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
The system is busy. Please try again later.
For any further questions, feel free to contact us through the chatbot.
Chatbot