利用PlantUML可以非常方便的画各种UML图,下面是我画的KafkaProducer的类图。
Screen Shot 2020-04-09 at 9.46.43 PM.png
最方便的是这个图是用几行代码表达出来的。
@startuml
!includeurl https://raw.githubusercontent.com/ebbypeter/Archimate-PlantUML/master/Archimate.puml
title Kafka Producer
' KafkaProducer Elements
class KafkaProducer
class ProducerMetadata
class ProducerConfig
class DefaultPartitioner
class RecordAccumulator {
ConcurrentMap<TopicPartition, Deque<ProducerBatch>> batches
}
class Sender
' RecordAccumulator Elements
class ProducerBatch
class TopicPartition
' Sender Elements
class KafkaClient
' KafkaProducer Relationships
Rel_Serving_Up(KafkaProducer, ProducerMetadata, "")
Rel_Serving_Up(KafkaProducer, ProducerConfig, "")
Rel_Serving_Up(KafkaProducer, DefaultPartitioner, "")
Rel_Serving_Up(KafkaProducer, RecordAccumulator, "")
Rel_Serving_Up(KafkaProducer, Sender, "")
' RecordAccumulator Relationships
Rel_Serving_Up(RecordAccumulator, ProducerBatch, "")
Rel_Serving_Up(RecordAccumulator, TopicPartition, "")
' Sender Relationships
Rel_Serving_Up(Sender, RecordAccumulator, "")
Rel_Serving_Up(Sender, ProducerMetadata, "")
Rel_Serving_Up(Sender, KafkaClient, "")
@enduml
我是用的intellij idea的plantuml插件画的。sublime和vscode都有插件支持。
下次我再画一下KafkaProducer的方法调用序列图sequence uml。
网友评论