You've already forked Curso-lenguaje-python
Add diagrams test
This commit is contained in:
25
catch-all/07_diagrams_as_code/09_consumers_rabbitmq.py
Normal file
25
catch-all/07_diagrams_as_code/09_consumers_rabbitmq.py
Normal file
@@ -0,0 +1,25 @@
|
||||
#! /usr/bin/env python
|
||||
|
||||
from urllib.request import urlretrieve
|
||||
|
||||
from diagrams import Cluster, Diagram
|
||||
from diagrams.aws.database import Aurora
|
||||
from diagrams.custom import Custom
|
||||
from diagrams.k8s.compute import Pod
|
||||
|
||||
# Download an image to be used into a Custom Node class
|
||||
rabbitmq_url = "https://jpadilla.github.io/rabbitmqapp/assets/img/icon.png"
|
||||
rabbitmq_icon = "rabbitmq.png"
|
||||
urlretrieve(rabbitmq_url, rabbitmq_icon)
|
||||
|
||||
with Diagram("Broker Consumers", show=False):
|
||||
with Cluster("Consumers"):
|
||||
consumers = [
|
||||
Pod("worker"),
|
||||
Pod("worker"),
|
||||
Pod("worker")
|
||||
]
|
||||
|
||||
queue = Custom("Message queue", rabbitmq_icon)
|
||||
|
||||
queue >> consumers >> Aurora("Database")
|
||||
Reference in New Issue
Block a user