Modeling AWS Structures with PlantUML and AsciiDoc

The AWS shapes are included in the PlantUML stdlib .. simply include them as shown here: example.puml @startuml !include <awslib/AWSCommon> !include <awslib/Analytics/ManagedStreamingforKafka> !include <awslib/Database/RDS> !include <awslib/General/Users> !include <awslib/General/InternetGateway> !include <kubernetes/k8s-sprites-labeled-25pct> skinparam linetype ortho title "AWS Context Diagram" package "EKS Kubernetes Cluster" as eks_cluster { component "<$pod>\napp1" as pod1 component "<$pod>\napp2" as pod2 } ManagedStreamingforKafka(kafka_pod, "Amazon MSK", "Apache Kafka") RDS(pg_rds, "PostgreSQL", "Sample Schema") Users(users, "AppUsers","editors, admins") InternetGateway(igw1, "Customer Gateway", "Customer access to internal services") users -> igw1 igw1 --> pod1 igw1 --> pod2 pod1 --> pg_rds pod1 --> kafka_pod pod2 --> pg_rds pod2 --> kafka_pod @enduml ...

November 8, 2022 · 1 min · 117 words · Micha Kops

C4 Modeling with PlantUML and AsciiDoc

C4 models allow us to visualize software architecture by decomposition in containers and components. Viewpoints are organized in hierarchical levels: Context Diagrams (Level 1) Container Diagrams (Level 2) Component Diagrams (Level 3) Code Diagrams (Level 4) C4-PlantUML offers a variety of macros and stereotypes that make modeling fun. An example in PlantUML: sample.puml @startuml !include <c4/C4_Context.puml> !include <c4/C4_Container.puml> left to right direction Person(user, "User") System_Ext(auth, "AuthService", "Provides authentication and authorization via OIDC") System_Boundary(zone1, "Some system boundary") { System(lb, "Load Balancer") System_Boundary(az, "App Cluster") { System(app, "App Servers") { Container(app1, "App1", "Docker", "Does stuff") Container(app2, "App1", "Docker", "Does stuff") ContainerDb(dbSess, "Session DB", "Redis") ContainerDb(db1, "RBMS 1", "AWS RDS Postgres") ContainerDb(db2, "RBMS 2", "AWS RDS Postgres") ' both app servers sync sessions via redis Rel(app1, dbSess, "Uses", "Sync Session") Rel(app2, dbSess, "Uses", "Sync Session") ' both app servers persist data in RDBMS Rel(app1, db1, "Uses", "Persist/query relational data") Rel(app2, db2, "Uses", "Persist/query relational data") } } } Rel(user, lb, "call") Rel(lb, app1, "delegate") Rel(lb, app2, "delegate") Rel(app1, auth, "Verify", "User auth") Rel(app2, auth, "Verify", "User auth") SHOW_FLOATING_LEGEND() @enduml ...

November 1, 2022 · 1 min · 208 words · Micha Kops

Snippet: Adding Legends to PlantUML Diagrams

The following hack allows us to draw a diagram in a diagram in a table in a legend :D example-diagram.puml @startuml skinparam legendBackgroundColor transparent skinparam legendBorderColor transparent actor Editor as editor queue Queue as "Message\nQueue" editor -> [Component] : call [Component] --> Queue : publish legend right {{ scale 0.7 skinparam defaultFontSize 14 skinparam BackGroundColor transparent skinparam defaultBackgroundColor white !procedure $entry($type, $label, $scale=1) {{\nscale $scale \nskinparam backgroundcolor transparent\nlabel " " as A\nlabel " " as B\n $type \n}} => $label !endprocedure map "<b>Legend</b>" as legend #white { $entry(":Editor:","\nEditor for Data xyz", 0.6) $entry("[Component]","\nSome Component", 0.8) $entry("queue Queue","\nKafka-Topic", 1) $entry("A -> B","Data-Flow") } }} endlegend @enduml ...

October 21, 2022 · 1 min · 128 words · Micha Kops

Generating PlantUML Class Diagrams from a Java Project

As technical documentation for my Java software projects often makes use of technologies like AsciiDoctor and PlantUML, having a tool to analyze existing structures and generating class diagrams from it, is a nice thing. Luckily, the Maven plugin from the Living Documentation Project does all the work for me here. Setup We just need to add the following Maven plugin to our project’s pom.xml: <plugin> <groupId>ch.ifocusit.livingdoc</groupId> <artifactId>livingdoc-maven-plugin</artifactId> <version>1.2</version> <executions> <execution> <id>class-diagram</id> <phase>package</phase> <goals> <goal>diagram</goal> <goal>glossary</goal> </goals> </execution> </executions> <configuration> <packageRoot>com.hascode</packageRoot> <interactive>true</interactive> </configuration> </plugin> ...

January 7, 2022 · 1 min · 117 words · Micha Kops

Reactive Streams – Java 9 Flow API, RxJava, Akka and Reactor Examples

Reactive Streams is an initiative trying to standardize asynchronous stream processing with non-blocking back-pressure. With Java 9, new classes in the java.util.concurrent.flow package offer a semantically equivalent counterpart to this standard that may be adopted by other frameworks. In the following short tutorial we’re implementing examples for reactive streams with Java 9 and the Flow API, with RxJava2, with Akka, with Reactor and finally there is an example in RxJava1, too though it does not follow the standard. ...

January 14, 2018 · 8 min · 1550 words · Micha Kops